Skip to content

Commit

Permalink
fix: Only set content-type for documents in sparql store
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimvh committed Dec 4, 2020
1 parent 35aec9c commit d7e189c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/storage/accessors/SparqlDataAccessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export class SparqlDataAccessor implements DataAccessor {
}

const metadata = new RepresentationMetadata(identifier.path).addQuads(quads);
metadata.contentType = INTERNAL_QUADS;
if (!isContainerIdentifier(identifier)) {
metadata.contentType = INTERNAL_QUADS;
}

// Need to generate type metadata for the root container since it's not stored
if (identifier.path === this.base) {
Expand Down
2 changes: 0 additions & 2 deletions test/unit/storage/accessors/SparqlDataAccessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ describe('A SparqlDataAccessor', (): void => {
metadata = await accessor.getMetadata({ path: 'http://container/' });
expect(metadata.quads()).toBeRdfIsomorphic([
quad(namedNode('this'), namedNode('a'), namedNode('triple')),
quad(namedNode('http://container/'), toNamedNode(CONTENT_TYPE), literal(INTERNAL_QUADS)),
]);

expect(fetchTriples).toHaveBeenCalledTimes(1);
Expand All @@ -123,7 +122,6 @@ describe('A SparqlDataAccessor', (): void => {
metadata = await accessor.getMetadata({ path: base });
expect(metadata.quads()).toBeRdfIsomorphic([
quad(namedNode('this'), namedNode('a'), namedNode('triple')),
quad(namedNode(base), toNamedNode(CONTENT_TYPE), literal(INTERNAL_QUADS)),
quad(namedNode(base), toNamedNode(RDF.type), toNamedNode(LDP.Container)),
quad(namedNode(base), toNamedNode(RDF.type), toNamedNode(LDP.BasicContainer)),
quad(namedNode(base), toNamedNode(RDF.type), toNamedNode(LDP.Resource)),
Expand Down

0 comments on commit d7e189c

Please sign in to comment.