W3C home > Mailing lists > Public > public-rdf-shapes@w3.org > June 2020

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

From: Christoph LANGE <math.semantic.web@gmail.com>
Date: Wed, 17 Jun 2020 19:59:33 +0200
To: public-rdf-shapes@w3.org
Message-ID: <4a65166a-6141-6f67-0348-ced377b8b968@gmail.com>
Dear all,

tl;dr: rather than pointing to an entire _graph_ of SHACL shapes (i.e., 
using sh:shapesGraph), is there a standard way of pointing to a few 
individual shapes?  The use case is to retrieve datasets that match a 
given shape or a small set of shapes – because the maintainer of the 
dataset asserted so (and, say, this assertion was confirmed by 
validation), or because a graph matching algorithm found a match, or 
whatever, we don't care.

Long version: this question has come up in the context of the 
International Data Spaces (IDS, 
https://www.internationaldataspaces.org/), an architecture for trusted, 
secure and of course semantic data exchange.  The IDS Information Model 
(https://github.com/International-Data-Spaces-Association/InformationModel/), 
which I am maintaining, is an ontology based on various W3C standards, 
including DCAT, ODRL, SHACL, etc.

The IDS Information Model goes beyond metadata for datasets-as-a-whole 
(dcat:Dataset) in that it also supports talking about the structure and 
semantics of the _content_ of datasets.  Not by re-inventing the wheel, 
but by recommending best practices of how to reuse VoID, Data Cube and 
SHACL (cf. 
https://github.com/International-Data-Spaces-Association/InformationModel/tree/develop/examples/domain-specific-semantics-using-SHACL).

E.g., when a dataset contains data points with temperature measurements, 
whose unit is expressed as a string out of { "C", "K", "F" }, we can say 
that the dataset has a sh:shapesGraph, which contains a shape like this:

ex:TemperatureDataShape
   a sh:NodeShape ;
   sh:property [
     sh:path ex:unit ;
     sh:datatype xsd:string ;
     sh:in ( "C" "K" "F" ) ;
   ] .

(My point here is not to discuss the best way of modelling such data, 
but to provide a simple example.)

More recently, we have thought about _retrieving_ from, well, think of a 
dcat:Catalog, datasets that match a given shape.  See 
https://github.com/International-Data-Spaces-Association/InformationModel/tree/develop/examples/queries-using-sparql 
for the overall idea, 
https://github.com/International-Data-Spaces-Association/InformationModel/blob/develop/examples/queries-using-sparql/SparqlQueries/src/main/resources/1_LIFE_EXPECTANCY_RESOURCE.ttl#L301 
for the SHACL shapes, and 
https://github.com/International-Data-Spaces-Association/InformationModel/blob/develop/examples/queries-using-sparql/SparqlQueries/src/main/resources/1_LIFE_EXPECTANCY_RESOURCE.ttl#L61 
for how we are linking the dataset to them.

Rather than inventing our own property ids:relatesToShape, we would like 
to use something that conforms to the SHACL standard.  At the very 
least, we would like to align our own property with the standard, e.g., 
saying that, whenever a dataset ?d has a sh:shapesGraph, which contains 
(*) a resource ?r of rdf:type sh:Shape, then ?d ids:relatesToShape ?r. 
But even for expressing the situation (*), i.e., a graph containing a 
resource, I am not aware of any standard property.  There is 
rdfg:subGraphOf, but not, say, rdfg:memberOf.

It should be possible to perform the given retrieval task with a SPARQL 
query over the dataset's metadata and the SHACL shape(s).

What would you recommend?

Many thanks in advance for your help,

Christoph

-- 
Dr. Christoph Lange
Fraunhofer FIT: Head of Knowledge Pipelines Department
http://langec.wordpress.com/about/, Skype duke4701
Received on Wednesday, 17 June 2020 17:59:48 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 17 June 2020 17:59:49 UTC