Rule cycle gotchas

I’ve been meaning to ask this for a while and maybe I’m just a big ol’ dummy but if I am I’m a fairly typical dummy so maybe other dummies out there will benefit so here goes…

I was wondering if you could possibly clarify how #4 under Rule Limitations & Gochas work regarding the presence of cycles in rules. I’ve read it a million times and always come away feeling like I vaguely get it only to feel more and more sure that I don’t. I definitely don’t feel like I understand it enough to explain it to someone else or to avoid the problem while writing rules.

I’ll try to add some specific questions but the overall question is more of a general whhaaa???

“Cycles are allowed only if the rule body does not contain type triples.” Which type of cycles? I think the docs go on to describe a couple types of cycles, cycles in the head, cycles in the body and cycles formed from more than one rule.

“or filters and the triples in the rule body are linear (i.e no cycles in the rule body either)” So previously it says that cycles are allowed as long as the rule body doesn’t have cycles? So which cycles were allowed?

“These rules are not acceptable since there is a cycle” Are the two examples each not allowed taken alone or are they not allowed when taken together?

My impression is that the prohibition his across the entire set of rules and axioms not individual rules. It seems very easy to accidentally write these with a large ontology and set of rules. Is there any good way to detect these while you’re writing these other than executing a query with reasoning and checking the logs? Would the cycle warning show up with “stardog reasoning consistency”?


Just a couple of followups to hopefully clarify what I find confusing. So the restriction on cycles is triggered by the same predicate appearing in the head and the body, is there a restriction on cycles if the head and body don’t share any predicates?

There are criteria for cycles appearing in the rule head and cycles appearing in the rule body but it’s a little confusing if you need to avoid cycles in a single rule or if you need to consider all rule that when taken together or in combination may form a cycle. (including axioms?)

There’s also a requirement for a non-directional linearity in the rule head which is a more strict requirement than not having a cycle. What triggers the non-directional linearity requirement? Having a cycle in the body or that there is a shared predicate between the head and the body.

Sorry for beating this dead horse but my motivation here in addition to understanding what’s going on is I don’t want to tell someone about this cool rules feature and inevitably the first thing they’ll do is go off and write a rule with a cycle. I also don’t want them to come back and say, “hey, what gives. I thought that you said you could write rules” and my response be “well there’s this restriction and I don’t really understand it so it’s tough to explain”. I know the restriction is well motivated but I wanted to be able to understand it well enough to be able to explain it to other people.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.