Re: sh:sourceShape points to blank PropertyShape

Hi,

We wanted to do something similar, and ended up switching to use named
nodes to facilitate this. Named nodes might provided for reuse
opportunities as well.

Regards
Mark

On Fri., Feb. 18, 2022, 10:03 Vladimir Alexiev, <
vladimir.alexiev@ontotext.com> wrote:

> Hi! We have a bunch of rules (NodeShapes) with a lot of metadata in them.
> We want ValidationResults to point to those shapes, so we can display the
> metadata along with the node and value to blame.
> Our rules are often implemented as a single sh:property, and sometimes
> with sh:and, sh:or, sh:node.
>
> We find with both TQ SHACL and RDF4J SHACL that sh:sourceShape is set to
> the PropertyShape, which in our case is a blank node.
> For example:
>
> <sh1> a sh:NodeShape;
>   sh:target...
>   sh:property [sh:path ...; ...]. <<< set to this blank-node PropertyShape
>
> <sh2> a sh:NodeShape;
>   sh:target...
>   sh:not [sh:property [sh:path ...; ...]]. <<< set to the NodeShape
>
> Paradoxically, results from the more complicated shape sh2 ends up
> pointing to the right node, whereas the simpler shape sh1 points to a blank
> node.
>
> What we do is post-process the validation results to redirect
> sh:sourceShape to the right node, eg:
>
> delete {?x sh:sourceShape ?propShape}
> insert {?x sh:sourceShape ?nodeShape}
> where {
>   ?x sh:sourceShape ?propShape
>   filter(isBlank(?propShape))
>   filter exists {?propShape sh:path []}
>   ?propShape ^sh:property ?nodeShape
> }
>
> However, shouldn't the spec lay down some rules that sh:sourceShape is
> redirected "upwards" from blank-node PropertyShape?
>
> --
> Vladimir Alexiev, PhD, PMP
> Chief Data Architect
> Sirma AI, trading as Ontotext: https://www.ontotext.com, LinkedIn,
> Twitter, Rate GraphDB
> Email: vladimir.alexiev@ontotext.com, skype:valexiev1
> Mobile: +359 888 568 132, SMS: 359888568132@sms.mtel.net
> Calendar:
> https://www.google.com/calendar/embed?src=vladimir.alexiev@ontotext.com
> Publications and CV: https://github.com/VladimirAlexiev/my
>

Received on Friday, 18 February 2022 22:38:09 UTC