|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectde.unidu.is.pdatalog.RelationBase
A collection of pDatalog++ relations together with methods for inserting facts and applying rules, using a RDBMS system.
| Field Summary | |
protected PropertyMap |
config
PDatalog++ configuration. |
protected org.apache.log4j.Logger |
factsLogger
Logger for facts. |
protected org.apache.log4j.Logger |
rulesLogger
Logger for rules. |
| Constructor Summary | |
RelationBase(DB db)
Creates a new, empty relation base. |
|
| Method Summary | |
void |
add(Fact fact)
Adds the specified fact to the knowledge base. |
void |
add(Relation relation)
Adds (and initialises) the specified relation to this relation base. |
void |
add(Relation relation,
boolean create)
Adds (and initialises, if specified by the Boolean parameter) the specified relation to this relation base. |
void |
addIndex(Relation relation)
Adds indexes to the specified relation. |
void |
clear()
Removes all relations. |
void |
clear(java.lang.String name)
Clears the relation, i.e. it removes all facts. |
void |
close(java.sql.ResultSet rs)
Closes the specified ResultSet. |
void |
compute(IDBRelation relation,
java.util.Collection rules)
Computes the result of the specified rules (all corresponding to the specified derived relation). |
void |
compute(IDBRelation relation,
Rule rule)
Compute the relation by evaluating the single rule. |
void |
compute(IDBRelation relation,
Rule rule,
boolean addIndex)
Compute the relation by evaluating the single rule. |
void |
computeDisjoint(IDBRelation relation,
java.util.Collection rules)
Computes the result of the specified rules (all corresponding to the specified derived relation). |
void |
computeRecursively(IDBRelation rel,
Rule rule)
Compute the specified rule recursively, applying the naive evaluation. |
boolean |
containsRelation(java.lang.String name)
Tests whether this relation base contains the relation defined by the specified name. |
void |
dump(Relation relation)
Dumps the content of the relation. |
boolean |
equals(java.lang.Object obj)
|
boolean |
existsRelation(java.lang.String relation)
Retutns true iff the relation physically exists. |
Relation |
get(java.lang.String name)
Returns the relation defined by the specified name. |
int |
getTupleCount(Relation rel)
Returns the number of tuples in the relation. |
int |
hashCode()
|
boolean |
isEmpty()
Tests whether this relation base is empty, which means it does not contain any relation. |
java.util.Iterator |
names()
Returns an iterator over all relation names. |
void |
perform(SQL sql)
Performs a SQL insert statement. |
java.sql.ResultSet |
performQuery(SQL sql)
Performs a SQL insert statement. |
java.util.List |
query(java.lang.String query)
Queries the relation base. |
java.util.List |
queryRelation(Relation relation)
Returns all tuples in the specified relation. |
java.util.List |
queryRelation(java.lang.String relation,
int arity)
Returns all tuples in the specified relation. |
java.util.Collection |
relations()
Returns a collection containing all relations. |
void |
remove(java.lang.String name)
Removes the relation defined by the specified name. |
int |
size()
Returns the size of this relation base, which means the number of relations in it. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected PropertyMap config
protected org.apache.log4j.Logger rulesLogger
protected org.apache.log4j.Logger factsLogger
| Constructor Detail |
public RelationBase(DB db)
db - DB parameters| Method Detail |
public void add(Fact fact)
fact - fact to be added
public void compute(IDBRelation relation,
java.util.Collection rules)
relation - target relationrules - collection of rules for target relation
public void compute(IDBRelation relation,
Rule rule)
relation - IDB relationrule - rule to be evaluated
public void compute(IDBRelation relation,
Rule rule,
boolean addIndex)
relation - IDB relationrule - rule to be evaluatedaddIndex - if true, an DB index is added
public void computeDisjoint(IDBRelation relation,
java.util.Collection rules)
relation - target relationrules - collection of rules for target relationpublic void dump(Relation relation)
relation - target relationpublic void clear()
public boolean containsRelation(java.lang.String name)
name - relation name
public boolean equals(java.lang.Object obj)
public Relation get(java.lang.String name)
name - relation name
public int hashCode()
public boolean isEmpty()
public java.util.Iterator names()
public void add(Relation relation)
relation - relation to be stored
public void add(Relation relation,
boolean create)
relation - relation to be storedcreate - if true, the relation is physically createdpublic void remove(java.lang.String name)
name - relation namepublic void clear(java.lang.String name)
name - relation namepublic int size()
public java.lang.String toString()
public java.util.Collection relations()
public void perform(SQL sql)
sql - SQL statement
public java.sql.ResultSet performQuery(SQL sql)
throws java.sql.SQLException
sql - SQL statement
java.sql.SQLExceptionpublic void close(java.sql.ResultSet rs)
ResultSet.
rs - result setpublic void addIndex(Relation relation)
relation - reationpublic boolean existsRelation(java.lang.String relation)
relation - relation name
public java.util.List query(java.lang.String query)
query - pDatalog++ query
public java.util.List queryRelation(Relation relation)
relation - relation
public java.util.List queryRelation(java.lang.String relation,
int arity)
relation - relation namearity - relation arity
public void computeRecursively(IDBRelation rel,
Rule rule)
Future implementation will use a more efficient method.
rel - relation namerule - rulepublic int getTupleCount(Relation rel)
rel - relation
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||