I'd like to have a rule that copies all properties from an entity to another, which asymmetrically related. Something like this:
RULE :CopyDescription
IF {
?dest :relatedTo ?source .
?source ?prop ?value .
}
THEN {
?dest ?prop ?value .
}
The rule above just doesn't work. If I use a fixed property (say rdfs:label) instead of the variable ?prop, it works. I understand there is potential circularity here because even if :relatedTo is declared asymmetric and irreflexive, there could still be a cycle of a :relatedTo b :relatedTo c :relatedTo a, which break StarDog rule restrictions. But why does it make a difference whether the property is variable or fixed?
Sorry for the delayed answer. One way to think why it makes a difference is that it goes beyond a first-order rule language (like SWRL or Datalog, for example). With a fixed property, e.g.
IF {
?dest :relatedTo ?source .
?source :p ?value .
}
THEN {
?dest :p ?value .
}
the Stardog rule is just a straightforward Datalog rule
in a different syntax.
But if you make property a variable, you're essentially quantifying over properties of objects (i.e. "it holds for all properties") rather than over domain objects. That's not first-order reasoning and it is (substantially) harder.
Thanks @pavel! Stated this way it's pretty clear. I think it would help to have this sorts of explanations, or if you have a more formal spec of the rules' semantics available, in the docs. And I apologize if it's available somewhere and I've missed it. I just know I found it hard to figure out, when a rule doesn't work, if I my logic is flawed or if a construct is not supported, since it just fails silently.
I've probably read it a dozen times but still feel like I sorta get it but probably don't. I find the part about cycles a bit confusing because there seems to be multiple types of cycles but are all referred to generically as "cycle". Cycles in the head, cycles in the body. There's a "dependency graph pattern". But what's a dependency graph pattern? Is that within a rule? Between rules?