Quantcast
Viewing latest article 35
Browse Latest Browse All 227

[data-shapes] how to implement SHACL Rules (forward chaining) efficiently (#347)

VladimirAlexiev has just created a new issue for https://github.com/w3c/data-shapes:

== how to implement SHACL Rules (forward chaining) efficiently ==
The following "provoked" the posting of this issue:
- @afs proposed to use datalog for SHACL rules
- discussion with @robert-david 
- @steveraysteveray in #343 and ensuing discussion

> We definitely iterate multiple times over the rules. Using TopBraidComposer, that is easily configured. 
> ... repeatedly invokes the SHACL inference until no new triples are asserted.

- That makes it non-scalable (could even say "a recipe for disaster" if I wasn't afraid @TallTed would censor me :-)).
- A key question in forward chaining is how to track some sort of a "working set" in order to limit the amount of "data-rules" interactions.
- That was tackled by https://en.wikipedia.org/wiki/Rete_algorithm in 1974-1979: let's not forget all this prior art and years of progress!

Let's gather some info on how repositories optimize forward chaining:
- GDB has a queue of incoming statements. Each incoming triple is checked against each premise of every rule (rules are loaded in memory as JVM code, so this checking is "cheap"). If a rule matches a triple, all other premises are checked against the transaction and data-at-rest (this is more expensive). If a new triple is inferred, it's added to the queue
- [Jena Rules](https://jena.apache.org/documentation/inference/#rules) support "forward chaining, backward chaining and a hybrid execution model". @afs How does it implement forward chaining efficiently?

Which SHACL rule features are easier to implement?
- Triple Rules are easier since you can presumably do dependency tracking
- SPARQL Rules are harder since it could infer anything

Some excuses on my part:
- This is not a critique of the ASHRAE use case (which is excellent) nor TopBraid
- Answering "this is an implementation detail" is ok, but still it would be good to collect some guidance/advice regarding implementation


Please view or discuss this issue at https://github.com/w3c/data-shapes/issues/347 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Viewing latest article 35
Browse Latest Browse All 227

Trending Articles