object RuleUtils
Utility class for rules.
- Alphabetic
- By Inheritance
- RuleUtils
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
implicit
class
RuleExtension extends AnyRef
Some convenience methods that can be called directly on a rule object.
- implicit class TriplePatternEqualiltyExtension extends AnyRef
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
asGraph(rule: Rule): Graph[Node, LDiEdge]
Returns a graph representation of the triple patterns contained in the rule.
Returns a graph representation of the triple patterns contained in the rule.
- rule
the rule
- returns
the directed labeled graph
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
byName(rules: Seq[Rule], name: String): Option[Rule]
Returns a rule by the given name from a set of rules.
Returns a rule by the given name from a set of rules.
- rules
the set of rules
- name
the name of the rule
- returns
the rule if exist
-
def
canMerge(rule1: Rule, rule2: Rule): Boolean
Returns
true
ifrule1
andrule2
can be merged, i.e.Returns
true
ifrule1
andrule2
can be merged, i.e. both rules denote the same input but probably different output, otherwisefalse
. -
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
entailmentType(rule: Rule): RuleEntailmentType
Returns the type of entailment for the given rule
Returns the type of entailment for the given rule
- rule
the rule to analyze
- returns
the entailment type
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
graphOfBody(rule: Rule): Graph[Node, LDiEdge]
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.
- rule
the rule
- returns
the directed labeled graph
-
def
graphOfHead(rule: Rule): Graph[Node, LDiEdge]
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.
- rule
the rule
- returns
the directed labeled graph
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
isAssertional(rule: Rule): Boolean
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.
- rule
the rule to check
- See also
org.dissect.inference.utils.TripleUtils#isAssertional
-
def
isCyclic(rule: Rule): Boolean
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.
- rule
the rule to check
- returns
whether it's cyclic or not
-
def
isHybrid(rule: Rule): Boolean
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.
- rule
the rule to check
- See also
org.dissect.inference.utils.TripleUtils#isAssertional
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isInverseOf(rule1: Rule, rule2: Rule): Boolean
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).
- rule1
the first rule
- rule2
the second rule
- returns
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)
Example: -
def
isTerminological(rule: Rule): Boolean
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.
- rule
the rule to check
- See also
org.dissect.inference.utils.TripleUtils#isTerminological
-
def
isTransitiveClosure(rule: Rule, property: Node = null): Boolean
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)
- rule
the rule to check
- returns
whether it denotes the TC or not
-
def
load(filename: String): Seq[Rule]
Load a set of rules from the given file.
Load a set of rules from the given file.
- filename
the file
- returns
a set of rules
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
sameBody(rule1: Rule, rule2: Rule): Boolean
Returns
true
ifrule1
has the same body asrule2
, otherwisefalse
. -
def
sameHead(rule1: Rule, rule2: Rule): Boolean
Returns
true
ifrule1
has the same head asrule2
, otherwisefalse
. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- def varsOf(tp: Triple): List[Node]
-
def
varsOf(tp: TriplePattern): List[Node]
Returns all variables that occur in the triple pattern.
Returns all variables that occur in the triple pattern.
- tp
the triple pattern
- returns
the variables
-
def
varsOfBody(rule: Rule): Set[Node]
Returns all variables that occur in the body.
Returns all variables that occur in the body.
- rule
the rule
- returns
the variables
-
def
varsOfHead(rule: Rule): Set[Node]
Returns all variables that occur in the head.
Returns all variables that occur in the head.
- rule
the rule
- returns
the variables
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()