diff --git a/shacl/register.ttl b/shacl/register.ttl index 7aa5ac64..74217dbc 100644 --- a/shacl/register.ttl +++ b/shacl/register.ttl @@ -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 @@ -118,9 +138,6 @@ reg:DateTimeShape a sh:NodeShape ; sh:severity sh:Warning ; . -# TODO -# reg:PublisherShape - # # Property shapes # diff --git a/src/query.ts b/src/query.ts index 5a9e0c00..e2981e79 100644 --- a/src/query.ts +++ b/src/query.ts @@ -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 } diff --git a/test/datasets/dataset-schema-org-valid.jsonld b/test/datasets/dataset-schema-org-valid.jsonld index eb571d2b..16ed0e5b 100644 --- a/test/datasets/dataset-schema-org-valid.jsonld +++ b/test/datasets/dataset-schema-org-valid.jsonld @@ -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": "datasets@example.com" + } }, "creator": [ { diff --git a/test/fetch.test.ts b/test/fetch.test.ts index 197c19b5..d18c541e 100644 --- a/test/fetch.test.ts +++ b/test/fetch.test.ts @@ -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( @@ -109,6 +109,16 @@ describe('Fetch', () => { ) ) ).toBe(true); + expect( + dataset.has( + factory.quad( + factory.namedNode('https://example.com/publisher'), + foaf('mbox'), + factory.literal('datasets@example.com'), + factory.namedNode('http://data.bibliotheken.nl/id/dataset/rise-alba') + ) + ) + ).toBe(true); expect( dataset.has( factory.quad(