ISSUE-95 PROPOSAL: A SHACL process shall inject a property constraint for all instances of some suitable property template class, e.g. sh:PropertyConstraintTemplate.

I have carefully read Holger's github branch named
[https://github.com/w3c/data-shapes/tree/template-simplifications
template-simplifications] and have reread his detailed
[https://lists.w3.org/Archives/Public/public-data-shapes-wg/2015Oct/0111.html
explanation] in the mailing list.
My view remains that there is too much implementation bias in the
specification, that the spec is saying too much, and that we should
remove this
extra content from the spec so that both Holger and other implementers
have more freedom.

My initial objection was to the use of sh:scopeClass as a way to
inject templates.
Here is the example from the spec where a template constraint injects
itself in property constraints.

<code>
  ex:LanguageConstraint
    a sh:ConstraintTemplate ;
    sh:scopeClass sh:PropertyConstraint ;
    rdfs:label "Language constraint" ;
    rdfs:subClassOf sh:AbstractPropertyConstraint ;
    sh:argument [
      sh:predicate ex:lang ;
      sh:datatype xsd:string ;
      rdfs:label "language" ;
      rdfs:comment "The language tag, e.g. \"de\"." ;
    ] ;
    sh:labelTemplate "Values of {?predicate} must be literals with
language \"{?lang}\"" ;
    sh:message "Values must be literals with language \"{?lang}\"" ;
    sh:sparql """
      SELECT $this ($this AS ?subject) $predicate (?value AS ?object)
      WHERE {
        $this $predicate ?value .
        FILTER (!isLiteral(?value) || !langMatches(lang(?value), $lang))
      }
      """ .
</code>

Here is how the template constraint is instantiated:

<code>
  ex:TemplateLanguageExampleShape
    a sh:Shape ;
    sh:scopeClass ex:Country ;
    sh:property [
    sh:predicate ex:germanLabel ;
      sh:maxCount 1 ;
      ex:lang "de" ;
    ] ;
    sh:property [
      sh:predicate ex:englishLabel ;
      sh:maxCount 1 ;
      ex:lang "en" ;
    ] .
</code>

Holger's implementation keys on the triple:

<code>
  ex:LanguageConstraint sh:scopeClass sh:PropertyConstraint .
</code>

to trigger injection. This strikes me as overloading the use of
sh:scopeClass which has semantics for validation, not injection.

PROPOSAL: A SHACL process shall inject a property constraint for all
instances of some suitable property template class, e.g.
sh:PropertyConstraintTemplate.

The simplified SHACL would be:

<code>
  ex:LanguageConstraint
    a sh:PropertyConstraintTemplate ;
    rdfs:label "Language constraint" ;
    sh:argument [
      sh:predicate ex:lang ;
      sh:datatype xsd:string ;
      rdfs:label "language" ;
      rdfs:comment "The language tag, e.g. \"de\"." ;
    ] ;
    sh:labelTemplate "Values of {?predicate} must be literals with
language \"{?lang}\"" ;
    sh:message "Values must be literals with language \"{?lang}\"" ;
    sh:sparql """
      SELECT $this ($this AS ?subject) $predicate (?value AS ?object)
      WHERE {
        $this $predicate ?value .
        FILTER (!isLiteral(?value) || !langMatches(lang(?value), $lang))
      }
      """ .
</code>

Received on Thursday, 29 October 2015 11:46:21 UTC