From 7876d6813339b919cfaf54777b291734b99bdd87 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Fri, 31 May 2024 14:46:04 +0200 Subject: [PATCH] fix: Publisher not stored if type other than creator (#910) --- src/query.ts | 3 +-- test/datasets/dataset-schema-org-valid.jsonld | 2 +- test/fetch.test.ts | 10 ++++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/query.ts b/src/query.ts index de0748ff..af32fab0 100644 --- a/src/query.ts +++ b/src/query.ts @@ -266,12 +266,12 @@ function schemaOrgQuery(prefix: string): string { FILTER (!isBlank(?${license})) + VALUES ?organizationOrPerson { ${prefix}:Organization ${prefix}:Person } OPTIONAL { ?${dataset} ${prefix}:creator ?${creator} . ?${creator} a ?organizationOrPerson ; a ?creatorType ; ${prefix}:name ?${creatorName} . - VALUES ?organizationOrPerson { ${prefix}:Organization ${prefix}:Person } } OPTIONAL { @@ -279,7 +279,6 @@ function schemaOrgQuery(prefix: string): string { ?${publisher} a ?organizationOrPerson ; a ?publisherType ; ${prefix}:name ?${publisherName} . - VALUES ?organizationOrPerson { ${prefix}:Organization ${prefix}:Person } OPTIONAL { ?${publisher} ${prefix}:contactPoint/${prefix}:email ?${publisherEmail} . } diff --git a/test/datasets/dataset-schema-org-valid.jsonld b/test/datasets/dataset-schema-org-valid.jsonld index 16ed0e5b..eb1a69ab 100644 --- a/test/datasets/dataset-schema-org-valid.jsonld +++ b/test/datasets/dataset-schema-org-valid.jsonld @@ -37,7 +37,7 @@ "name": "Creator 1" }, { - "@type": "Organization", + "@type": "Person", "@id": "https://example.com/creator2", "name": "Creator 2" } diff --git a/test/fetch.test.ts b/test/fetch.test.ts index b90d22bc..c609ecae 100644 --- a/test/fetch.test.ts +++ b/test/fetch.test.ts @@ -168,6 +168,16 @@ describe('Fetch', () => { ) ) ).toBe(true); + expect( + dataset.has( + factory.quad( + factory.namedNode('https://example.com/creator2'), + rdf('type'), + foaf('Person'), + factory.namedNode('http://data.bibliotheken.nl/id/dataset/rise-alba') + ) + ) + ).toBe(true); expect([ ...dataset.match( factory.namedNode('http://data.bibliotheken.nl/id/dataset/rise-alba'),