Summary
Adopt SHACL's constraint and form-hint vocabulary (sh: + dash:) inside nanopublication templates, so the constraint layer of a template is expressed with the W3C standard rather than nanodash-specific nt: terms. A thin nt: namespace is kept only for the generative and nanopub-specific concepts SHACL does not model.
This is Part A of the design doc docs/shacl-alignment.md.
Why
The nt: template vocabulary (https://w3id.org/np/o/ntemplate/) overlaps almost one-to-one with SHACL on datatypes, value enumerations, regex, cardinality, labels, ordering, defaults and node kind. Building on the standard for that layer improves interoperability and lets authors import/hand-write SHACL shapes as templates.
This is mostly already prototyped: Template.processShaclTemplate() already ingests a sh:NodeShape (reading sh:targetClass, sh:property, sh:path, sh:hasValue, sh:minCount, sh:maxCount) and accepts nt: hints alongside it.
Scope
Extend processShaclTemplate() to also read the constraint/form-hint terms that currently still come from nt::
dash:editor → widget kind (today the widget type still comes from the nt: placeholder subtype)
sh:name → field label; sh:description
sh:order → field order
sh:in → restricted choice; sh:pattern → regex; sh:datatype; sh:nodeKind; sh:defaultValue
Widget mapping (nt: placeholder → dash:editor) and a full constraint correspondence table are in the design doc.
Stays nt: (no SHACL equivalent)
Resource minting / provenance roles (nt:LocalResource, nt:IntroducedResource, nt:EmbeddedResource, nt:hasTargetNamespace), magic slots (nt:CREATOR/nt:ASSERTION/nt:NANOPUB/nt:RootNanopubPlaceholder), nt:hasNanopubLabelPattern, nt:hasTag, nt:AdvancedStatement, live value sources (nt:possibleValuesFromApi).
Compatibility
Non-breaking and incremental: the existing reified nt: form keeps working unchanged; the hybrid sh:+dash:+nt: form is an additional accepted dialect. A worked before/after example (the "Defining a FAIR IN community" template) is in the doc.
Open questions
- Core SHACL + DASH, or a minimal nanodash editor-hint vocab to avoid a DASH dependency?
- Upstream the
sh:/dash: reading into nanopub-java so it is not nanodash-specific?
See docs/shacl-alignment.md for the full design.
Summary
Adopt SHACL's constraint and form-hint vocabulary (
sh:+dash:) inside nanopublication templates, so the constraint layer of a template is expressed with the W3C standard rather than nanodash-specificnt:terms. A thinnt:namespace is kept only for the generative and nanopub-specific concepts SHACL does not model.This is Part A of the design doc
docs/shacl-alignment.md.Why
The
nt:template vocabulary (https://w3id.org/np/o/ntemplate/) overlaps almost one-to-one with SHACL on datatypes, value enumerations, regex, cardinality, labels, ordering, defaults and node kind. Building on the standard for that layer improves interoperability and lets authors import/hand-write SHACL shapes as templates.This is mostly already prototyped:
Template.processShaclTemplate()already ingests ash:NodeShape(readingsh:targetClass,sh:property,sh:path,sh:hasValue,sh:minCount,sh:maxCount) and acceptsnt:hints alongside it.Scope
Extend
processShaclTemplate()to also read the constraint/form-hint terms that currently still come fromnt::dash:editor→ widget kind (today the widget type still comes from thent:placeholder subtype)sh:name→ field label;sh:descriptionsh:order→ field ordersh:in→ restricted choice;sh:pattern→ regex;sh:datatype;sh:nodeKind;sh:defaultValueWidget mapping (
nt:placeholder →dash:editor) and a full constraint correspondence table are in the design doc.Stays
nt:(no SHACL equivalent)Resource minting / provenance roles (
nt:LocalResource,nt:IntroducedResource,nt:EmbeddedResource,nt:hasTargetNamespace), magic slots (nt:CREATOR/nt:ASSERTION/nt:NANOPUB/nt:RootNanopubPlaceholder),nt:hasNanopubLabelPattern,nt:hasTag,nt:AdvancedStatement, live value sources (nt:possibleValuesFromApi).Compatibility
Non-breaking and incremental: the existing reified
nt:form keeps working unchanged; the hybridsh:+dash:+nt:form is an additional accepted dialect. A worked before/after example (the "Defining a FAIR IN community" template) is in the doc.Open questions
sh:/dash:reading intonanopub-javaso it is not nanodash-specific?See
docs/shacl-alignment.mdfor the full design.