Re: How to refer to individual SHACL shapes to which a data graph conforms?

Hi,

On 2020-06-17 20:55, Irene Polikoff wrote:
 > It is expected that owl:imports in a data graph is used to refer to a 
shapes graph data is based on.

really?  Isn't it rather like this that a data graph should refer to a 
shapes graph via sh:shapesGraph? 
(https://www.w3.org/TR/shacl/#sh-shapes-graph) – and that shapes graphs 
can reuse other shapes graphs using owl:imports?

In any case that's not what I would like to do.  I would like to link 
from a data graph to one or a few individual sh:Shape's, like we did 
with the following non-standard property:

ex:DataGraph a dcat:Dataset ;
ids:relatesToShape ex:PersonShape . # <-- here

ex:PersonShape a sh:NodeShape ;
   sh:targetClass ex:Person ;
   sh:property [
     sh:path ex:email ;
     sh:minCount 1 ] .

For my retrieval use case, I would imagine queries such as "please tell 
me all datasets in which there are persons with email addresses".  (I 
know that that's not exactly what this shape says, because it would also 
successfully validate a data graph without any persons.)

 > Of course, the shapes graph could contain shapes that go beyond what 
is in the data e.g., data may be about people and the shapes graph has 
shapes for people as well as companies. But typically ontologies (by 
ontologies, I broadly mean schema definitions in SHACL) are modular and 
organized based on the domain of interest.
 >
 > Further, shapes target data and the most common target uses classes. 
Thus, it is easy to figure out the relationship between shapes and 
instance data and vice versa - simply follow the target.

Correct, but that's not my use case.  Given the above example, I don't 
have the need to follow the link

ex:PersonShape sh:targetClass ex:Person

in order to find data graphs that contain instances of ex:Person, and 
then to check whether these instances validate against ex:PersonShape. 
I simply trust the data catalogue's maintainer when they say 
"ex:DataGraph validates against ex:PersonShape" (in the sense of 
"validation of a data graph against a shape", cf. 
https://www.w3.org/TR/shacl/#validation-definition).

 > A shape like the one below does not “do” anything without the target. 
One very pattern is to specify targets together with the shape - either 
explicitly or implicitly be declaring a node shape to also be a class.

Sure, I agree that my first example was confusing because I omitted the 
sh:targetClass.

 > When shapes are re-used for different data, you can declare your 
class as a subclass of the target class.  This would look as follows: […]

Thank you, that's useful to know, but not my use case.

Cheers,

Christoph

-- 
Dr. Christoph Lange
Fraunhofer FIT: Head of Knowledge Pipelines Department
http://langec.wordpress.com/about/, Skype duke4701

Received on Thursday, 18 June 2020 08:36:50 UTC