Skip to content

Add basic validator #55

Open
nicholascar wants to merge 1 commit into
w3c:gh-pagesfrom
Kurrawong:validator
Open

Add basic validator #55
nicholascar wants to merge 1 commit into
w3c:gh-pagesfrom
Kurrawong:validator

Conversation

@nicholascar
Copy link
Copy Markdown
Contributor

@nicholascar nicholascar commented Feb 5, 2026

  • adds a basic SHACL validator for the Prof Vocab
  • adds tests for the validator
  • removes old, incomplete, SHACL shapes

Closes #54

@nicholascar nicholascar mentioned this pull request Feb 5, 2026
Comment thread prof/rdf/validator.ttl
Comment on lines +14 to +32
:ProfileDisjointFromResourceDescriptorShape
a sh:NodeShape ;
sh:message "Instances of prof:Profile must not also be instances of prof:ResourceDescriptor." ;
sh:not
[
sh:class prof:ResourceDescriptor ;
] ;
sh:targetClass prof:Profile ;
.

:ResourceDescriptorDisjointFromProfileShape
a sh:NodeShape ;
sh:message "Instances of prof:ResourceDescriptor must not also be instances of prof:Profile." ;
sh:not
[
sh:class prof:Profile ;
] ;
sh:targetClass prof:ResourceDescriptor ;
.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nicholascar ,

As part of my work in the SHACL 1.2 Profiling Task Force, I've also tried writing a similar validator to this graph. So, I have some opportunity to compare results with you.

These two highlighted shapes surprised me. I would have written the same (modulo IRI) if I saw owl:disjointWith statements in the prof Turtle graph, but I don't see them in today's code-state:

dx-prof/prof/rdf/prof.ttl

Lines 141 to 145 in de5b96a

### http://www.w3.org/ns/dx/prof/ResourceDescriptor
:ResourceDescriptor rdf:type owl:Class ;
rdfs:label "Resource Descriptor"@en ;
skos:definition "A description of a resource that defines an aspect - a particular part, feature or role - of a Profile"@en ;
skos:usageNote "Can be use to indicate the formalism (via dct:format) and any adherence to a dct:Standard (via dct:conformsTo) to allow for machine mediation as well as its purpose via relation to a ResourceRole (via hasRole)"@en .

dx-prof/prof/rdf/prof.ttl

Lines 156 to 163 in de5b96a

### http://www.w3.org/ns/dx/prof/Profile
:Profile rdf:type owl:Class ;
rdfs:subClassOf dct:Standard ;
dct:source <https://www.w3.org/2017/dxwg/wiki/ProfileContext> ;
rdfs:label "Profile" ;
skos:definition """A specification that constrains, extends, combines, or provides guidance or explanation about the usage of other specifications.
This definition includes what are often called \"application profiles\", \"metadata application profiles\", or \"metadata profiles\"."""@en .

So, if these shapes are to be added, shouldn't prof.ttl receive an update to declare the classes owl:disjointWith one another?

Comment thread prof/rdf/validator.ttl
Comment on lines +36 to +49
sh:property
[
sh:maxCount 1 ;
sh:message "Each prof:ResourceDescriptor must have exactly one prof:hasRole value." ;
sh:minCount 1 ;
sh:path prof:hasRole ;
sh:nodeKind sh:IRI ;
] ,
[
sh:maxCount 1 ;
sh:message "Each prof:ResourceDescriptor must have exactly one prof:hasArtifact value." ;
sh:minCount 1 ;
sh:path prof:hasArtifact ;
] ;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to my discovery path on the above remark, I would have encoded this cardinality restraint if I had seen it in today's code-state of prof.ttl.

So, shouldn't prof.ttl also receive an update adding:

:ResourceDescriptor
  rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty prof:hasRole ;
    owl:cardinality "1"^^xsd:nonNegativeInteger ;
  ] ;
  rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty prof:hasArtifact ;
    owl:cardinality "1"^^xsd:nonNegativeInteger ;
  ] ;
  .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a validator

2 participants