Iterative application of sh:Rules?

21 views
Skip to first unread message

Boris Pelakh

unread,
May 24, 2021, 7:33:56 PM5/24/21
to TopBraid Suite Users
I have read in the SHACL-AF spec that rules are applied in strict sh:order precedence, and there is no way to control intra-order execution. Are there any plans to allow for iterative entailment where rules are applied until no new triples are inferred (a stable state is achieved), the way regular inference engines work? 

Here is my particular use case - I would like to be able to enforce, via SHACL, the maximum depth of a SKOS-based taxonomy. Using something like a Datalog engine, I would be able to set up the following rules:

[?topConcept,:hasDepth,0] :- [?any, skos:hasTopConcept, ?topConcept].
[?concept,:hasDepth,?plusOne] :- 
    [?concept, skos:broader, ?broader],
    [?broader, :hasDepth, ?depth],
    BIND(?depth + 1 as ?plusOne).

I could then set up a shape with a max value for the :hasDepth property. But SHACL rules, as currently specified, would not allow me to achieve this goal. Is there an alternative path?

PS I know I would be able to do this with a query if I could guarantee that every concept had at most 1 skos:broader, but since that property is not functional and polyhierarchies are something I need to be able to handle, that's not an option.

Holger Knublauch

unread,
May 24, 2021, 8:44:02 PM5/24/21
to topbrai...@googlegroups.com

Hi Boris,

the statement that rules only do a single iteration was basically only written for the formal spec, because it simplified the definition and avoided all kinds of complications that the WG didn't have time to handle. (Rules in general were just an optional add-on for the Data Shapes WG).

In practice, we (of course) support iterative rule execution in our tools. Basically as you say, fixpoint iteration. Programmatically it just means restart at the first rule, taking the inferences graph from the previous loop as input.

Was your question about specific features of TopBraid of just about SHACL-AF in general?

Holger

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/94646524-3f45-4668-8c31-d07a8dcfd79en%40googlegroups.com.

Boris Pelakh

unread,
May 25, 2021, 11:58:23 AM5/25/21
to TopBraid Suite Users
Holger,

Thanks for the info. While general SHACL-AF guidance is nice, my specific client is using TQ EDG, so that information is most relevant. One last follow up - this validation for a taxonomy, but I don't see any place where shapes can be entered for an taxonomy. Do I just import them as RDF? If so, how do I see which Concepts are non-compliant?

Holger Knublauch

unread,
May 25, 2021, 7:27:06 PM5/25/21
to topbrai...@googlegroups.com


On 2021-05-26 1:58 am, Boris Pelakh wrote:
Holger,

Thanks for the info. While general SHACL-AF guidance is nice, my specific client is using TQ EDG, so that information is most relevant.

In EDG, activate this button for iterative rule execution:

One last follow up - this validation for a taxonomy, but I don't see any place where shapes can be entered for an taxonomy. Do I just import them as RDF? If so, how do I see which Concepts are non-compliant?

This may better go into a separate email thread, but if I understand your question correctly then the short answer is that you define shapes in an Ontology (asset collection) and have the Taxonomy include the Ontology (using the Includes link on the Settings tabs). Once you have defined your shapes you can either run the full Problems and Suggestions report using the corresponding Panel, or activate constraint checking for each individual instance on the Form panel using this button

HTH
Holger



On Monday, May 24, 2021 at 8:44:02 PM UTC-4 Holger Knublauch wrote:

Hi Boris,

the statement that rules only do a single iteration was basically only written for the formal spec, because it simplified the definition and avoided all kinds of complications that the WG didn't have time to handle. (Rules in general were just an optional add-on for the Data Shapes WG).

In practice, we (of course) support iterative rule execution in our tools. Basically as you say, fixpoint iteration. Programmatically it just means restart at the first rule, taking the inferences graph from the previous loop as input.

Was your question about specific features of TopBraid of just about SHACL-AF in general?

Holger


On 2021-05-25 9:33 am, Boris Pelakh wrote:
I have read in the SHACL-AF spec that rules are applied in strict sh:order precedence, and there is no way to control intra-order execution. Are there any plans to allow for iterative entailment where rules are applied until no new triples are inferred (a stable state is achieved), the way regular inference engines work? 

Here is my particular use case - I would like to be able to enforce, via SHACL, the maximum depth of a SKOS-based taxonomy. Using something like a Datalog engine, I would be able to set up the following rules:

[?topConcept,:hasDepth,0] :- [?any, skos:hasTopConcept, ?topConcept].
[?concept,:hasDepth,?plusOne] :- 
    [?concept, skos:broader, ?broader],
    [?broader, :hasDepth, ?depth],
    BIND(?depth + 1 as ?plusOne).

I could then set up a shape with a max value for the :hasDepth property. But SHACL rules, as currently specified, would not allow me to achieve this goal. Is there an alternative path?

PS I know I would be able to do this with a query if I could guarantee that every concept had at most 1 skos:broader, but since that property is not functional and polyhierarchies are something I need to be able to handle, that's not an option.

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/94646524-3f45-4668-8c31-d07a8dcfd79en%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages