First draft of report extension for infos on matched nodes - #1239
robert-david wants to merge 4 commits into
Conversation
| <p> | ||
| A valdiation report MAY contain one value for the property <code>sh:nodeAssignmentCount</code>. | ||
| The value MUST be equal to the total number of shape assignments of a <a>focus node</a> to a <a>shape</a>. | ||
| It MUST include focus nodes of target declarations other than <a href="#targetNode"><code>sh:targetNode</code></a>, which are determined by grounding the target nodes based on the specific target declaration. |
There was a problem hiding this comment.
"other than" feels wrong here.
If I write a shape targeting a node but typo the node IRI, I want the report to hint to me 0 matches.
But, when a shapes graph has many targeting shapes, that 0-count will be obscured information.
This leans me to thinking sh:nodeAssignmentCount would go into some kind of reporting node about a shape. Now, node shape, or property shape, or both?
My day to day shapes usage includes graphs that lean on blank nodes for inlining property shapes, many of which appear redundant and impossible to distinguish if separated from their parent node. So, maybe sh:nodeAssignmentCount would only reported on shapes using some kind of targeting predicate.
And this leads me to thinking there's a verbosity-scale for this optional feature. Maybe I want sh:nodeAssignmentCount for all shapes that had an assignment; and in a next-level verbosity, I want sh:nodeAssignmentCount for all shapes that could have an assignment (i.e., having a targeting predicate).
Does this help design considerations?
There was a problem hiding this comment.
@ajnelson-nist I tried to clarify the description. I think it is aligned with your view, but was misleading.
There was a problem hiding this comment.
Ok, after reading the revision, I'm seeing: sh:nodeAssignmentCount is on the validation report, and is not specific to any one shape. It's counting all (shape, node targeted by shape) pairs?
|
Would you mind adding the definitions of the new terms in the shacl.ttl to make it even more specific? I am for example curious how the assignment concept relates to sh:Result/AbstractResult |
…o the shacl-core descriptions
| sh:ShapeAssignment | ||
| a rdfs:Class ; | ||
| rdfs:label "Shape assignment"@en ; | ||
| rdfs:comment "The class of assignments of shapes to nodes."@en ; | ||
| rdfs:subClassOf sh:AbstractResult ; |
There was a problem hiding this comment.
What is the relationship between this class and its sibling sh:ValidationResult? Is a ValidationResult implicitly a ShapeAssignment?
There was a problem hiding this comment.
Or, never (i.e., classes are disjoint, to be encoded in SHACL-SHACL)?
There was a problem hiding this comment.
Rather never, i guess.
There was a problem hiding this comment.
Added disjointness statement to the shacl.ttl.
There was a problem hiding this comment.
Ah, except shacl.ttl purposefully doesn't use most owl: concepts. Better to leave a firm statement in the rdfs:comment, and update shacl-shacl.ttl as part of this PR's changes.
…ult and sh:ShapeAssignment
| <section id="nodeAssignmentCount"><!-- ISSUE-1221 --> | ||
| <h5>Node Assignment Count (sh:nodeAssignmentCount)</h5> | ||
| <p> | ||
| A valdiation report MAY contain one value for the property <code>sh:nodeAssignmentCount</code>. |
There was a problem hiding this comment.
| A valdiation report MAY contain one value for the property <code>sh:nodeAssignmentCount</code>. | |
| A validation report MAY contain one value for the property <code>sh:nodeAssignmentCount</code>. |
| The value MUST be equal to the total number of shape assignments of a <a>shape</a> to a <a>focus node</a>. | ||
| <code>sh:nodeAssignmentCount</code> only counts shapes and focus nodes defined in a target declaration. | ||
| The specific focus nodes are determined by grounding all target nodes of all target declarations. | ||
| For example, target declarations of <a href="#targetNode"><code>sh:targetNode</code></a> directly specify the target nodes, |
There was a problem hiding this comment.
Possible editorial nit: Isn't "For example"-style text put after a "The remainder of this section is informative" divider?
| <section id="assignment"><!-- ISSUE-1221 --> | ||
| <h5>Assignment (sh:assignment)</h5> | ||
| <p> | ||
| A valdiation report MAY containt values for the property <code>sh:assignment</code>. |
There was a problem hiding this comment.
| A valdiation report MAY containt values for the property <code>sh:assignment</code>. | |
| A validation report MAY contain values for the property <code>sh:assignment</code>. |
| SHACL defines <code>sh:ShapeAssignment</code> to report individual assigmments of a <a>focus node</a> to a <a>shape</a>. | ||
| Each instance of <code>sh:ShapeAssignment</code> MUST have exactly one value for the property <code>sh:focusNode</code> | ||
| and exactly one value for the property <code>sh:sourceShape</code>. | ||
| It MAY provide exactly one value for the property <code>sh:conforms</code> to indicate an individual conformance of a <a>focus node</a> to a <a>shape</a>. |
There was a problem hiding this comment.
This is a significant extension of sh:conforms, and I happen to know it would break some of my tests.
sh:conforms already has rdfs:domain sh:ValidationReport.
This suggested usage of sh:conforms also introduces redundancy, and hence ambiguous discovery, of whether a node passed validation. I think this competency is better left imputed by joining between sh:ShapeAssignment nodes and sh:ValidationResult nodes.
I recommend cutting this line.
There was a problem hiding this comment.
Worse, on ambiguous discovery: This is also an opportunity for inconsistent data. Say the assignment reports conformance, but the validation result reports a violation. This would be irreconcilable.
I'm going to mark Request Changes for at least this matter. I haven't gotten back to my prior bigger thread yet.
ajnelson-nist
left a comment
There was a problem hiding this comment.
I feel firmly that the updated application of sh:conforms needs to be removed.
| SHACL defines <code>sh:ShapeAssignment</code> to report individual assigmments of a <a>focus node</a> to a <a>shape</a>. | ||
| Each instance of <code>sh:ShapeAssignment</code> MUST have exactly one value for the property <code>sh:focusNode</code> | ||
| and exactly one value for the property <code>sh:sourceShape</code>. | ||
| It MAY provide exactly one value for the property <code>sh:conforms</code> to indicate an individual conformance of a <a>focus node</a> to a <a>shape</a>. |
There was a problem hiding this comment.
Worse, on ambiguous discovery: This is also an opportunity for inconsistent data. Say the assignment reports conformance, but the validation result reports a violation. This would be irreconcilable.
I'm going to mark Request Changes for at least this matter. I haven't gotten back to my prior bigger thread yet.
| If it does, it MUST provide one value for every pair of <a>shape</a> and <a>focus node</a>. | ||
| If the target declaration is other than <a href="#targetNode"><code>sh:targetNode</code></a>, the pairs are determined by grounding the target nodes based on the specific target declaration. | ||
| Each value of <code>sh:assignment</code> is a SHACL instance of the class <code>sh:ShapeAssignment</code>. | ||
| <span class="todo">TODO: provide a concrete definition of grounding.</span> |
There was a problem hiding this comment.
I think this TODO needs to be addressed before merging. Do you need the word "grounding?" The word makes it sound like some enigmatic process is about to befall target nodes.
I think some example graph already in the document could be pointed at to count pairs, and that could be a sufficient illustration of counting complexities. Or, maybe the "trick" of a SPARQL SELECT constraint attached to a shape targeting itself, and the SELECT finding multiple nodes, could list a node assignment count of 1.
This shapes graph ...
ex:SelectTrickShape
a sh:NodeShape ;
sh:targetNode ex:SelectTrickShape ;
sh:sparql [ sh:select """
SELECT $this ?value
WHERE {
?value ex:flaggingProperty ?x .
}
""" ] .... and this data graph...
ex:node1 ex:flaggingProperty "Flagged" .
ex:node2 ex:flaggingProperty "Also flagged" .would beget this validation results graph:
[
a sh:ValidationReport ;
sh:nodeAssignmentCount 1 ;
# 2 validation results would follow,
# ex:node1 and ex:node2 as value nodes.
]
This pull request provides a first draft to extend the validation report with infos on targeted nodes.
The extensions are designed to not break backwards compatibility with SHACL 1.0.
It provides the following extensions:
Closes #1221