ISSUE-95: Proposed simplification and clean up of template mechanism

Template Simplifications

Proposed simplification and clean up of template mechanism

State:
CLOSED
Product:
SHACL Spec
Raised by:
Holger Knublauch
Opened on:
2015-09-29
Description:
Based on recent discussions (e.g. about the unification of property constraints with node constraints, and the many AbstractXY classes in the Turtle file), I have carefully revised the template mechanism, leading to a cleaner and much more compact design.

I have described them on a branch of the spec [1] and this diff gives some impression of the changes [2].

In a nutshell, I am proposing two changes. Sorry they are very technical and may not be of interest to everyone here:


1) Cleaner template injection mechanism, instead of inheritance (see corresponding section in the Templates section).

In the previous version, if multiple templates were merged into one (such as sh:PropertyConstraint), then they would use rdfs:subClassOf. In the new design I am using sh:scopeClass for that purpose, because this more cleanly separates argument inheritance from SPARQL body inheritance.


2) Replaced sh:validationFunction with sh:NodeValidationFunction, and allowing these functions to directly inject themselves into other templates such as sh:PropertyConstraint.

In the previous version, each validation function still needed to be backed by a separate template, even though this template was almost trivial and had basically the same arguments all over again. In the new design, it is sufficient to declare the validation function and give it sh:scopeClass sh:PropertyConstraint.

The net result of these changes is that I was able to drop the vast majority of AbstractXY classes, and the same function code is reused for sh:property, sh:inverseProperty, sh:argument and (if approved) sh:constraint. I am pasting an example node validation function below - this is all that it takes to inject a new property into sh:property:

ex:hasLanguage
a sh:NodeValidationFunction ;
sh:scopeClass sh:PropertyConstraint ;
sh:argument [
sh:predicate ex:lang ;
sh:datatype xsd:string ;
rdfs:label "language" ;
rdfs:comment "The language to match against, e.g. \"de\"." ;
] ;
sh:sparql """
ASK {
FILTER (isLiteral($node) && langMatches(lang($node), $lang)) .
}
""" .

which can then be used as a new property ex:lang as in

ex:TemplateLanguageExampleShape
a sh:Shape ;
sh:scopeClass ex:Country ;
sh:property [
sh:predicate ex:germanLabel ;
sh:maxCount 1 ;
ex:lang "de" ;
] ; ...

I hope this proposed simplification is in everyone's best interest.

[1] https://github.com/w3c/data-shapes/tree/template-simplifications
[2] https://github.com/w3c/data-shapes/commit/be1a06061c601315e0eb542dc5eddf7ca2c23e87
Related Actions Items:
No related actions
Related emails:
  1. Re: shapes-ISSUE-211 (property constraints): Eliminate property constraints [SHACL Spec] (from holger@topquadrant.com on 2016-11-22)
  2. New metamodel/SPARQL sections (from holger@topquadrant.com on 2016-04-20)
  3. ISSUE-101: Can we close this? (from holger@topquadrant.com on 2016-04-06)
  4. Re: shapes-ISSUE-125 (sh:NodeConstraint missing): sh:NodeConstraint is mentioned but never defined [SHACL Spec] (from holger@topquadrant.com on 2016-04-06)
  5. Re: Selected problems with Proposal 4 (from irene@topquadrant.com on 2016-03-11)
  6. Re: Selected problems with Proposal 4 (from pfpschneider@gmail.com on 2016-03-11)
  7. Re: Selected problems with Proposal 4 (from holger@topquadrant.com on 2016-03-11)
  8. Re: SHACL syntax and metamodel complexity (from holger@topquadrant.com on 2016-03-11)
  9. Re: Selected problems with Proposal 4 (from irene@topquadrant.com on 2016-03-10)
  10. Re: Selected problems with Proposal 4 (from pfpschneider@gmail.com on 2016-03-10)
  11. Selected problems with Proposal 4 (from holger@topquadrant.com on 2016-03-10)
  12. Re: ISSUE-41: Property paths (from simon.steyskal@wu.ac.at on 2016-03-10)
  13. Re: SHACL syntax and metamodel complexity (from kontokostas@informatik.uni-leipzig.de on 2016-03-09)
  14. ISSUE-41: Property paths (was: SHACL syntax and metamodel complexity) (from holger@topquadrant.com on 2016-03-09)
  15. Re: SHACL syntax and metamodel complexity (from simon.steyskal@wu.ac.at on 2016-03-09)
  16. Re: SHACL syntax and metamodel complexity (from holger@topquadrant.com on 2016-03-09)
  17. Re: SHACL syntax and metamodel complexity (from pfpschneider@gmail.com on 2016-03-08)
  18. Re: SHACL syntax and metamodel complexity (from holger@topquadrant.com on 2016-03-08)
  19. Re: SHACL syntax and metamodel complexity (from holger@topquadrant.com on 2016-03-08)
  20. Re: SHACL syntax and metamodel complexity (from pfpschneider@gmail.com on 2016-03-07)
  21. Re: SHACL syntax and metamodel complexity (from pfpschneider@gmail.com on 2016-03-07)
  22. Re: SHACL syntax and metamodel complexity (from kcoyle@kcoyle.net on 2016-03-07)
  23. Re: SHACL syntax and metamodel complexity (from kcoyle@kcoyle.net on 2016-03-07)
  24. Re: SHACL syntax and metamodel complexity (from holger@topquadrant.com on 2016-03-07)
  25. Re: SHACL syntax and metamodel complexity (from holger@topquadrant.com on 2016-03-07)
  26. Re: shapes-ISSUE-126 (sh:TemplateConstraint undefined): sh:TemplateConstraint is used in examples but not defined [SHACL Spec] (from holger@topquadrant.com on 2016-03-07)
  27. Re: shapes-ISSUE-125 (sh:NodeConstraint missing): sh:NodeConstraint is mentioned but never defined [SHACL Spec] (from holger@topquadrant.com on 2016-03-07)
  28. Re: SHACL syntax and metamodel complexity (from pfpschneider@gmail.com on 2016-03-06)
  29. Re: issue-95 metamodel simplifications (from holger@topquadrant.com on 2016-03-05)
  30. Re: issue-95 metamodel simplifications (from jamsden@us.ibm.com on 2016-03-04)
  31. Re: issue-95 metamodel simplifications (from holger@topquadrant.com on 2016-03-03)
  32. Re: issue-95 metamodel simplifications (from holger@topquadrant.com on 2016-03-03)
  33. Re: issue-95 metamodel simplifications (from pfpschneider@gmail.com on 2016-03-02)
  34. Re: issue-95 metamodel simplifications (from pfpschneider@gmail.com on 2016-03-02)
  35. Re: issue-95 metamodel simplifications (from pfpschneider@gmail.com on 2016-03-02)
  36. issue-95 metamodel simplifications (from eric@w3.org on 2016-03-02)
  37. Re: ISSUE-95: New proposal for metamodel (from holger@topquadrant.com on 2016-02-26)
  38. Re: ISSUE-95: New proposal for metamodel (from holger@topquadrant.com on 2016-02-24)
  39. Re: ISSUE-95: New proposal for metamodel (from arthur.ryman@gmail.com on 2016-02-23)
  40. Re: ISSUE-95: New proposal for metamodel (from irene@topquadrant.com on 2016-02-23)
  41. Re: ISSUE-95: New proposal for metamodel (from kcoyle@kcoyle.net on 2016-02-23)
  42. Re: ISSUE-95: New proposal for metamodel (from lehors@us.ibm.com on 2016-02-23)
  43. Re: ISSUE-95: New proposal for metamodel (from arthur.ryman@gmail.com on 2016-02-23)
  44. ISSUE-95: New proposal for metamodel (from holger@topquadrant.com on 2016-02-23)
  45. Re: Summarizing results of yesterday's call (from arthur.ryman@gmail.com on 2016-02-11)
  46. Summarizing results of yesterday's call (from simon.steyskal@wu.ac.at on 2016-02-11)
  47. Re: ISSUE-95 Discussions (from holger@topquadrant.com on 2016-02-11)
  48. Re: ISSUE-95 Discussions (from arthur.ryman@gmail.com on 2016-02-09)
  49. Re: ISSUE-95: Proposal 1 Done. Invitation for telecon. (from arthur.ryman@gmail.com on 2016-02-07)
  50. Re: AW: Re: ISSUE-95: Proposal 1 Done. Invitation for telecon. (from arthur.ryman@gmail.com on 2016-02-07)
  51. Re: ISSUE-95: Proposal 1 Done. Invitation for telecon. (from kcoyle@kcoyle.net on 2016-02-05)
  52. Re: AW: Re: ISSUE-95: Proposal 1 Done. Invitation for telecon. (from holger@topquadrant.com on 2016-02-05)
  53. Re: ISSUE-95 Discussions (from holger@topquadrant.com on 2016-02-05)
  54. Re: ISSUE-95: Proposal 1 Done. Invitation for telecon. (from holger@topquadrant.com on 2016-02-05)
  55. AW: Re: ISSUE-95: Proposal 1 Done. Invitation for telecon. (from simon.steyskal@wu.ac.at on 2016-02-04)
  56. ISSUE-95: Proposal 1 Done. Invitation for telecon. (from arthur.ryman@gmail.com on 2016-02-04)
  57. Re: ISSUE-95: What should go into which Turtle file? (from arthur.ryman@gmail.com on 2016-02-04)
  58. Re: ISSUE-95 Discussions (from arthur.ryman@gmail.com on 2016-02-04)
  59. Re: ISSUE-95: Proposal for model simplifications (from holger@topquadrant.com on 2016-01-30)
  60. ISSUE-95: What should go into which Turtle file? (from holger@topquadrant.com on 2016-01-30)
  61. Re: ISSUE-95 Discussions (from holger@topquadrant.com on 2016-01-29)
  62. Re: ISSUE-95 Discussions (from arthur.ryman@gmail.com on 2016-01-28)
  63. Re: ISSUE-95 Discussions (from holger@topquadrant.com on 2016-01-26)
  64. Re: ISSUE-95 Discussions (from irene@topquadrant.com on 2016-01-25)
  65. Re: ISSUE-95 Discussions (from kcoyle@kcoyle.net on 2016-01-25)
  66. Re: ISSUE-95 Discussions (from irene@topquadrant.com on 2016-01-25)
  67. Re: ISSUE-95 Discussions (from holger@topquadrant.com on 2016-01-25)
  68. Re: ISSUE-95 Discussions (from kcoyle@kcoyle.net on 2016-01-24)
  69. Re: ISSUE-95 Discussions (from irene@topquadrant.com on 2016-01-24)
  70. ISSUE-95 Warning Posted :-) (from arthur.ryman@gmail.com on 2016-01-23)
  71. Re: ISSUE-95 Discussions (from arthur.ryman@gmail.com on 2016-01-21)
  72. Re: ISSUE-95 Discussions (from holger@topquadrant.com on 2016-01-20)
  73. Re: ISSUE-78 Discussions (from arthur.ryman@gmail.com on 2016-01-19)
  74. Re: Constraints metamodel draft (was: ISSUE-95: Proposal for model simplifications) (from arthur.ryman@gmail.com on 2015-12-15)
  75. Re: ISSUE-95: Proposal for model simplifications (from arthur.ryman@gmail.com on 2015-12-15)
  76. Re: ISSUE-95: Proposal for model simplifications (from eric@w3.org on 2015-11-24)
  77. Constraints metamodel draft (was: ISSUE-95: Proposal for model simplifications) (from holger@topquadrant.com on 2015-11-21)
  78. Re: ISSUE-95: Proposal for model simplifications (from holger@topquadrant.com on 2015-11-20)
  79. Re: ISSUE-95: Proposal for model simplifications (from arthur.ryman@gmail.com on 2015-11-19)
  80. Re: ISSUE-95: Proposal for model simplifications (from pfpschneider@gmail.com on 2015-11-19)
  81. Re: ISSUE-95: Proposal for model simplifications (from pfpschneider@gmail.com on 2015-11-19)
  82. Re: ISSUE-95: Proposal for model simplifications (from kcoyle@kcoyle.net on 2015-11-19)
  83. Re: ISSUE-95: Proposal for model simplifications (from pfpschneider@gmail.com on 2015-11-19)
  84. Re: connecting ISSUE-65 (Nomenclature) to other issues (from arthur.ryman@gmail.com on 2015-11-19)
  85. Re: connecting ISSUE-65 (Nomenclature) to other issues (from pfpschneider@gmail.com on 2015-11-19)
  86. Re: connecting ISSUE-65 (Nomenclature) to other issues (from arthur.ryman@gmail.com on 2015-11-19)
  87. ISSUE-95: Proposal for model simplifications (from arthur.ryman@gmail.com on 2015-11-19)
  88. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from irene@topquadrant.com on 2015-11-13)
  89. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from arthur.ryman@gmail.com on 2015-11-13)
  90. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from irene@topquadrant.com on 2015-11-13)
  91. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from arthur.ryman@gmail.com on 2015-11-13)
  92. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from arthur.ryman@gmail.com on 2015-11-13)
  93. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from irene@topquadrant.com on 2015-11-12)
  94. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from arthur.ryman@gmail.com on 2015-11-12)
  95. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from irene@topquadrant.com on 2015-11-12)
  96. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from kcoyle@kcoyle.net on 2015-11-12)
  97. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from arthur.ryman@gmail.com on 2015-11-12)
  98. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from holger@topquadrant.com on 2015-11-12)
  99. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from holger@topquadrant.com on 2015-11-12)
  100. Re: ISSUE-95: Proposed simplification and clean up of template mechanism (from arthur.ryman@gmail.com on 2015-11-11)
  101. ISSUE-95: Proposed simplification and clean up of template mechanism (from arthur.ryman@gmail.com on 2015-11-11)
  102. Re: Can we freeze the Tracker for while? (from lehors@us.ibm.com on 2015-11-09)
  103. Re: Can we freeze the Tracker for while? (from kcoyle@kcoyle.net on 2015-11-09)
  104. Re: Can we freeze the Tracker for while? (from holger@topquadrant.com on 2015-11-09)
  105. Re: ISSUE-95: Template Simplifications (from holger@topquadrant.com on 2015-10-30)
  106. Re: ISSUE-95: Template Simplifications (from holger@topquadrant.com on 2015-10-30)
  107. sh:Template needed? (was: ISSUE-95: Template Simplifications) (from holger@topquadrant.com on 2015-10-30)
  108. Re: ISSUE-95: Template Simplifications (from holger@topquadrant.com on 2015-10-30)
  109. Re: ISSUE-95: Template Simplifications (from holger@topquadrant.com on 2015-10-30)
  110. Re: ISSUE-95: Template Simplifications (from holger@topquadrant.com on 2015-10-30)
  111. Re: ISSUE-95: Template Simplifications (from holger@topquadrant.com on 2015-10-30)
  112. Re: ISSUE-95: Template Simplifications (from holger@topquadrant.com on 2015-10-30)
  113. Functions invocation (was: ISSUE-95: Template Simplifications) (from holger@topquadrant.com on 2015-10-30)
  114. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-29)
  115. Re: ISSUE-95: Template Simplifications (from irene@topquadrant.com on 2015-10-29)
  116. Re: ISSUE-95: Template Simplifications (from irene@topquadrant.com on 2015-10-29)
  117. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-29)
  118. Re: Functions invocation (from pfpschneider@gmail.com on 2015-10-29)
  119. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-29)
  120. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-29)
  121. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-29)
  122. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-29)
  123. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-29)
  124. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-29)
  125. Re: On using the Proposal page (was Re: ISSUE-95: Template Simplifications) (from arthur.ryman@gmail.com on 2015-10-29)
  126. Re: ISSUE-95: Template Simplifications (from arthur.ryman@gmail.com on 2015-10-29)
  127. Re: ISSUE-95: Template Simplifications (from arthur.ryman@gmail.com on 2015-10-29)
  128. ISSUE-95 PROPOSAL: Clarify the spec. Make a distinction between built-ins and extensions. Stop claiming that built-ins are templates. If an implementation wants to use the template mechanism for built-ins, that's ok but that's not part of the spec. (from arthur.ryman@gmail.com on 2015-10-29)
  129. ISSUE-95 PROPOSAL: Define the extension mechanism with minimal dependency on an underlying and undocumented class hierarchy. RDFS is not UML. (from arthur.ryman@gmail.com on 2015-10-29)
  130. ISSUE-95 PROPOSAL: A SHACL process shall inject a property constraint for all instances of some suitable property template class, e.g. sh:PropertyConstraintTemplate. (from arthur.ryman@gmail.com on 2015-10-29)
  131. Re: ISSUE-95: Template Simplifications (from holger@topquadrant.com on 2015-10-29)
  132. On using the Proposal page (was Re: ISSUE-95: Template Simplifications) (from lehors@us.ibm.com on 2015-10-29)
  133. Re: ISSUE-95: Template Simplifications (from holger@topquadrant.com on 2015-10-29)
  134. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-28)
  135. Re: ISSUE-95: Template Simplifications (from pfpschneider@gmail.com on 2015-10-28)
  136. Re: ISSUE-95: Template Simplifications (from irene@topquadrant.com on 2015-10-28)
  137. ISSUE-95: Template Simplifications (from arthur.ryman@gmail.com on 2015-10-28)
  138. Re: ISSUE-95: Is sh:scopeClass overloaded? (from holger@topquadrant.com on 2015-10-23)
  139. Re: ISSUE-95: Is sh:scopeClass overloaded? (from arthur.ryman@gmail.com on 2015-10-22)
  140. Re: ISSUE-95: Is sh:scopeClass overloaded? (from arthur.ryman@gmail.com on 2015-10-22)
  141. Re: speeding up the working group (from kcoyle@kcoyle.net on 2015-10-20)
  142. Re: ISSUE-95: Is sh:scopeClass overloaded? (from holger@topquadrant.com on 2015-10-16)
  143. ISSUE-95: Is sh:scopeClass overloaded? (from arthur.ryman@gmail.com on 2015-10-15)
  144. Re: RDF Data Shapes WG agenda for 15 October 2015 (from holger@topquadrant.com on 2015-10-15)
  145. Re: RDF Data Shapes WG agenda for 15 October 2015 (from pfpschneider@gmail.com on 2015-10-14)
  146. Re: speeding up the working group (from holger@topquadrant.com on 2015-10-09)
  147. Re: shapes-ISSUE-95 (Template Simplifications): Proposed simplification and clean up of template mechanism [SHACL Spec] (from holger@topquadrant.com on 2015-10-09)
  148. Re: shapes-ISSUE-95 (Template Simplifications): Proposed simplification and clean up of template mechanism [SHACL Spec] (from pfpschneider@gmail.com on 2015-10-08)
  149. Re: RDF Data Shapes WG agenda for 8 October 2015 (from pfpschneider@gmail.com on 2015-10-08)
  150. Re: shapes-ISSUE-95 (Template Simplifications): Proposed simplification and clean up of template mechanism [SHACL Spec] (from holger@topquadrant.com on 2015-10-07)
  151. Re: shapes-ISSUE-95 (Template Simplifications): Proposed simplification and clean up of template mechanism [SHACL Spec] (from pfpschneider@gmail.com on 2015-10-06)
  152. Re: shapes-ISSUE-95 (Template Simplifications): Proposed simplification and clean up of template mechanism [SHACL Spec] (from holger@topquadrant.com on 2015-10-06)
  153. Re: shapes-ISSUE-95 (Template Simplifications): Proposed simplification and clean up of template mechanism [SHACL Spec] (from pfpschneider@gmail.com on 2015-10-02)
  154. Re: RDF Data Shapes WG Agenda for 1 October 2015 (from holger@topquadrant.com on 2015-10-01)
  155. Re: RDF Data Shapes WG Agenda for 1 October 2015 (from holger@topquadrant.com on 2015-10-01)
  156. Re: RDF Data Shapes WG Agenda for 1 October 2015 (from pfpschneider@gmail.com on 2015-09-30)
  157. shapes-ISSUE-95 (Template Simplifications): Proposed simplification and clean up of template mechanism [SHACL Spec] (from sysbot+tracker@w3.org on 2015-09-29)

Related notes:

RESOLUTION: Close ISSUE-95, adopting Proposal 3 https://www.w3.org/2014/data-shapes/wiki/ISSUE-95:_Metamodel_simplifications#Proposal_3
https://www.w3.org/2016/04/14-shapes-minutes.html#resolution03

Arnaud Le Hors, 14 Apr 2016, 20:58:18

Display change log ATOM feed


Chair, Staff Contact
Tracker: documentation, (configuration for this group), originally developed by Dean Jackson, is developed and maintained by the Systems Team <w3t-sys@w3.org>.
$Id: 95.html,v 1.1 2018/11/26 09:03:43 carine Exp $