Repository: solid/community-server
Pull request #122 (2020-09-02 22:08:31)

Change dataType on Representation into binary
The `dataType` field would be highly redundant, since we also have the content type on the metadata.

What we really need to know, is whether we have a stream of strings or objects, which I propose to indicate with a binary field. Whatever subtype of non-binary it is, will be disclosed in the content type anyway.

joachimvh: I think this might also be a point to consider how much added value `dataType` has. Currently it is equal to `contentType === INTERNAL_QUADS` (and actually also equal to `data.readableObjectMode`, which unfortunately can only be checked starting from Node 12).

Patch:
diff --git a/index.ts b/index.ts
index 99c5d0d45..4e74f2cd5 100644
--- a/index.ts
+++ b/index.ts
@@ -47,8 +47,6 @@ export * from './src/ldp/permissions/BasePermissionsExtractor';
 export * from './src/ldp/permissions/SparqlPatchPermissionsExtractor';
 
 // LDP/Representation
-export * from './src/ldp/representation/BinaryRepresentation';
-export * from './src/ldp/representation/QuadRepresentation';
 export * from './src/ldp/representation/Representation';
 export * from './src/ldp/representation/RepresentationMetadata';
 export * from './src/ldp/representation/RepresentationPreference';
diff --git a/src/authorization/WebAclAuthorizer.ts b/src/authorization/WebAclAuthorizer.ts
index fe53a4d78..dee626e0d 100644
--- a/src/authorization/WebAclAuthorizer.ts
+++ b/src/authorization/WebAclAuthorizer.ts
@@ -5,7 +5,7 @@ import { Representation } from '../ldp/representation/Representation';
 import { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier';
 import { ContainerManager } from '../storage/ContainerManager';
 import { ResourceStore } from '../storage/ResourceStore';
-import { CONTENT_TYPE_QUADS } from '../util/ContentTypes';
+import { INTERNAL_QUADS } from '../util/ContentTypes';
 import { ForbiddenHttpError } from '../util/errors/ForbiddenHttpError';
 import { NotFoundHttpError } from '../util/errors/NotFoundHttpError';
 import { UnauthorizedHttpError } from '../util/errors/UnauthorizedHttpError';
@@ -111,7 +111,7 @@ export class WebAclAuthorizer extends Authorizer {
   private async getAclRecursive(id: ResourceIdentifier, recurse?: boolean): Promise<Store> {
     try {
       const acl = await this.aclManager.getAcl(id);
-      const data = await this.resourceStore.getRepresentation(acl, { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]});
+      const data = await this.resourceStore.getRepresentation(acl, { type: [{ value: INTERNAL_QUADS, weight: 1 }]});
       return this.filterData(data, recurse ? ACL.default : ACL.accessTo, id.path);
     } catch (error) {
       if (!(error instanceof NotFoundHttpError)) {
diff --git a/src/init/Setup.ts b/src/init/Setup.ts
index fe2af358b..e54676749 100644
--- a/src/init/Setup.ts
+++ b/src/init/Setup.ts
@@ -2,7 +2,7 @@ import streamifyArray from 'streamify-array';
 import { AclManager } from '../authorization/AclManager';
 import { ExpressHttpServer } from '../server/ExpressHttpServer';
 import { ResourceStore } from '../storage/ResourceStore';
-import { DATA_TYPE_BINARY } from '../util/ContentTypes';
+import { TEXT_TURTLE } from '../util/ContentTypes';
 import { RuntimeConfig, RuntimeConfigData } from './RuntimeConfig';
 
 /**
@@ -52,12 +52,12 @@ export class Setup {
       await this.store.setRepresentation(
         await this.aclManager.getAcl({ path: this.runtimeConfig.base }),
         {
-          dataType: DATA_TYPE_BINARY,
+          binary: true,
           data: streamifyArray([ acl ]),
           metadata: {
             raw: [],
             profiles: [],
-            contentType: 'text/turtle',
+            contentType: TEXT_TURTLE,
           },
         },
       );
diff --git a/src/ldp/http/BasicResponseWriter.ts b/src/ldp/http/BasicResponseWriter.ts
index e8e5c5739..855cd6240 100644
--- a/src/ldp/http/BasicResponseWriter.ts
+++ b/src/ldp/http/BasicResponseWriter.ts
@@ -1,5 +1,4 @@
 import { HttpResponse } from '../../server/HttpResponse';
-import { DATA_TYPE_BINARY } from '../../util/ContentTypes';
 import { HttpError } from '../../util/errors/HttpError';
 import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError';
 import { ResponseDescription } from '../operations/ResponseDescription';
@@ -12,8 +11,7 @@ import { ResponseWriter } from './ResponseWriter';
 export class BasicResponseWriter extends ResponseWriter {
   public async canHandle(input: { response: HttpResponse; result: ResponseDescription | Error }): Promise<void> {
     if (!(input.result instanceof Error)) {
-      const dataType = input.result.body?.dataType;
-      if (dataType && dataType !== DATA_TYPE_BINARY) {
+      if (input.result.body && !input.result.body.binary) {
         throw new UnsupportedHttpError('Only binary results are supported.');
       }
     }
diff --git a/src/ldp/http/RawBodyParser.ts b/src/ldp/http/RawBodyParser.ts
index 76f9132c4..bab6f44d5 100644
--- a/src/ldp/http/RawBodyParser.ts
+++ b/src/ldp/http/RawBodyParser.ts
@@ -1,7 +1,6 @@
 import { HttpRequest } from '../../server/HttpRequest';
-import { DATA_TYPE_BINARY } from '../../util/ContentTypes';
 import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError';
-import { BinaryRepresentation } from '../representation/BinaryRepresentation';
+import { Representation } from '../representation/Representation';
 import { RepresentationMetadata } from '../representation/RepresentationMetadata';
 import { BodyParser } from './BodyParser';
 
@@ -17,13 +16,13 @@ export class RawBodyParser extends BodyParser {
 
   // Note that the only reason this is a union is in case the body is empty.
   // If this check gets moved away from the BodyParsers this union could be removed
-  public async handle(input: HttpRequest): Promise<BinaryRepresentation | undefined> {
+  public async handle(input: HttpRequest): Promise<Representation | undefined> {
     if (!input.headers['content-type']) {
       return;
     }
 
     return {
-      dataType: DATA_TYPE_BINARY,
+      binary: true,
       data: input,
       metadata: this.parseMetadata(input),
     };
diff --git a/src/ldp/http/SparqlUpdateBodyParser.ts b/src/ldp/http/SparqlUpdateBodyParser.ts
index c2f915fde..3689703c9 100644
--- a/src/ldp/http/SparqlUpdateBodyParser.ts
+++ b/src/ldp/http/SparqlUpdateBodyParser.ts
@@ -1,7 +1,6 @@
 import { PassThrough } from 'stream';
 import { translate } from 'sparqlalgebrajs';
 import { HttpRequest } from '../../server/HttpRequest';
-import { DATA_TYPE_BINARY } from '../../util/ContentTypes';
 import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError';
 import { UnsupportedMediaTypeHttpError } from '../../util/errors/UnsupportedMediaTypeHttpError';
 import { readableToString } from '../../util/Util';
@@ -37,7 +36,7 @@ export class SparqlUpdateBodyParser extends BodyParser {
       // Prevent body from being requested again
       return {
         algebra,
-        dataType: DATA_TYPE_BINARY,
+        binary: true,
         data: dataCopy,
         metadata: {
           raw: [],
diff --git a/src/ldp/representation/BinaryRepresentation.ts b/src/ldp/representation/BinaryRepresentation.ts
deleted file mode 100644
index 33a791611..000000000
--- a/src/ldp/representation/BinaryRepresentation.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { Readable } from 'stream';
-import { Representation } from './Representation';
-
-/**
- * A representation containing binary data.
- */
-export interface BinaryRepresentation extends Representation {
-  dataType: 'binary';
-  data: Readable;
-}
diff --git a/src/ldp/representation/QuadRepresentation.ts b/src/ldp/representation/QuadRepresentation.ts
deleted file mode 100644
index 629a2bd1c..000000000
--- a/src/ldp/representation/QuadRepresentation.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { Readable } from 'stream';
-import { Representation } from './Representation';
-
-/**
- * A representation containing quads as data.
- */
-export interface QuadRepresentation extends Representation {
-  dataType: 'quad';
-  data: Readable;
-}
diff --git a/src/ldp/representation/Representation.ts b/src/ldp/representation/Representation.ts
index eff8295aa..69c181c16 100644
--- a/src/ldp/representation/Representation.ts
+++ b/src/ldp/representation/Representation.ts
@@ -14,7 +14,8 @@ export interface Representation {
    */
   data: Readable;
   /**
-   * The data type of the contents in the data stream.
+   * Whether the data stream consists of binary/string chunks
+   * (as opposed to complex objects).
    */
-  dataType: string;
+  binary: boolean;
 }
diff --git a/src/storage/FileResourceStore.ts b/src/storage/FileResourceStore.ts
index 531f13b27..963d0f12d 100644
--- a/src/storage/FileResourceStore.ts
+++ b/src/storage/FileResourceStore.ts
@@ -9,7 +9,7 @@ import { RuntimeConfig } from '../init/RuntimeConfig';
 import { Representation } from '../ldp/representation/Representation';
 import { RepresentationMetadata } from '../ldp/representation/RepresentationMetadata';
 import { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_BINARY, DATA_TYPE_QUAD } from '../util/ContentTypes';
+import { INTERNAL_QUADS } from '../util/ContentTypes';
 import { ConflictHttpError } from '../util/errors/ConflictHttpError';
 import { MethodNotAllowedHttpError } from '../util/errors/MethodNotAllowedHttpError';
 import { NotFoundHttpError } from '../util/errors/NotFoundHttpError';
@@ -59,7 +59,7 @@ export class FileResourceStore implements ResourceStore {
    * @returns The newly generated identifier.
    */
   public async addResource(container: ResourceIdentifier, representation: Representation): Promise<ResourceIdentifier> {
-    if (representation.dataType !== DATA_TYPE_BINARY) {
+    if (!representation.binary) {
       throw new UnsupportedMediaTypeHttpError('FileResourceStore only supports binary representations.');
     }
 
@@ -149,7 +149,7 @@ export class FileResourceStore implements ResourceStore {
    * @param representation - New Representation.
    */
   public async setRepresentation(identifier: ResourceIdentifier, representation: Representation): Promise<void> {
-    if (representation.dataType !== DATA_TYPE_BINARY) {
+    if (!representation.binary) {
       throw new UnsupportedMediaTypeHttpError('FileResourceStore only supports binary representations.');
     }
 
@@ -264,7 +264,7 @@ export class FileResourceStore implements ResourceStore {
     if (contentType) {
       metadata.contentType = contentType;
     }
-    return { metadata, data: readStream, dataType: DATA_TYPE_BINARY };
+    return { metadata, data: readStream, binary: true };
   }
 
   /**
@@ -295,12 +295,12 @@ export class FileResourceStore implements ResourceStore {
     }
 
     return {
-      dataType: DATA_TYPE_QUAD,
+      binary: false,
       data: streamifyArray(quads),
       metadata: {
         raw: rawMetadata,
         dateTime: stats.mtime,
-        contentType: CONTENT_TYPE_QUADS,
+        contentType: INTERNAL_QUADS,
       },
     };
   }
diff --git a/src/storage/InMemoryResourceStore.ts b/src/storage/InMemoryResourceStore.ts
index 6934757f1..f2cfb8d28 100644
--- a/src/storage/InMemoryResourceStore.ts
+++ b/src/storage/InMemoryResourceStore.ts
@@ -3,7 +3,7 @@ import streamifyArray from 'streamify-array';
 import { RuntimeConfig } from '../init/RuntimeConfig';
 import { Representation } from '../ldp/representation/Representation';
 import { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier';
-import { DATA_TYPE_BINARY } from '../util/ContentTypes';
+import { TEXT_TURTLE } from '../util/ContentTypes';
 import { NotFoundHttpError } from '../util/errors/NotFoundHttpError';
 import { ensureTrailingSlash } from '../util/Util';
 import { ResourceStore } from './ResourceStore';
@@ -27,9 +27,9 @@ export class InMemoryResourceStore implements ResourceStore {
     this.store = {
       // Default root entry (what you get when the identifier is equal to the base)
       '': {
-        dataType: DATA_TYPE_BINARY,
+        binary: true,
         data: streamifyArray([]),
-        metadata: { raw: [], profiles: [], contentType: 'text/turtle' },
+        metadata: { raw: [], profiles: [], contentType: TEXT_TURTLE },
       },
     };
   }
@@ -132,7 +132,7 @@ export class InMemoryResourceStore implements ResourceStore {
   private async copyRepresentation(source: Representation): Promise<Representation> {
     const arr = await arrayifyStream(source.data);
     return {
-      dataType: source.dataType,
+      binary: source.binary,
       data: streamifyArray([ ...arr ]),
       metadata: source.metadata,
     };
@@ -152,7 +152,7 @@ export class InMemoryResourceStore implements ResourceStore {
     source.data = streamifyArray([ ...arr ]);
 
     return {
-      dataType: source.dataType,
+      binary: source.binary,
       data: streamifyArray([ ...arr ]),
       metadata: source.metadata,
     };
diff --git a/src/storage/conversion/QuadToRdfConverter.ts b/src/storage/conversion/QuadToRdfConverter.ts
index bf53442d3..13501663d 100644
--- a/src/storage/conversion/QuadToRdfConverter.ts
+++ b/src/storage/conversion/QuadToRdfConverter.ts
@@ -3,7 +3,7 @@ import rdfSerializer from 'rdf-serialize';
 import { Representation } from '../../ldp/representation/Representation';
 import { RepresentationMetadata } from '../../ldp/representation/RepresentationMetadata';
 import { RepresentationPreferences } from '../../ldp/representation/RepresentationPreferences';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_BINARY } from '../../util/ContentTypes';
+import { INTERNAL_QUADS } from '../../util/ContentTypes';
 import { checkRequest, matchingTypes } from './ConversionUtil';
 import { RepresentationConverterArgs } from './RepresentationConverter';
 import { TypedRepresentationConverter } from './TypedRepresentationConverter';
@@ -13,7 +13,7 @@ import { TypedRepresentationConverter } from './TypedRepresentationConverter';
  */
 export class QuadToRdfConverter extends TypedRepresentationConverter {
   public async getInputTypes(): Promise<{ [contentType: string]: number }> {
-    return { [CONTENT_TYPE_QUADS]: 1 };
+    return { [INTERNAL_QUADS]: 1 };
   }
 
   public async getOutputTypes(): Promise<{ [contentType: string]: number }> {
@@ -21,7 +21,7 @@ export class QuadToRdfConverter extends TypedRepresentationConverter {
   }
 
   public async canHandle(input: RepresentationConverterArgs): Promise<void> {
-    checkRequest(input, [ CONTENT_TYPE_QUADS ], await rdfSerializer.getContentTypes());
+    checkRequest(input, [ INTERNAL_QUADS ], await rdfSerializer.getContentTypes());
   }
 
   public async handle(input: RepresentationConverterArgs): Promise<Representation> {
@@ -32,7 +32,7 @@ export class QuadToRdfConverter extends TypedRepresentationConverter {
     const contentType = matchingTypes(preferences, await rdfSerializer.getContentTypes())[0].value;
     const metadata: RepresentationMetadata = { ...quads.metadata, contentType };
     return {
-      dataType: DATA_TYPE_BINARY,
+      binary: true,
       data: rdfSerializer.serialize(quads.data, { contentType }) as Readable,
       metadata,
     };
diff --git a/src/storage/conversion/QuadToTurtleConverter.ts b/src/storage/conversion/QuadToTurtleConverter.ts
index 4187bad4a..460f9a90b 100644
--- a/src/storage/conversion/QuadToTurtleConverter.ts
+++ b/src/storage/conversion/QuadToTurtleConverter.ts
@@ -1,7 +1,7 @@
 import { StreamWriter } from 'n3';
 import { Representation } from '../../ldp/representation/Representation';
 import { RepresentationMetadata } from '../../ldp/representation/RepresentationMetadata';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_BINARY } from '../../util/ContentTypes';
+import { INTERNAL_QUADS, TEXT_TURTLE } from '../../util/ContentTypes';
 import { checkRequest } from './ConversionUtil';
 import { RepresentationConverter, RepresentationConverterArgs } from './RepresentationConverter';
 
@@ -10,7 +10,7 @@ import { RepresentationConverter, RepresentationConverterArgs } from './Represen
  */
 export class QuadToTurtleConverter extends RepresentationConverter {
   public async canHandle(input: RepresentationConverterArgs): Promise<void> {
-    checkRequest(input, [ CONTENT_TYPE_QUADS ], [ 'text/turtle' ]);
+    checkRequest(input, [ INTERNAL_QUADS ], [ TEXT_TURTLE ]);
   }
 
   public async handle(input: RepresentationConverterArgs): Promise<Representation> {
@@ -18,10 +18,10 @@ export class QuadToTurtleConverter extends RepresentationConverter {
   }
 
   private quadsToTurtle(quads: Representation): Representation {
-    const metadata: RepresentationMetadata = { ...quads.metadata, contentType: 'text/turtle' };
+    const metadata: RepresentationMetadata = { ...quads.metadata, contentType: TEXT_TURTLE };
     return {
-      dataType: DATA_TYPE_BINARY,
-      data: quads.data.pipe(new StreamWriter({ format: 'text/turtle' })),
+      binary: true,
+      data: quads.data.pipe(new StreamWriter({ format: TEXT_TURTLE })),
       metadata,
     };
   }
diff --git a/src/storage/conversion/RdfToQuadConverter.ts b/src/storage/conversion/RdfToQuadConverter.ts
index 2c8542efa..a2faf66d7 100644
--- a/src/storage/conversion/RdfToQuadConverter.ts
+++ b/src/storage/conversion/RdfToQuadConverter.ts
@@ -2,7 +2,7 @@ import { PassThrough } from 'stream';
 import rdfParser from 'rdf-parse';
 import { Representation } from '../../ldp/representation/Representation';
 import { RepresentationMetadata } from '../../ldp/representation/RepresentationMetadata';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_QUAD } from '../../util/ContentTypes';
+import { INTERNAL_QUADS } from '../../util/ContentTypes';
 import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError';
 import { checkRequest } from './ConversionUtil';
 import { RepresentationConverterArgs } from './RepresentationConverter';
@@ -17,11 +17,11 @@ export class RdfToQuadConverter extends TypedRepresentationConverter {
   }
 
   public async getOutputTypes(): Promise<{ [contentType: string]: number }> {
-    return { [CONTENT_TYPE_QUADS]: 1 };
+    return { [INTERNAL_QUADS]: 1 };
   }
 
   public async canHandle(input: RepresentationConverterArgs): Promise<void> {
-    checkRequest(input, await rdfParser.getContentTypes(), [ CONTENT_TYPE_QUADS ]);
+    checkRequest(input, await rdfParser.getContentTypes(), [ INTERNAL_QUADS ]);
   }
 
   public async handle(input: RepresentationConverterArgs): Promise<Representation> {
@@ -29,7 +29,7 @@ export class RdfToQuadConverter extends TypedRepresentationConverter {
   }
 
   private rdfToQuads(representation: Representation, baseIRI: string): Representation {
-    const metadata: RepresentationMetadata = { ...representation.metadata, contentType: CONTENT_TYPE_QUADS };
+    const metadata: RepresentationMetadata = { ...representation.metadata, contentType: INTERNAL_QUADS };
 
     // Catch parsing errors and emit correct error
     // Node 10 requires both writableObjectMode and readableObjectMode
@@ -42,7 +42,7 @@ export class RdfToQuadConverter extends TypedRepresentationConverter {
     data.on('error', (error): boolean => errorStream.emit('error', new UnsupportedHttpError(error.message)));
 
     return {
-      dataType: DATA_TYPE_QUAD,
+      binary: false,
       data: errorStream,
       metadata,
     };
diff --git a/src/storage/conversion/TurtleToQuadConverter.ts b/src/storage/conversion/TurtleToQuadConverter.ts
index d97b00fe0..d584cd542 100644
--- a/src/storage/conversion/TurtleToQuadConverter.ts
+++ b/src/storage/conversion/TurtleToQuadConverter.ts
@@ -2,7 +2,7 @@ import { PassThrough } from 'stream';
 import { StreamParser } from 'n3';
 import { Representation } from '../../ldp/representation/Representation';
 import { RepresentationMetadata } from '../../ldp/representation/RepresentationMetadata';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_QUAD } from '../../util/ContentTypes';
+import { TEXT_TURTLE, INTERNAL_QUADS } from '../../util/ContentTypes';
 import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError';
 import { checkRequest } from './ConversionUtil';
 import { RepresentationConverter, RepresentationConverterArgs } from './RepresentationConverter';
@@ -12,7 +12,7 @@ import { RepresentationConverter, RepresentationConverterArgs } from './Represen
  */
 export class TurtleToQuadConverter extends RepresentationConverter {
   public async canHandle(input: RepresentationConverterArgs): Promise<void> {
-    checkRequest(input, [ 'text/turtle' ], [ CONTENT_TYPE_QUADS ]);
+    checkRequest(input, [ TEXT_TURTLE ], [ INTERNAL_QUADS ]);
   }
 
   public async handle(input: RepresentationConverterArgs): Promise<Representation> {
@@ -20,17 +20,17 @@ export class TurtleToQuadConverter extends RepresentationConverter {
   }
 
   private turtleToQuads(turtle: Representation, baseIRI: string): Representation {
-    const metadata: RepresentationMetadata = { ...turtle.metadata, contentType: CONTENT_TYPE_QUADS };
+    const metadata: RepresentationMetadata = { ...turtle.metadata, contentType: INTERNAL_QUADS };
 
     // Catch parsing errors and emit correct error
     // Node 10 requires both writableObjectMode and readableObjectMode
     const errorStream = new PassThrough({ writableObjectMode: true, readableObjectMode: true });
-    const data = turtle.data.pipe(new StreamParser({ format: 'text/turtle', baseIRI }));
+    const data = turtle.data.pipe(new StreamParser({ format: TEXT_TURTLE, baseIRI }));
     data.pipe(errorStream);
     data.on('error', (error): boolean => errorStream.emit('error', new UnsupportedHttpError(error.message)));
 
     return {
-      dataType: DATA_TYPE_QUAD,
+      binary: false,
       data: errorStream,
       metadata,
     };
diff --git a/src/storage/patch/SparqlUpdatePatchHandler.ts b/src/storage/patch/SparqlUpdatePatchHandler.ts
index e66629b01..98e4a8b98 100644
--- a/src/storage/patch/SparqlUpdatePatchHandler.ts
+++ b/src/storage/patch/SparqlUpdatePatchHandler.ts
@@ -7,7 +7,7 @@ import { Algebra } from 'sparqlalgebrajs';
 import { SparqlUpdatePatch } from '../../ldp/http/SparqlUpdatePatch';
 import { Representation } from '../../ldp/representation/Representation';
 import { ResourceIdentifier } from '../../ldp/representation/ResourceIdentifier';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_QUAD } from '../../util/ContentTypes';
+import { INTERNAL_QUADS } from '../../util/ContentTypes';
 import { UnsupportedHttpError } from '../../util/errors/UnsupportedHttpError';
 import { ResourceLocker } from '../ResourceLocker';
 import { ResourceStore } from '../ResourceStore';
@@ -56,7 +56,7 @@ export class SparqlUpdatePatchHandler extends PatchHandler {
 
     const lock = await this.locker.acquire(input.identifier);
     const quads = await this.source.getRepresentation(input.identifier,
-      { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]});
+      { type: [{ value: INTERNAL_QUADS, weight: 1 }]});
     const store = new Store<BaseQuad>();
     const importEmitter = store.import(quads.data);
     await new Promise((resolve, reject): void => {
@@ -66,12 +66,12 @@ export class SparqlUpdatePatchHandler extends PatchHandler {
     store.removeQuads(deletes);
     store.addQuads(inserts);
     const representation: Representation = {
+      binary: false,
       data: store.match() as Readable,
-      dataType: DATA_TYPE_QUAD,
       metadata: {
         raw: [],
         profiles: [],
-        contentType: CONTENT_TYPE_QUADS,
+        contentType: INTERNAL_QUADS,
       },
     };
     await this.source.setRepresentation(input.identifier, representation);
diff --git a/src/util/ContentTypes.ts b/src/util/ContentTypes.ts
index a757e88b8..762303287 100644
--- a/src/util/ContentTypes.ts
+++ b/src/util/ContentTypes.ts
@@ -1,4 +1,5 @@
-export const DATA_TYPE_BINARY = 'binary';
-export const DATA_TYPE_QUAD = 'quad';
+// Well-known content types
+export const TEXT_TURTLE = 'text/turtle';
 
-export const CONTENT_TYPE_QUADS = 'internal/quads';
+// Internal (non-exposed) content types
+export const INTERNAL_QUADS = 'internal/quads';
diff --git a/src/util/MetadataController.ts b/src/util/MetadataController.ts
index dcf8093c7..0ea896886 100644
--- a/src/util/MetadataController.ts
+++ b/src/util/MetadataController.ts
@@ -4,6 +4,7 @@ import arrayifyStream from 'arrayify-stream';
 import { DataFactory, StreamParser, StreamWriter } from 'n3';
 import { NamedNode, Quad } from 'rdf-js';
 import streamifyArray from 'streamify-array';
+import { TEXT_TURTLE } from '../util/ContentTypes';
 import { LDP, RDF, STAT, TERMS, XML } from './Prefixes';
 
 export const TYPE_PREDICATE = DataFactory.namedNode(`${RDF}type`);
@@ -69,7 +70,7 @@ export class MetadataController {
    * @returns The Readable object.
    */
   public generateReadableFromQuads(quads: Quad[]): Readable {
-    return streamifyArray(quads).pipe(new StreamWriter({ format: 'text/turtle' }));
+    return streamifyArray(quads).pipe(new StreamWriter({ format: TEXT_TURTLE }));
   }
 
   /**
@@ -79,6 +80,6 @@ export class MetadataController {
    * @returns A promise containing the array of quads.
    */
   public async generateQuadsFromReadable(readable: Readable): Promise<Quad[]> {
-    return arrayifyStream(readable.pipe(new StreamParser({ format: 'text/turtle' })));
+    return arrayifyStream(readable.pipe(new StreamParser({ format: TEXT_TURTLE })));
   }
 }


Test patch:
diff --git a/test/integration/Authorization.test.ts b/test/integration/Authorization.test.ts
index 8c6aff81b..3c65ae6ff 100644
--- a/test/integration/Authorization.test.ts
+++ b/test/integration/Authorization.test.ts
@@ -26,7 +26,6 @@ import { RepresentationConvertingStore } from '../../src/storage/RepresentationC
 import { ResourceStore } from '../../src/storage/ResourceStore';
 import { UrlContainerManager } from '../../src/storage/UrlContainerManager';
 import { CompositeAsyncHandler } from '../../src/util/CompositeAsyncHandler';
-import { DATA_TYPE_BINARY } from '../../src/util/ContentTypes';
 import { call } from '../util/Util';
 
 const setAcl = async(store: ResourceStore, id: string, permissions: PermissionSet, control: boolean,
@@ -61,8 +60,8 @@ const setAcl = async(store: ResourceStore, id: string, permissions: PermissionSe
   acl.push('.');
 
   const representation = {
+    binary: true,
     data: streamifyArray(acl),
-    dataType: DATA_TYPE_BINARY,
     metadata: {
       raw: [],
       profiles: [],
diff --git a/test/integration/RepresentationConverter.test.ts b/test/integration/RepresentationConverter.test.ts
index db0a5102b..ea664bf8c 100644
--- a/test/integration/RepresentationConverter.test.ts
+++ b/test/integration/RepresentationConverter.test.ts
@@ -3,7 +3,6 @@ import { Representation } from '../../src/ldp/representation/Representation';
 import { ChainedConverter } from '../../src/storage/conversion/ChainedConverter';
 import { QuadToRdfConverter } from '../../src/storage/conversion/QuadToRdfConverter';
 import { RdfToQuadConverter } from '../../src/storage/conversion/RdfToQuadConverter';
-import { DATA_TYPE_BINARY } from '../../src/util/ContentTypes';
 import { readableToString } from '../../src/util/Util';
 
 describe('A ChainedConverter', (): void => {
@@ -15,7 +14,7 @@ describe('A ChainedConverter', (): void => {
 
   it('can convert from JSON-LD to turtle.', async(): Promise<void> => {
     const representation: Representation = {
-      dataType: DATA_TYPE_BINARY,
+      binary: true,
       data: streamifyArray([ '{"@id": "http://test.com/s", "http://test.com/p": { "@id": "http://test.com/o" }}' ]),
       metadata: { raw: [], contentType: 'application/ld+json' },
     };
@@ -32,7 +31,7 @@ describe('A ChainedConverter', (): void => {
 
   it('can convert from turtle to JSON-LD.', async(): Promise<void> => {
     const representation: Representation = {
-      dataType: DATA_TYPE_BINARY,
+      binary: true,
       data: streamifyArray([ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ]),
       metadata: { raw: [], contentType: 'text/turtle' },
     };
diff --git a/test/integration/RequestParser.test.ts b/test/integration/RequestParser.test.ts
index abcf4c40c..aa39023ad 100644
--- a/test/integration/RequestParser.test.ts
+++ b/test/integration/RequestParser.test.ts
@@ -6,7 +6,6 @@ import { BasicRequestParser } from '../../src/ldp/http/BasicRequestParser';
 import { BasicTargetExtractor } from '../../src/ldp/http/BasicTargetExtractor';
 import { RawBodyParser } from '../../src/ldp/http/RawBodyParser';
 import { HttpRequest } from '../../src/server/HttpRequest';
-import { DATA_TYPE_BINARY } from '../../src/util/ContentTypes';
 
 describe('A SimpleRequestParser with simple input parsers', (): void => {
   const targetExtractor = new BasicTargetExtractor();
@@ -35,7 +34,7 @@ describe('A SimpleRequestParser with simple input parsers', (): void => {
       },
       body: {
         data: expect.any(Readable),
-        dataType: DATA_TYPE_BINARY,
+        binary: true,
         metadata: {
           contentType: 'text/turtle',
           raw: [],
diff --git a/test/unit/ldp/http/BasicResponseWriter.test.ts b/test/unit/ldp/http/BasicResponseWriter.test.ts
index e6c63f79c..eb92b66d5 100644
--- a/test/unit/ldp/http/BasicResponseWriter.test.ts
+++ b/test/unit/ldp/http/BasicResponseWriter.test.ts
@@ -4,7 +4,6 @@ import { Quad } from 'rdf-js';
 import streamifyArray from 'streamify-array';
 import { BasicResponseWriter } from '../../../../src/ldp/http/BasicResponseWriter';
 import { ResponseDescription } from '../../../../src/ldp/operations/ResponseDescription';
-import { DATA_TYPE_BINARY, DATA_TYPE_QUAD } from '../../../../src/util/ContentTypes';
 import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
 
 describe('A BasicResponseWriter', (): void => {
@@ -16,9 +15,9 @@ describe('A BasicResponseWriter', (): void => {
   });
 
   it('requires the description body to be a string or binary stream if present.', async(): Promise<void> => {
-    await expect(writer.canHandle({ response, result: { body: { dataType: DATA_TYPE_QUAD }} as ResponseDescription }))
+    await expect(writer.canHandle({ response, result: { body: { binary: false }} as ResponseDescription }))
       .rejects.toThrow(UnsupportedHttpError);
-    await expect(writer.canHandle({ response, result: { body: { dataType: DATA_TYPE_BINARY }} as ResponseDescription }))
+    await expect(writer.canHandle({ response, result: { body: { binary: true }} as ResponseDescription }))
       .resolves.toBeUndefined();
   });
 
@@ -31,8 +30,8 @@ describe('A BasicResponseWriter', (): void => {
 
   it('responds with a body if the description has a body.', async(done): Promise<void> => {
     const body = {
+      binary: true,
       data: streamifyArray([ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ]),
-      dataType: DATA_TYPE_BINARY,
       metadata: {
         raw: [] as Quad[],
         profiles: [] as string[],
@@ -52,8 +51,8 @@ describe('A BasicResponseWriter', (): void => {
 
   it('responds with a content-type if the metadata has it.', async(done): Promise<void> => {
     const body = {
+      binary: true,
       data: streamifyArray([ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ]),
-      dataType: DATA_TYPE_BINARY,
       metadata: {
         raw: [] as Quad[],
         profiles: [] as string[],
diff --git a/test/unit/ldp/http/RawBodyParser.test.ts b/test/unit/ldp/http/RawBodyParser.test.ts
index 0dbaf96de..15230f927 100644
--- a/test/unit/ldp/http/RawBodyParser.test.ts
+++ b/test/unit/ldp/http/RawBodyParser.test.ts
@@ -2,7 +2,6 @@ import arrayifyStream from 'arrayify-stream';
 import streamifyArray from 'streamify-array';
 import { RawBodyParser } from '../../../../src/ldp/http/RawBodyParser';
 import { HttpRequest } from '../../../../src/server/HttpRequest';
-import { DATA_TYPE_BINARY } from '../../../../src/util/ContentTypes';
 import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
 import 'jest-rdf';
 
@@ -22,8 +21,8 @@ describe('A RawBodyparser', (): void => {
     input.headers = { 'content-type': 'text/turtle' };
     const result = (await bodyParser.handle(input))!;
     expect(result).toEqual({
+      binary: true,
       data: input,
-      dataType: DATA_TYPE_BINARY,
       metadata: {
         contentType: 'text/turtle',
         raw: [],
diff --git a/test/unit/ldp/http/SparqlUpdateBodyParser.test.ts b/test/unit/ldp/http/SparqlUpdateBodyParser.test.ts
index b4aac5534..ffee298f1 100644
--- a/test/unit/ldp/http/SparqlUpdateBodyParser.test.ts
+++ b/test/unit/ldp/http/SparqlUpdateBodyParser.test.ts
@@ -4,7 +4,6 @@ import { Algebra } from 'sparqlalgebrajs';
 import streamifyArray from 'streamify-array';
 import { SparqlUpdateBodyParser } from '../../../../src/ldp/http/SparqlUpdateBodyParser';
 import { HttpRequest } from '../../../../src/server/HttpRequest';
-import { DATA_TYPE_BINARY } from '../../../../src/util/ContentTypes';
 import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
 import { UnsupportedMediaTypeHttpError } from '../../../../src/util/errors/UnsupportedMediaTypeHttpError';
 
@@ -34,7 +33,7 @@ describe('A SparqlUpdateBodyParser', (): void => {
       namedNode('http://test.com/p'),
       namedNode('http://test.com/o'),
     ) ]);
-    expect(result.dataType).toBe(DATA_TYPE_BINARY);
+    expect(result.binary).toBe(true);
     expect(result.metadata).toEqual({
       raw: [],
       profiles: [],
diff --git a/test/unit/ldp/operations/GetOperationHandler.test.ts b/test/unit/ldp/operations/GetOperationHandler.test.ts
index 3262b8fef..7c61af141 100644
--- a/test/unit/ldp/operations/GetOperationHandler.test.ts
+++ b/test/unit/ldp/operations/GetOperationHandler.test.ts
@@ -2,12 +2,11 @@ import { GetOperationHandler } from '../../../../src/ldp/operations/GetOperation
 import { Operation } from '../../../../src/ldp/operations/Operation';
 import { Representation } from '../../../../src/ldp/representation/Representation';
 import { ResourceStore } from '../../../../src/storage/ResourceStore';
-import { DATA_TYPE_QUAD } from '../../../../src/util/ContentTypes';
 import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
 
 describe('A GetOperationHandler', (): void => {
   const store = {
-    getRepresentation: async(): Promise<Representation> => ({ dataType: DATA_TYPE_QUAD } as Representation),
+    getRepresentation: async(): Promise<Representation> => ({ binary: false } as Representation),
   } as unknown as ResourceStore;
   const handler = new GetOperationHandler(store);
 
@@ -18,7 +17,7 @@ describe('A GetOperationHandler', (): void => {
 
   it('returns the representation from the store with the input identifier.', async(): Promise<void> => {
     await expect(handler.handle({ target: { path: 'url' }} as Operation)).resolves.toEqual(
-      { identifier: { path: 'url' }, body: { dataType: DATA_TYPE_QUAD }},
+      { identifier: { path: 'url' }, body: { binary: false }},
     );
   });
 });
diff --git a/test/unit/ldp/operations/PatchOperationHandler.test.ts b/test/unit/ldp/operations/PatchOperationHandler.test.ts
index abc75d19d..f28a87688 100644
--- a/test/unit/ldp/operations/PatchOperationHandler.test.ts
+++ b/test/unit/ldp/operations/PatchOperationHandler.test.ts
@@ -16,9 +16,9 @@ describe('A PatchOperationHandler', (): void => {
   });
 
   it('deletes the resource from the store and returns its identifier.', async(): Promise<void> => {
-    await expect(handler.handle({ target: { path: 'url' }, body: { dataType: 'patch' }} as Operation))
+    await expect(handler.handle({ target: { path: 'url' }, body: { binary: false }} as Operation))
       .resolves.toEqual({ identifier: { path: 'url' }});
     expect(store.modifyResource).toHaveBeenCalledTimes(1);
-    expect(store.modifyResource).toHaveBeenLastCalledWith({ path: 'url' }, { dataType: 'patch' });
+    expect(store.modifyResource).toHaveBeenLastCalledWith({ path: 'url' }, { binary: false });
   });
 });
diff --git a/test/unit/ldp/operations/PostOperationHandler.test.ts b/test/unit/ldp/operations/PostOperationHandler.test.ts
index 07b03dfc3..58b0912b0 100644
--- a/test/unit/ldp/operations/PostOperationHandler.test.ts
+++ b/test/unit/ldp/operations/PostOperationHandler.test.ts
@@ -11,15 +11,15 @@ describe('A PostOperationHandler', (): void => {
   const handler = new PostOperationHandler(store);
 
   it('only supports POST operations with a body.', async(): Promise<void> => {
-    await expect(handler.canHandle({ method: 'POST', body: { dataType: 'test' }} as Operation))
+    await expect(handler.canHandle({ method: 'POST', body: { }} as Operation))
       .resolves.toBeUndefined();
-    await expect(handler.canHandle({ method: 'GET', body: { dataType: 'test' }} as Operation))
+    await expect(handler.canHandle({ method: 'GET', body: { }} as Operation))
       .rejects.toThrow(UnsupportedHttpError);
     await expect(handler.canHandle({ method: 'POST' } as Operation)).rejects.toThrow(UnsupportedHttpError);
   });
 
   it('adds the given representation to the store and returns the new identifier.', async(): Promise<void> => {
-    await expect(handler.handle({ method: 'POST', body: { dataType: 'test' }} as Operation))
+    await expect(handler.handle({ method: 'POST', body: { }} as Operation))
       .resolves.toEqual({ identifier: { path: 'newPath' }});
   });
 });
diff --git a/test/unit/ldp/operations/PutOperationHandler.test.ts b/test/unit/ldp/operations/PutOperationHandler.test.ts
index 6f9abea01..b594e93cf 100644
--- a/test/unit/ldp/operations/PutOperationHandler.test.ts
+++ b/test/unit/ldp/operations/PutOperationHandler.test.ts
@@ -17,10 +17,10 @@ describe('A PutOperationHandler', (): void => {
   });
 
   it('sets the representation in the store and returns its identifier.', async(): Promise<void> => {
-    await expect(handler.handle({ target: { path: 'url' }, body: { dataType: 'test' }} as Operation))
+    await expect(handler.handle({ target: { path: 'url' }, body: {}} as Operation))
       .resolves.toEqual({ identifier: { path: 'url' }});
     expect(store.setRepresentation).toHaveBeenCalledTimes(1);
-    expect(store.setRepresentation).toHaveBeenLastCalledWith({ path: 'url' }, { dataType: 'test' });
+    expect(store.setRepresentation).toHaveBeenLastCalledWith({ path: 'url' }, {});
   });
 
   it('errors when there is no body.', async(): Promise<void> => {
diff --git a/test/unit/storage/FileResourceStore.test.ts b/test/unit/storage/FileResourceStore.test.ts
index 41adab8e8..08590ca45 100644
--- a/test/unit/storage/FileResourceStore.test.ts
+++ b/test/unit/storage/FileResourceStore.test.ts
@@ -6,10 +6,10 @@ import arrayifyStream from 'arrayify-stream';
 import { DataFactory } from 'n3';
 import streamifyArray from 'streamify-array';
 import { RuntimeConfig } from '../../../src/init/RuntimeConfig';
-import { BinaryRepresentation } from '../../../src/ldp/representation/BinaryRepresentation';
+import { Representation } from '../../../src/ldp/representation/Representation';
 import { RepresentationMetadata } from '../../../src/ldp/representation/RepresentationMetadata';
 import { FileResourceStore } from '../../../src/storage/FileResourceStore';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_BINARY, DATA_TYPE_QUAD } from '../../../src/util/ContentTypes';
+import { INTERNAL_QUADS } from '../../../src/util/ContentTypes';
 import { ConflictHttpError } from '../../../src/util/errors/ConflictHttpError';
 import { MethodNotAllowedHttpError } from '../../../src/util/errors/MethodNotAllowedHttpError';
 import { NotFoundHttpError } from '../../../src/util/errors/NotFoundHttpError';
@@ -33,7 +33,7 @@ fsPromises.access = jest.fn();
 
 describe('A FileResourceStore', (): void => {
   let store: FileResourceStore;
-  let representation: BinaryRepresentation;
+  let representation: Representation;
   let readableMock: Readable;
   let stats: Stats;
   let writeStream: WriteStream;
@@ -56,8 +56,8 @@ describe('A FileResourceStore', (): void => {
     );
 
     representation = {
+      binary: true,
       data: streamifyArray([ rawData ]),
-      dataType: DATA_TYPE_BINARY,
       metadata: { raw: [], linkRel: { type: new Set() }} as RepresentationMetadata,
     };
 
@@ -116,7 +116,7 @@ describe('A FileResourceStore', (): void => {
   });
 
   it('errors for wrong input data types.', async(): Promise<void> => {
-    (representation as any).dataType = DATA_TYPE_QUAD;
+    (representation as any).binary = false;
     await expect(store.addResource({ path: base }, representation)).rejects.toThrow(UnsupportedMediaTypeHttpError);
     await expect(store.setRepresentation({ path: `${base}foo` }, representation)).rejects
       .toThrow(UnsupportedMediaTypeHttpError);
@@ -142,12 +142,12 @@ describe('A FileResourceStore', (): void => {
     // Read container
     const result = await store.getRepresentation(identifier);
     expect(result).toEqual({
-      dataType: DATA_TYPE_QUAD,
+      binary: false,
       data: expect.any(Readable),
       metadata: {
         raw: [],
         dateTime: stats.mtime,
-        contentType: CONTENT_TYPE_QUADS,
+        contentType: INTERNAL_QUADS,
       },
     });
     await expect(arrayifyStream(result.data)).resolves.toBeDefined();
@@ -212,7 +212,7 @@ describe('A FileResourceStore', (): void => {
     expect(fs.createWriteStream as jest.Mock).toBeCalledWith(joinPath(rootFilepath, 'file.txt'));
     const result = await store.getRepresentation({ path: `${base}file.txt` });
     expect(result).toEqual({
-      dataType: DATA_TYPE_BINARY,
+      binary: true,
       data: expect.any(Readable),
       metadata: {
         raw: [],
@@ -365,12 +365,12 @@ describe('A FileResourceStore', (): void => {
     ];
     const result = await store.getRepresentation({ path: `${base}foo/` });
     expect(result).toEqual({
-      dataType: DATA_TYPE_QUAD,
+      binary: false,
       data: expect.any(Readable),
       metadata: {
         raw: [],
         dateTime: stats.mtime,
-        contentType: CONTENT_TYPE_QUADS,
+        contentType: INTERNAL_QUADS,
       },
     });
     await expect(arrayifyStream(result.data)).resolves.toEqualRdfQuadArray(quads);
@@ -492,7 +492,7 @@ describe('A FileResourceStore', (): void => {
 
     const result = await store.getRepresentation({ path: `${base}.htaccess` });
     expect(result).toEqual({
-      dataType: DATA_TYPE_BINARY,
+      binary: true,
       data: expect.any(Readable),
       metadata: {
         raw: [],
diff --git a/test/unit/storage/InMemoryResourceStore.test.ts b/test/unit/storage/InMemoryResourceStore.test.ts
index f76b29d15..8e8d26e30 100644
--- a/test/unit/storage/InMemoryResourceStore.test.ts
+++ b/test/unit/storage/InMemoryResourceStore.test.ts
@@ -2,25 +2,24 @@ import { Readable } from 'stream';
 import arrayifyStream from 'arrayify-stream';
 import streamifyArray from 'streamify-array';
 import { RuntimeConfig } from '../../../src/init/RuntimeConfig';
-import { BinaryRepresentation } from '../../../src/ldp/representation/BinaryRepresentation';
+import { Representation } from '../../../src/ldp/representation/Representation';
 import { RepresentationMetadata } from '../../../src/ldp/representation/RepresentationMetadata';
 import { InMemoryResourceStore } from '../../../src/storage/InMemoryResourceStore';
-import { DATA_TYPE_BINARY } from '../../../src/util/ContentTypes';
 import { NotFoundHttpError } from '../../../src/util/errors/NotFoundHttpError';
 
 const base = 'http://test.com/';
 
 describe('A InMemoryResourceStore', (): void => {
   let store: InMemoryResourceStore;
-  let representation: BinaryRepresentation;
+  let representation: Representation;
   const dataString = '<http://test.com/s> <http://test.com/p> <http://test.com/o>.';
 
   beforeEach(async(): Promise<void> => {
     store = new InMemoryResourceStore(new RuntimeConfig({ base }));
 
     representation = {
+      binary: true,
       data: streamifyArray([ dataString ]),
-      dataType: DATA_TYPE_BINARY,
       metadata: {} as RepresentationMetadata,
     };
   });
@@ -43,7 +42,7 @@ describe('A InMemoryResourceStore', (): void => {
     expect(identifier.path.startsWith(base)).toBeTruthy();
     const result = await store.getRepresentation(identifier);
     expect(result).toEqual({
-      dataType: representation.dataType,
+      binary: true,
       data: expect.any(Readable),
       metadata: representation.metadata,
     });
@@ -61,7 +60,7 @@ describe('A InMemoryResourceStore', (): void => {
     await store.setRepresentation({ path: base }, representation);
     const result = await store.getRepresentation({ path: base });
     expect(result).toEqual({
-      dataType: representation.dataType,
+      binary: true,
       data: expect.any(Readable),
       metadata: representation.metadata,
     });
diff --git a/test/unit/storage/conversion/QuadToRdfConverter.test.ts b/test/unit/storage/conversion/QuadToRdfConverter.test.ts
index 2d44f9bc6..987832c94 100644
--- a/test/unit/storage/conversion/QuadToRdfConverter.test.ts
+++ b/test/unit/storage/conversion/QuadToRdfConverter.test.ts
@@ -6,14 +6,14 @@ import { Representation } from '../../../../src/ldp/representation/Representatio
 import { RepresentationPreferences } from '../../../../src/ldp/representation/RepresentationPreferences';
 import { ResourceIdentifier } from '../../../../src/ldp/representation/ResourceIdentifier';
 import { QuadToRdfConverter } from '../../../../src/storage/conversion/QuadToRdfConverter';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_BINARY } from '../../../../src/util/ContentTypes';
+import { INTERNAL_QUADS } from '../../../../src/util/ContentTypes';
 
 describe('A QuadToRdfConverter', (): void => {
   const converter = new QuadToRdfConverter();
   const identifier: ResourceIdentifier = { path: 'path' };
 
   it('supports parsing quads.', async(): Promise<void> => {
-    await expect(converter.getInputTypes()).resolves.toEqual({ [CONTENT_TYPE_QUADS]: 1 });
+    await expect(converter.getInputTypes()).resolves.toEqual({ [INTERNAL_QUADS]: 1 });
   });
 
   it('supports serializing as the same types as rdfSerializer.', async(): Promise<void> => {
@@ -21,13 +21,13 @@ describe('A QuadToRdfConverter', (): void => {
   });
 
   it('can handle quad to turtle conversions.', async(): Promise<void> => {
-    const representation = { metadata: { contentType: CONTENT_TYPE_QUADS }} as Representation;
+    const representation = { metadata: { contentType: INTERNAL_QUADS }} as Representation;
     const preferences: RepresentationPreferences = { type: [{ value: 'text/turtle', weight: 1 }]};
     await expect(converter.canHandle({ identifier, representation, preferences })).resolves.toBeUndefined();
   });
 
   it('can handle quad to JSON-LD conversions.', async(): Promise<void> => {
-    const representation = { metadata: { contentType: CONTENT_TYPE_QUADS }} as Representation;
+    const representation = { metadata: { contentType: INTERNAL_QUADS }} as Representation;
     const preferences: RepresentationPreferences = { type: [{ value: 'application/ld+json', weight: 1 }]};
     await expect(converter.canHandle({ identifier, representation, preferences })).resolves.toBeUndefined();
   });
@@ -39,12 +39,12 @@ describe('A QuadToRdfConverter', (): void => {
         namedNode('http://test.com/p'),
         namedNode('http://test.com/o'),
       ) ]),
-      metadata: { contentType: CONTENT_TYPE_QUADS },
+      metadata: { contentType: INTERNAL_QUADS },
     } as Representation;
     const preferences: RepresentationPreferences = { type: [{ value: 'text/turtle', weight: 1 }]};
     const result = await converter.handle({ identifier, representation, preferences });
     expect(result).toMatchObject({
-      dataType: DATA_TYPE_BINARY,
+      binary: true,
       metadata: {
         contentType: 'text/turtle',
       },
@@ -62,12 +62,12 @@ describe('A QuadToRdfConverter', (): void => {
         namedNode('http://test.com/p'),
         namedNode('http://test.com/o'),
       ) ]),
-      metadata: { contentType: CONTENT_TYPE_QUADS },
+      metadata: { contentType: INTERNAL_QUADS },
     } as Representation;
     const preferences: RepresentationPreferences = { type: [{ value: 'application/ld+json', weight: 1 }]};
     const result = await converter.handle({ identifier, representation, preferences });
     expect(result).toMatchObject({
-      dataType: DATA_TYPE_BINARY,
+      binary: true,
       metadata: {
         contentType: 'application/ld+json',
       },
diff --git a/test/unit/storage/conversion/QuadToTurtleConverter.test.ts b/test/unit/storage/conversion/QuadToTurtleConverter.test.ts
index 3d4da12a6..218f4bdda 100644
--- a/test/unit/storage/conversion/QuadToTurtleConverter.test.ts
+++ b/test/unit/storage/conversion/QuadToTurtleConverter.test.ts
@@ -5,14 +5,14 @@ import { Representation } from '../../../../src/ldp/representation/Representatio
 import { RepresentationPreferences } from '../../../../src/ldp/representation/RepresentationPreferences';
 import { ResourceIdentifier } from '../../../../src/ldp/representation/ResourceIdentifier';
 import { QuadToTurtleConverter } from '../../../../src/storage/conversion/QuadToTurtleConverter';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_BINARY } from '../../../../src/util/ContentTypes';
+import { INTERNAL_QUADS } from '../../../../src/util/ContentTypes';
 
 describe('A QuadToTurtleConverter', (): void => {
   const converter = new QuadToTurtleConverter();
   const identifier: ResourceIdentifier = { path: 'path' };
 
   it('can handle quad to turtle conversions.', async(): Promise<void> => {
-    const representation = { metadata: { contentType: CONTENT_TYPE_QUADS }} as Representation;
+    const representation = { metadata: { contentType: INTERNAL_QUADS }} as Representation;
     const preferences: RepresentationPreferences = { type: [{ value: 'text/turtle', weight: 1 }]};
     await expect(converter.canHandle({ identifier, representation, preferences })).resolves.toBeUndefined();
   });
@@ -24,12 +24,12 @@ describe('A QuadToTurtleConverter', (): void => {
         namedNode('http://test.com/p'),
         namedNode('http://test.com/o'),
       ) ]),
-      metadata: { contentType: CONTENT_TYPE_QUADS },
+      metadata: { contentType: INTERNAL_QUADS },
     } as Representation;
     const preferences: RepresentationPreferences = { type: [{ value: 'text/turtle', weight: 1 }]};
     const result = await converter.handle({ identifier, representation, preferences });
     expect(result).toMatchObject({
-      dataType: DATA_TYPE_BINARY,
+      binary: true,
       metadata: {
         contentType: 'text/turtle',
       },
diff --git a/test/unit/storage/conversion/RdfToQuadConverter.test.ts b/test/unit/storage/conversion/RdfToQuadConverter.test.ts
index 18ae8ed39..08158c397 100644
--- a/test/unit/storage/conversion/RdfToQuadConverter.test.ts
+++ b/test/unit/storage/conversion/RdfToQuadConverter.test.ts
@@ -7,7 +7,7 @@ import { Representation } from '../../../../src/ldp/representation/Representatio
 import { RepresentationPreferences } from '../../../../src/ldp/representation/RepresentationPreferences';
 import { ResourceIdentifier } from '../../../../src/ldp/representation/ResourceIdentifier';
 import { RdfToQuadConverter } from '../../../../src/storage/conversion/RdfToQuadConverter';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_QUAD } from '../../../../src/util/ContentTypes';
+import { INTERNAL_QUADS } from '../../../../src/util/ContentTypes';
 import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
 
 describe('A RdfToQuadConverter.test.ts', (): void => {
@@ -19,18 +19,18 @@ describe('A RdfToQuadConverter.test.ts', (): void => {
   });
 
   it('supports serializing as quads.', async(): Promise<void> => {
-    await expect(converter.getOutputTypes()).resolves.toEqual({ [CONTENT_TYPE_QUADS]: 1 });
+    await expect(converter.getOutputTypes()).resolves.toEqual({ [INTERNAL_QUADS]: 1 });
   });
 
   it('can handle turtle to quad conversions.', async(): Promise<void> => {
     const representation = { metadata: { contentType: 'text/turtle' }} as Representation;
-    const preferences: RepresentationPreferences = { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]};
+    const preferences: RepresentationPreferences = { type: [{ value: INTERNAL_QUADS, weight: 1 }]};
     await expect(converter.canHandle({ identifier, representation, preferences })).resolves.toBeUndefined();
   });
 
   it('can handle JSON-LD to quad conversions.', async(): Promise<void> => {
     const representation = { metadata: { contentType: 'application/ld+json' }} as Representation;
-    const preferences: RepresentationPreferences = { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]};
+    const preferences: RepresentationPreferences = { type: [{ value: INTERNAL_QUADS, weight: 1 }]};
     await expect(converter.canHandle({ identifier, representation, preferences })).resolves.toBeUndefined();
   });
 
@@ -39,13 +39,13 @@ describe('A RdfToQuadConverter.test.ts', (): void => {
       data: streamifyArray([ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ]),
       metadata: { contentType: 'text/turtle' },
     } as Representation;
-    const preferences: RepresentationPreferences = { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]};
+    const preferences: RepresentationPreferences = { type: [{ value: INTERNAL_QUADS, weight: 1 }]};
     const result = await converter.handle({ identifier, representation, preferences });
     expect(result).toEqual({
+      binary: false,
       data: expect.any(Readable),
-      dataType: DATA_TYPE_QUAD,
       metadata: {
-        contentType: CONTENT_TYPE_QUADS,
+        contentType: INTERNAL_QUADS,
       },
     });
     await expect(arrayifyStream(result.data)).resolves.toEqualRdfQuadArray([ triple(
@@ -60,13 +60,13 @@ describe('A RdfToQuadConverter.test.ts', (): void => {
       data: streamifyArray([ '{"@id": "http://test.com/s", "http://test.com/p": { "@id": "http://test.com/o" }}' ]),
       metadata: { contentType: 'application/ld+json' },
     } as Representation;
-    const preferences: RepresentationPreferences = { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]};
+    const preferences: RepresentationPreferences = { type: [{ value: INTERNAL_QUADS, weight: 1 }]};
     const result = await converter.handle({ identifier, representation, preferences });
     expect(result).toEqual({
+      binary: false,
       data: expect.any(Readable),
-      dataType: DATA_TYPE_QUAD,
       metadata: {
-        contentType: CONTENT_TYPE_QUADS,
+        contentType: INTERNAL_QUADS,
       },
     });
     await expect(arrayifyStream(result.data)).resolves.toEqualRdfQuadArray([ triple(
@@ -81,13 +81,13 @@ describe('A RdfToQuadConverter.test.ts', (): void => {
       data: streamifyArray([ '<http://test.com/s> <http://test.com/p> <http://test.co' ]),
       metadata: { contentType: 'text/turtle' },
     } as Representation;
-    const preferences: RepresentationPreferences = { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]};
+    const preferences: RepresentationPreferences = { type: [{ value: INTERNAL_QUADS, weight: 1 }]};
     const result = await converter.handle({ identifier, representation, preferences });
     expect(result).toEqual({
+      binary: false,
       data: expect.any(Readable),
-      dataType: DATA_TYPE_QUAD,
       metadata: {
-        contentType: CONTENT_TYPE_QUADS,
+        contentType: INTERNAL_QUADS,
       },
     });
     await expect(arrayifyStream(result.data)).rejects.toThrow(UnsupportedHttpError);
diff --git a/test/unit/storage/conversion/TurtleToQuadConverter.test.ts b/test/unit/storage/conversion/TurtleToQuadConverter.test.ts
index 82c26b288..f3042d9fc 100644
--- a/test/unit/storage/conversion/TurtleToQuadConverter.test.ts
+++ b/test/unit/storage/conversion/TurtleToQuadConverter.test.ts
@@ -6,7 +6,7 @@ import { Representation } from '../../../../src/ldp/representation/Representatio
 import { RepresentationPreferences } from '../../../../src/ldp/representation/RepresentationPreferences';
 import { ResourceIdentifier } from '../../../../src/ldp/representation/ResourceIdentifier';
 import { TurtleToQuadConverter } from '../../../../src/storage/conversion/TurtleToQuadConverter';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_QUAD } from '../../../../src/util/ContentTypes';
+import { INTERNAL_QUADS } from '../../../../src/util/ContentTypes';
 import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
 
 describe('A TurtleToQuadConverter', (): void => {
@@ -15,7 +15,7 @@ describe('A TurtleToQuadConverter', (): void => {
 
   it('can handle turtle to quad conversions.', async(): Promise<void> => {
     const representation = { metadata: { contentType: 'text/turtle' }} as Representation;
-    const preferences: RepresentationPreferences = { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]};
+    const preferences: RepresentationPreferences = { type: [{ value: INTERNAL_QUADS, weight: 1 }]};
     await expect(converter.canHandle({ identifier, representation, preferences })).resolves.toBeUndefined();
   });
 
@@ -24,13 +24,13 @@ describe('A TurtleToQuadConverter', (): void => {
       data: streamifyArray([ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ]),
       metadata: { contentType: 'text/turtle' },
     } as Representation;
-    const preferences: RepresentationPreferences = { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]};
+    const preferences: RepresentationPreferences = { type: [{ value: INTERNAL_QUADS, weight: 1 }]};
     const result = await converter.handle({ identifier, representation, preferences });
     expect(result).toEqual({
+      binary: false,
       data: expect.any(Readable),
-      dataType: DATA_TYPE_QUAD,
       metadata: {
-        contentType: CONTENT_TYPE_QUADS,
+        contentType: INTERNAL_QUADS,
       },
     });
     await expect(arrayifyStream(result.data)).resolves.toEqualRdfQuadArray([ triple(
@@ -45,13 +45,13 @@ describe('A TurtleToQuadConverter', (): void => {
       data: streamifyArray([ '<http://test.com/s> <http://test.com/p> <http://test.co' ]),
       metadata: { contentType: 'text/turtle' },
     } as Representation;
-    const preferences: RepresentationPreferences = { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]};
+    const preferences: RepresentationPreferences = { type: [{ value: INTERNAL_QUADS, weight: 1 }]};
     const result = await converter.handle({ identifier, representation, preferences });
     expect(result).toEqual({
+      binary: false,
       data: expect.any(Readable),
-      dataType: DATA_TYPE_QUAD,
       metadata: {
-        contentType: CONTENT_TYPE_QUADS,
+        contentType: INTERNAL_QUADS,
       },
     });
     await expect(arrayifyStream(result.data)).rejects.toThrow(UnsupportedHttpError);
diff --git a/test/unit/storage/patch/SparqlUpdatePatchHandler.test.ts b/test/unit/storage/patch/SparqlUpdatePatchHandler.test.ts
index 6a069c3f2..c1d8de56f 100644
--- a/test/unit/storage/patch/SparqlUpdatePatchHandler.test.ts
+++ b/test/unit/storage/patch/SparqlUpdatePatchHandler.test.ts
@@ -8,7 +8,7 @@ import { Lock } from '../../../../src/storage/Lock';
 import { SparqlUpdatePatchHandler } from '../../../../src/storage/patch/SparqlUpdatePatchHandler';
 import { ResourceLocker } from '../../../../src/storage/ResourceLocker';
 import { ResourceStore } from '../../../../src/storage/ResourceStore';
-import { CONTENT_TYPE_QUADS, DATA_TYPE_QUAD } from '../../../../src/util/ContentTypes';
+import { INTERNAL_QUADS } from '../../../../src/util/ContentTypes';
 import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
 
 describe('A SparqlUpdatePatchHandler', (): void => {
@@ -65,15 +65,15 @@ describe('A SparqlUpdatePatchHandler', (): void => {
   const basicChecks = async(quads: Quad[]): Promise<void> => {
     expect(source.getRepresentation).toHaveBeenCalledTimes(1);
     expect(source.getRepresentation).toHaveBeenLastCalledWith(
-      { path: 'path' }, { type: [{ value: CONTENT_TYPE_QUADS, weight: 1 }]},
+      { path: 'path' }, { type: [{ value: INTERNAL_QUADS, weight: 1 }]},
     );
     expect(source.setRepresentation).toHaveBeenCalledTimes(1);
     expect(order).toEqual([ 'acquire', 'getRepresentation', 'setRepresentation', 'release' ]);
     const setParams = (source.setRepresentation as jest.Mock).mock.calls[0];
     expect(setParams[0]).toEqual({ path: 'path' });
     expect(setParams[1]).toEqual(expect.objectContaining({
-      dataType: DATA_TYPE_QUAD,
-      metadata: { raw: [], profiles: [], contentType: CONTENT_TYPE_QUADS },
+      binary: false,
+      metadata: { raw: [], profiles: [], contentType: INTERNAL_QUADS },
     }));
     await expect(arrayifyStream(setParams[1].data)).resolves.toBeRdfIsomorphic(quads);
   };