Skip to content

Commit

Permalink
Refactor tests, add shapes recommended check
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Jul 4, 2024
1 parent bd3b64c commit 3494963
Show file tree
Hide file tree
Showing 2 changed files with 505 additions and 133 deletions.
335 changes: 335 additions & 0 deletions ckanext/dcat/tests/shacl/dcat-ap_2.1.1_shacl_shapes_recommended.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,335 @@
@prefix rdf: <http:https://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http:https://data.europa.eu/r5r#> .
@prefix adms: <http:https://www.w3.org/ns/adms#> .
@prefix cc: <http:https://creativecommons.org/ns#> .
@prefix dc: <http:https://purl.org/dc/elements/1.1/> .
@prefix dcat: <http:https://www.w3.org/ns/dcat#> .
@prefix dct: <http:https://purl.org/dc/terms/> .
@prefix foaf: <http:https://xmlns.com/foaf/0.1/> .
@prefix lcon: <http:https://www.w3.org/ns/locn#> .
@prefix org: <http:https://www.w3.org/ns/org#> .
@prefix owl: <http:https://www.w3.org/2002/07/owl#> .
@prefix odrl: <http:https://www.w3.org/ns/odrl/2/> .
@prefix prov: <http:https://www.w3.org/ns/prov#> .
@prefix rdfs: <http:https://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http:https://schema.org/> .
@prefix sh: <http:https://www.w3.org/ns/shacl#> .
@prefix skos: <http:https://www.w3.org/2004/02/skos/core#> .
@prefix spdx: <http:https://spdx.org/rdf/terms#> .
@prefix time: <http:https://www.w3.org/2006/time#> .
@prefix vcard: <http:https://www.w3.org/2006/vcard/ns#> .
@prefix xsd: <http:https://www.w3.org/2001/XMLSchema#> .
@prefix dcatap: <http:https://data.europa.eu/r5r/> .

<http:https://data.europa.eu/r5r/shacl_shapes>
dcatap:availability <http:https://data.europa.eu/r5r/stable> ;
dct:format <http:https://publications.europa.eu/resource/authority/file-type/RDF_TURTLE> ;
dct:conformsTo <https://www.w3.org/TR/shacl> ;
dct:creator [
rdfs:seeAlso <https://www.linkedin.com/in/bert-van-nuffelen-a349634/> ;
org:memberOf <https://tenforce.com> ;
foaf:homepage <https://www.linkedin.com/in/bert-van-nuffelen-a349634/> ;
foaf:name "Bert Van Nuffelen"
], [
rdfs:seeAlso <https://www.ails.ece.ntua.gr/people/natasa> ;
org:memberOf <https://www.ails.ece.ntua.gr/> ;
foaf:homepage <https://www.ails.ece.ntua.gr/people/natasa> ;
foaf:name "Natasa Sofou"
], [
rdfs:seeAlso <http:https://eugeniu.costezki.ro#me> ;
org:memberOf <http:https://publications.europa.eu/resource/authority/corporate-body/PUBL> ;
foaf:homepage <http:https://costezki.ro> ;
foaf:name "Eugeniu Costetchi"
], [
rdfs:seeAlso <http:https://makxdekkers.com/#me> ;
org:memberOf <http:https://ami-consult.com/#id> ;
foaf:homepage <http:https://makxdekkers.com/> ;
foaf:name "Makx Dekkers"
], [
rdfs:seeAlso <http:https://nikosloutas.com/> ;
org:memberOf <http:https://www.pwc.com/gx/en/eu-institutions-services> ;
foaf:homepage <http:https://nikosloutas.com/> ;
foaf:name "Nikolaos Loutas"
], [
rdfs:seeAlso <http:https://www.deri.ie/users/vassilios-peristeras/> ;
org:memberOf <http:https://publications.europa.eu/resource/authority/corporate-body/COM> ;
foaf:homepage <http:https://www.deri.ie/users/vassilios-peristeras/> ;
foaf:name "Vassilios Peristeras"
] ;
dct:license <https://creativecommons.org/licenses/by/4.0> ;
cc:attributionURL <http:https://ec.europa.eu/> ;
dct:publisher <http:https://publications.europa.eu/resource/authority/corporate-body/DIGIT> ;
dct:description "This document specifies the constraints on properties and classes expressed by DCAT-AP in SHACL."@en ;
dct:title "The constraints of DCAT Application Profile for Data Portals in Europe"@en ;
owl:versionInfo "2.1.1" ;
foaf:maker [
foaf:mbox <mailto:[email protected]> ;
foaf:name "DCAT-AP Working Group" ;
foaf:page <https://github.com/SEMICeu/DCAT-AP>, <https://joinup.ec.europa.eu/node/64331>
] .



#-------------------------------------------------------------------------
# The shapes in this file cover all recommendations in DCAT-AP 2.1.1.
#
#
#-------------------------------------------------------------------------

:Agent_Shape
a sh:NodeShape ;
sh:name "Agent"@en ;
sh:property [
sh:minCount 1 ;
sh:path dct:type ;
sh:severity sh:Warning
] ;
sh:targetClass foaf:Agent .

:CatalogRecord_Shape
a sh:NodeShape ;
sh:name "Catalog Record"@en ;
sh:property [
sh:minCount 1 ;
sh:path dct:conformsTo ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:issued ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path adms:status ;
sh:severity sh:Warning
] ;
sh:targetClass dcat:CatalogRecord .


:Catalog_Shape
a sh:NodeShape ;
sh:name "Catalog"@en ;
sh:property [
sh:minCount 1 ;
sh:path dct:language ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:issued ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:license;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:spatial ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:modified ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dcat:themeTaxonomy ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path foaf:homepage ;
sh:severity sh:Warning
] ;
sh:targetClass dcat:Catalog .

:Catalog_Shape2
a sh:NodeShape ;
sh:name "Catalog"@en ;
sh:or (
[
sh:path dcat:dataset ;
sh:minCount 1 ;
]
[
sh:path dcat:service ;
sh:minCount 1 ;
]
) ;
sh:severity sh:Warning;
sh:targetClass dcat:Catalog .


#
# Outcommented because no constraint is present
# and according to the W3C spec sh:property expects at least a sh:path
#

#:CategoryScheme_Shape
# a sh:NodeShape ;
# sh:name "Category Scheme"@en ;
# sh:property [
# ] ;
# sh:targetClass skos:ConceptScheme .
#
#:Category_Shape
# a sh:NodeShape ;
# sh:name "Category"@en ;
# sh:property [
# ] ;
# sh:targetClass skos:Concept .
#
#:Checksum_Shape
# a sh:NodeShape ;
# sh:name "Checksum"@en ;
# sh:property [
# ] ;
# sh:targetClass spdx:Checksum .

:DataService_Shape
a sh:NodeShape ;
sh:name "Data Service"@en ;
sh:property [
sh:minCount 1 ;
sh:path dcat:servesDataset ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dcat:endpointDescription ;
sh:severity sh:Warning
] ;
sh:targetClass dcat:DataService .

:Dataset_Shape
a sh:NodeShape ;
sh:name "Dataset"@en ;
sh:property [
sh:minCount 1 ;
sh:path dcat:contactPoint ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dcat:distribution ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dcat:keyword ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:publisher ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:spatial ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:temporal ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dcat:theme ;
sh:severity sh:Warning
] ;
sh:targetClass dcat:Dataset .

:DateOrDateTimeDataType_Shape
a sh:NodeShape ;
rdfs:comment "Date time date disjunction shape checks that a datatype property receives a date or a dateTime literal" ;
rdfs:label "Date time date disjunction" ;
sh:message "The values must be data typed as either xsd:date or xsd:dateTime" ;
sh:or ([
sh:datatype xsd:date
]
[
sh:datatype xsd:dateTime
]
) .

:DcatResource_Shape
a sh:NodeShape ;
rdfs:comment "the union of Catalog, Dataset and DataService" ;
rdfs:label "dcat:Resource" ;
sh:message "The node is either a Catalog, Dataset or a DataService" ;
sh:or ([
sh:class dcat:Catalog
]
[
sh:class dcat:Dataset
]
[
sh:class dcat:DataService
]
) .

:Distribution_Shape
a sh:NodeShape ;
sh:name "Distribution"@en ;
sh:property [
sh:minCount 1 ;
sh:path dct:description ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dcatap:availability ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:format ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dct:license ;
sh:severity sh:Warning
] ;
sh:targetClass dcat:Distribution .

#:Identifier_Shape
# a sh:NodeShape ;
# sh:name "Identifier"@en ;
# sh:property [
# ] ;
# sh:targetClass adms:Identifier .

:LicenceDocument_Shape
a sh:NodeShape ;
sh:name "Licence Document"@en ;
sh:property [
sh:minCount 1 ;
sh:path dct:type ;
sh:severity sh:Warning
] ;
sh:targetClass dct:LicenseDocument .

:Location_Shape
a sh:NodeShape ;
sh:name "Location"@en ;
sh:property [
sh:minCount 1 ;
sh:path dcat:bbox ;
sh:severity sh:Warning
], [
sh:minCount 1 ;
sh:path dcat:centroid ;
sh:severity sh:Warning
] ;
sh:targetClass dct:Location .

:PeriodOfTime_Shape
a sh:NodeShape ;
sh:name "PeriodOfTime"@en ;
sh:property [
sh:minCount 1 ;
sh:path dcat:endDate ;
sh:severity sh:Warning ;
], [
sh:minCount 1 ;
sh:path dcat:startDate ;
sh:severity sh:Warning ;
] ;
sh:targetClass dct:PeriodOfTime .

#:Relationship_Shape
# a sh:NodeShape ;
# sh:name "Relationship"@en ;
# sh:property [
# ] ;
# sh:targetClass dcat:Relationship .

Loading

0 comments on commit 3494963

Please sign in to comment.