diff --git a/packages/dataset-registry-client/src/schema.ts b/packages/dataset-registry-client/src/schema.ts index 2c95a6d5..1a153916 100644 --- a/packages/dataset-registry-client/src/schema.ts +++ b/packages/dataset-registry-client/src/schema.ts @@ -1,4 +1,4 @@ -import { dcterms, foaf, xsd } from 'ldkit/namespaces'; +import { dcterms, foaf, ldkit, xsd } from 'ldkit/namespaces'; import { dcat } from './dcat.js'; export const DatasetSchema = { @@ -19,6 +19,7 @@ export const DatasetSchema = { }, license: { '@id': dcterms.license, + '@type': ldkit.IRI, '@optional': true, }, creator: { @@ -47,9 +48,13 @@ export const DatasetSchema = { '@array': true, '@schema': { '@type': dcat.Distribution, - accessURL: dcat.accessURL, + accessURL: { + '@id': dcat.accessURL, + '@type': ldkit.IRI, + }, mediaType: { '@id': dcat.mediaType, + '@type': ldkit.IRI, '@optional': true, }, byteSize: { @@ -59,10 +64,12 @@ export const DatasetSchema = { }, compressFormat: { '@id': dcat.compressFormat, + '@type': ldkit.IRI, '@optional': true, }, conformsTo: { '@id': dcterms.conformsTo, + '@type': ldkit.IRI, '@optional': true, }, modified: { diff --git a/packages/dataset-registry-client/test/client.test.ts b/packages/dataset-registry-client/test/client.test.ts index 5bdc3d83..29e34e4e 100644 --- a/packages/dataset-registry-client/test/client.test.ts +++ b/packages/dataset-registry-client/test/client.test.ts @@ -100,6 +100,26 @@ describe('Client', () => { expect(count).toEqual(1); }); + it('reads back a distribution that declares no media type', async () => { + // Only reachable without media-type criteria: those narrow a dataset’s + // distributions to the matching ones, so a filtered query never returns + // this distribution. + const results = await client.query({ + $id: 'http://bar.org/id/dataset/bar', + }); + + const mediaTypes = []; + for await (const dataset of results) { + mediaTypes.push( + ...dataset.distributions.map( + (distribution) => distribution.mediaType, + ), + ); + } + + expect(mediaTypes).toContain(undefined); + }); + it('throws an error for non-CONSTRUCT queries', async () => { const query = ` PREFIX dcat: