Some convenience methods that can be called directly on a rule object.
Returns a graph representation of the triple patterns contained in the rule.
Returns a graph representation of the triple patterns contained in the rule.
the rule
the directed labeled graph
Returns a rule by the given name from a set of rules.
Returns a rule by the given name from a set of rules.
the set of rules
the name of the rule
the rule if exist
Returns true
if rule1
and rule2
can be merged, i.e.
Returns true
if rule1
and rule2
can be merged, i.e. both rules denote the same input but
probably different output, otherwise false
.
Returns the type of entailment for the given rule
Returns the type of entailment for the given rule
the rule to analyze
the entailment type
Returns a graph representation of the triple patterns contained in the body of the rule.
Returns a graph representation of the triple patterns contained in the body of the rule.
the rule
the directed labeled graph
Returns a graph representation of the triple patterns contained in the head of the rule.
Returns a graph representation of the triple patterns contained in the head of the rule.
the rule
the directed labeled graph
Checks whether a rule is assertional.
Checks whether a rule is assertional.
An rule is considered as assertional, if and only if it contains only assertional triples in its premises and conclusion.
the rule to check
org.dissect.inference.utils.TripleUtils#isAssertional
Checks whether a rule itself is cyclic.
Checks whether a rule itself is cyclic. Intuitively, this means to check for triples produced in the conclusion that are used as input in the premise.
This is rather tricky, i.e. a naive approach which simply looks e.g. for predicates that occur in both, premise and conclusion is not enough because, e.g. a rule [(?s ?p ?o) -> (?o ?p ?s)] would lead to an infinite loop without producing anything new after one iteration. On the other hand, for rules like [(?s ?p ?o1), (?o1 ?p ?o2) -> (?s ?p ?o2)] it's valid. TODO we do not only have to check for common predicates, but also have to analyze the subjects/objects of the triple patterns.
the rule to check
whether it's cyclic or not
Checks whether a rule is assertional.
Checks whether a rule is assertional.
An rule is considered as hybrid, if and only if it contains both assertional and terminological triples in its premises and only assertional triples in its conclusion.
the rule to check
org.dissect.inference.utils.TripleUtils#isAssertional
Checks whether a rule r1 is simply the opposite of another rule r2, i.e.
Checks whether a rule r1 is simply the opposite of another rule r2, i.e. whether it holds that the head of r1 is the body of r2 and vice versa (modulo variable names).
the first rule
the second rule
whether rule1 is the inverse of rule2
[r1: (?s p1 ?o), (?o p1 ?s) -> (?s p2 ?o)] and [r2: (?s p2 ?o) -> (?o p1 ?s)
Checks whether a rule is terminological.
Checks whether a rule is terminological.
An rule is considered as terminological, if and only if it contains only terminological triples in its conclusion.
the rule to check
org.dissect.inference.utils.TripleUtils#isTerminological
Checks whether a rule denotes the transitive closure(TC) for a given predicate p, i.e.
Checks whether a rule denotes the transitive closure(TC) for a given predicate p, i.e.
the rule looks like
(?s p ?o1), (?o1, p ?o2) -> (?s p ?o2)
the rule to check
whether it denotes the TC or not
Load a set of rules from the given file.
Load a set of rules from the given file.
the file
a set of rules
Returns true
if rule1
has the same body as rule2
, otherwise false
.
Returns true
if rule1
has the same head as rule2
, otherwise false
.
Returns all variables that occur in the triple pattern.
Returns all variables that occur in the triple pattern.
the triple pattern
the variables
Returns all variables that occur in the body.
Returns all variables that occur in the body.
the rule
the variables
Returns all variables that occur in the head.
Returns all variables that occur in the head.
the rule
the variables
Utility class for rules.