SHACL to SPARQL

Hi all,

I have a library which generates SPARQL queries from SHACL, mostly to
support two use cases. The first is listing sets of items, or focus nodes,
with constraints on which items are selected. I find this one quite
straightforward in SHACL. The second is describing individual objects, i.e.
which properties should be included/and or excluded when describing an
individual focus node. This one I find less clear - I can see there are a
series of SHACL predicates which are relevant, but it's unclear to me if
there's a "canonical" way this should be done.

My question is whether there's a canonical way to do Use Case 2, and if
not, should this form part of the use cases SHACL covers in future or be a
part of a SHACL extension.

In detail my use cases are:

Use Case 1:
I want to describe the selection of a set of focus nodes, based on one or a
combination of the following focus node attributes:
- the class of the focus nodes
- the focus nodes' relationship to a specified node (e.g. is member of x)
- the focus nodes' relationship to nodes of a specified class (e.g. the
dcat:Catalogs that contain any dcat:Dataset, dcat:Resource etc.)
- the presence or abscence of properties on the focus nodes, including via
path relations (inverse, sequence etc.)

Use Case 2:
I want to describe a focus node by choosing one of the following two
methods:
1.
a. including all direct properties, except:
- excluding any properties explicitly stated including via path relations
(inverse, sequence etc.). (e.g. when describing a dcat:Dataset, not listing
it's large number of members)
- including any properties explicitly stated via "indirect" path relations
(inverse, sequence etc.)
b. inclusion of blank nodes to a specified depth

2.
a. excluding all direct/indirect properties, except:
- including any properties explicitly stated via direct and indirect path
relations (inverse, sequence etc.)
b. inclusion of blank nodes to a specified depth

If SHACL predicates are reused across both use cases I want a clear way to
distinguish which they are being used for. E.g. is a SHACL expression which
in some way specifies dcterms:hasPart being used to describe how to select
a set of focus nodes, or how to describe each focus node. At present I've
used extension predicates for the blank node depth and "include all
properties" concepts.

Thanks,
David

Received on Monday, 23 September 2024 12:57:27 UTC