|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.unidu.is.pdatalog.ds.Rule
The representation of a datalog probabilistic rule. A rule has a head
(an Literal), a body (one or more Literals, stored
in a List) and a mapping function (which can be a linear
one, which then can be defined by a probability).
| Field Summary | |
protected java.util.List |
body
The body of the rule. |
protected Literal |
head
The head of the rule. |
| Constructor Summary | |
Rule(double prob,
Literal head,
java.util.List body)
Creates a new probabilistic rule. |
|
Rule(double prob,
Literal head,
Literal body)
Creates a new probabilistic rule. |
|
Rule(Literal head,
java.util.List body)
Creates a new deterministic rule (probability is one). |
|
Rule(Literal head,
java.util.List body,
Expression mapping)
Creates a new probabilistic rule. |
|
Rule(Literal head,
Literal body)
Creates a new deterministic rule (probability is one). |
|
Rule(Literal head,
Literal body,
Expression mapping)
Creates a new deterministic rule (probability is one). |
|
Rule(Rule rule)
Creates a new rule as a copy of the specified rule. |
|
| Method Summary | |
void |
addLiteral(Literal literal)
Adds the specified literal to the body of this rule. |
boolean |
contains(Literal literal)
Tests if this rule contains the specified literal as the head or in the body without considering if the literal is positive or negative. |
boolean |
containsExactly(Literal literal)
Tests if this rule contains exactly the specified literal as the head or in the body considering if the literal is positive or negative. |
boolean |
containsExactlyInBody(Literal literal)
Tests if this rule contains exactly the specified literal in the body considering if the literal is positive or negative. |
java.util.Set |
getAllArguments()
Returns a set containing all arguments (variables an constants) of the head literal and all body literals. |
Expression[] |
getAllArgumentsAsArray()
Returns an array containing all arguments (variables an constants) of the head literal and all body literals. |
java.util.List |
getBody()
Returns the body of this rule. |
java.util.Set |
getConstants()
Returns a set containing all constants (no variables) of the head literal and all body literals. |
Literal |
getHead()
Returns the head of this rule. |
Expression |
getMapping()
Returns the mapping function. |
static Expression |
getMapping(double prob)
Returns a linear mapping function. |
static Expression |
getMapping(java.lang.String prob)
Returns a linear mapping function. |
java.lang.String |
getName()
Returns the heads predicate name. |
java.lang.String |
getPredicateName()
Returns the heads predicate name. |
java.util.Set |
getVariables()
Returns a set containing all variables (no constants) of the head literal and all body literals. |
boolean |
isOptimizable()
Returns the optimisable flag. |
Literal |
literalAt(int num)
Returns the body literal at the specified index. |
int |
literalCount()
Returns the number of body literals of this Rule. |
void |
putAllArguments(java.util.Set set)
Puts all arguments (variables an constants) of the head literal and all body literals into the specified set. |
void |
putConstants(java.util.Set set)
Puts all constants (no variables) of the head literal and all body literals into the specified set. |
void |
putVariables(java.util.Set set)
Puts all variables (no constants) of the head literal and all body literals into the specified set. |
void |
removeLiteral(int literal)
Removes the literal at the specified index from the body of this rule. |
void |
removeLiteral(Literal literal)
Removes the specified literal fromo the body of this rule. |
void |
setHead(Literal head)
Sets the head of this rule. |
void |
setLiteral(int num,
Literal literal)
Sets (replaces) the body literal at the specified index. |
void |
setMapping(Expression mapping)
Sets the mapping function. |
void |
setOptimizable(boolean optimizable)
Sets the optimisable flag. |
java.lang.String |
toString()
Returns a datalog representation of this rule. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected Literal head
protected java.util.List body
| Constructor Detail |
public Rule(Literal head,
Literal body)
head - head of the rulebody - body of the rule
public Rule(double prob,
Literal head,
Literal body)
prob - the probability of the rulehead - head of the rulebody - body of the rule
public Rule(Literal head,
Literal body,
Expression mapping)
head - head of the rulebody - body of the rule
public Rule(Literal head,
java.util.List body)
head - head of the rulebody - body of the rule
public Rule(double prob,
Literal head,
java.util.List body)
prob - the probability of the rulehead - head of the rulebody - body of the rule
public Rule(Literal head,
java.util.List body,
Expression mapping)
head - head of the rulebody - body of the rulemapping - mapping functionpublic Rule(Rule rule)
rule - to be copied| Method Detail |
public Literal getHead()
public void setHead(Literal head)
head - head of the rulepublic java.util.List getBody()
public Literal literalAt(int num)
num - the index
null,
if this literal does not exist
public void setLiteral(int num,
Literal literal)
num - the indexliteral - body literal at the specified indexpublic int literalCount()
public boolean contains(Literal literal)
This method can be used to test if a literal should be added to be body for spezialization.
public boolean containsExactly(Literal literal)
public boolean containsExactlyInBody(Literal literal)
public void addLiteral(Literal literal)
literal - literal to be added to the bodypublic void removeLiteral(Literal literal)
literal - literal to be removed to the bodypublic void removeLiteral(int literal)
literal - literal to be removed to the bodypublic void putVariables(java.util.Set set)
set - destination set for all variablespublic void putConstants(java.util.Set set)
set - destination set for all constantspublic void putAllArguments(java.util.Set set)
set - destination set for all argumentspublic java.util.Set getVariables()
public java.util.Set getConstants()
public java.util.Set getAllArguments()
public Expression[] getAllArgumentsAsArray()
public java.lang.String getName()
public java.lang.String getPredicateName()
public java.lang.String toString()
public Expression getMapping()
public void setMapping(Expression mapping)
mapping - mapping functionpublic boolean isOptimizable()
public void setOptimizable(boolean optimizable)
optimizable - optimisable flagpublic static Expression getMapping(double prob)
prob - probability factor of the mapping function
public static Expression getMapping(java.lang.String prob)
prob - probability factor of the mapping function
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||