Skip to content

Commit

Permalink
fix: Publisher not stored if type other than creator (#910)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer authored May 31, 2024
1 parent 165bb7f commit 7876d68
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,20 +266,19 @@ 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 {
?${dataset} ${prefix}:publisher ?${publisher} .
?${publisher} a ?organizationOrPerson ;
a ?publisherType ;
${prefix}:name ?${publisherName} .
VALUES ?organizationOrPerson { ${prefix}:Organization ${prefix}:Person }
OPTIONAL {
?${publisher} ${prefix}:contactPoint/${prefix}:email ?${publisherEmail} .
}
Expand Down
2 changes: 1 addition & 1 deletion test/datasets/dataset-schema-org-valid.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"name": "Creator 1"
},
{
"@type": "Organization",
"@type": "Person",
"@id": "https://example.com/creator2",
"name": "Creator 2"
}
Expand Down
10 changes: 10 additions & 0 deletions test/fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit 7876d68

Please sign in to comment.