Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Store publisher e-mail #824

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions shacl/register.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,29 @@ reg:OrganizationShape
reg:OrganizationNameProperty,
# TODO
# Recommended properties
reg:SchemaAlternateNameProperty ;
reg:SchemaAlternateNameProperty ,
# TODO
# reg:SchemaSameAsProperty
# reg:SchemaSameAsProperty ;
[
sh:path schema:contactPoint ;
sh:class schema:ContactPoint ;
sh:minCount 0 ;
sh:node [
a sh:NodeShape ;
sh:targetClass schema:ContactPoint ;
sh:property [
sh:path schema:name ;
sh:minCount 1;
sh:message "ContactPoint moet een naam hebben"@nl, "ContactPoint must have a name"@en ;
] ,
[
sh:path schema:email ;
sh:minCount 1;
sh:message "ContactPoint moet een e-mailadres hebben"@nl, "ContactPoint must have an e-mail address"@en ;
]
] ;
sh:message "Een organisatie kan een ContactPoint hebben"@nl, "An organization should have a ContactPoint"@en ;
]
.

reg:PersonShape
Expand Down Expand Up @@ -118,9 +138,6 @@ reg:DateTimeShape a sh:NodeShape ;
sh:severity sh:Warning ;
.

# TODO
# reg:PublisherShape

#
# Property shapes
#
Expand Down
3 changes: 3 additions & 0 deletions src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ function schemaOrgQuery(prefix: string): string {
?${publisher} a ?organizationOrPerson ;
a ?publisherType ;
${prefix}:name ?${publisherName} .
OPTIONAL {
?${publisher} ${prefix}:contactPoint/${prefix}:email ?${publisherEmail} .
}
}

VALUES ?organizationOrPerson { ${prefix}:Organization ${prefix}:Person }
Expand Down
7 changes: 6 additions & 1 deletion test/datasets/dataset-schema-org-valid.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
"@type": "Organization",
"@id": "https://example.com/publisher",
"name": "Koninklijke Bibliotheek",
"sameAs": "https://ror.org/02w4jbg70"
"sameAs": "https://ror.org/02w4jbg70",
"contactPoint": {
"@type": "ContactPoint",
"name": "Datasets Manager",
"email": "[email protected]"
}
},
"creator": [
{
Expand Down
12 changes: 11 additions & 1 deletion test/fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('Fetch', () => {

expect(datasets).toHaveLength(1);
const dataset = datasets[0];
expect(dataset.size).toBe(25);
expect(dataset.size).toBe(26);
expect(
dataset.has(
factory.quad(
Expand Down Expand Up @@ -109,6 +109,16 @@ describe('Fetch', () => {
)
)
).toBe(true);
expect(
dataset.has(
factory.quad(
factory.namedNode('https://example.com/publisher'),
foaf('mbox'),
factory.literal('[email protected]'),
factory.namedNode('http://data.bibliotheken.nl/id/dataset/rise-alba')
)
)
).toBe(true);
expect(
dataset.has(
factory.quad(
Expand Down