Custom sh:rule to support references to other shapes, and other features

Hi,

I'm new to this group and am looking for some help. I also just joined the SHACL Community Group.

We want to use SHACL to validate data and to infer new triples. We think we need to implement a custom sh:rule type.

We want to find out whether there's already been any work in this area, get some advice on designing the rule structure & semantics, and explore whether this could be included in a future version of the SHACL-AF spec.

This is what the rule type needs to do:

  *   Generate new IRIs, e.g. based on a random UUID.
  *   Generate chains of triples, e.g. :ExistingTerm :x :NewTerm1 . :NewTerm1 :y :NewTerm2 ...
  *   Generate triples whose object is a node at some arbitrary other path in the data graph, or even a term that was generated by another rule.
     *   We think the most convenient way to do this is for the rule to refer to a shape that matched that path.

Here's an example.

Initial data graph:

:Event1
  a :incomingEvent ;
  :destinationClass :Class1 .

Desired inferred triples:

:Event1 :triggersChange :Change-abc-123-def .          # this 'change' has a UUID-based IRI
:Change-abc-123-def :happenedTo :Process-ghi-456-jkl . # we generate a chain of triples

# the object of the triple below is the destinationClass from the initial data graph.
# We'd like to write an sh:rule that achieves this by referring to the Shape that validates the destinationClass,
# to save us repeating the same property path in our shapes and in our rules.
:Process-ghi-456-jkl :isOfClass :Class1 .

Notes:

  *   We are happy to write our own engine or extend an existing one.
  *   Ideally we'll write our inference logic in pure RDF without resorting to SPARQL.
  *   The trickiest part seems to be expressing the 'long range bind' in a rule, e.g. to reference :Class1 in the example above.

Sorry this is a rather long message. I can split this into separate threads, or individual GitHub issues, depending on where this discussion goes.

Thanks,
Phil


This message is confidential and subject to terms at: https://www.jpmorgan.com/emaildisclaimer including on confidential, privileged or legal entity information, malicious content and monitoring of electronic messages. If you are not the intended recipient, please delete this message and notify the sender immediately. Any unauthorized use is strictly prohibited.

Received on Tuesday, 17 December 2024 11:31:35 UTC