diff --git a/src/storage/conversion/RdfToQuadConverter.ts b/src/storage/conversion/RdfToQuadConverter.ts index 07f8f3974..f807581c1 100644 --- a/src/storage/conversion/RdfToQuadConverter.ts +++ b/src/storage/conversion/RdfToQuadConverter.ts @@ -13,7 +13,10 @@ import type { RepresentationConverterArgs } from './RepresentationConverter'; */ export class RdfToQuadConverter extends BaseTypedRepresentationConverter { public constructor() { - super(rdfParser.getContentTypes(), INTERNAL_QUADS); + const inputTypes = rdfParser.getContentTypes() + // ContentType application/json MAY NOT be converted to Quad. + .then((types): string[] => types.filter((type): boolean => type !== 'application/json')); + super(inputTypes, INTERNAL_QUADS); } public async handle({ representation, identifier }: RepresentationConverterArgs): Promise { diff --git a/test/unit/storage/conversion/RdfToQuadConverter.test.ts b/test/unit/storage/conversion/RdfToQuadConverter.test.ts index a9a4be871..99736d1b7 100644 --- a/test/unit/storage/conversion/RdfToQuadConverter.test.ts +++ b/test/unit/storage/conversion/RdfToQuadConverter.test.ts @@ -18,12 +18,17 @@ describe('A RdfToQuadConverter', (): void => { const identifier: ResourceIdentifier = { path: 'path' }; it('supports serializing as quads.', async(): Promise => { - const types = await rdfParser.getContentTypes(); - for (const type of types) { + const types = rdfParser.getContentTypes() + .then((inputTypes): string[] => inputTypes.filter((type): boolean => type !== 'application/json')); + for (const type of await types) { await expect(converter.getOutputTypes(type)).resolves.toEqual({ [INTERNAL_QUADS]: 1 }); } }); + it('may not handle application/json to quad conversion.', async(): Promise => { + await expect(converter.getOutputTypes('application/json')).resolves.toEqual({ }); + }); + it('can handle turtle to quad conversions.', async(): Promise => { const metadata = new RepresentationMetadata('text/turtle'); const representation = { metadata } as Representation;