|
AROM-2_2_13 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--arom.kr.query.engine.AQEngine
A class that implements the query engine.
there are 3 main classes in the AROMQuery API :
AQCondition is used to build a query.
AQEngine is used to compile and execute a query.
AQResult is used to iterate over the results of a query.
example:
// Construct query engine
AQEngine engine = new AQEngine(kb);
// build conditions and query path
AQCondition n1 = new AQCondition("Teacher", "Salary > 2000");
AQCondition n2 = new AQCondition("Teaches", "");
AQCondition n3 = new AQCondition("Student", "not graduated");
n1.add(n2, "teacher");
n2.add(n3, "student");
// compile and execute query
engine.compile(n1);
AQResult res = engine.query(node);
// print result
while (res.hasNext()) {
Iterator path = (Iterator) res.next();
while (path.hasNext()) {
AMInstance o = (AMInstance) path.next();
System.out.print("[" + o.toString() + "] ");
}
System.out.println(" *");
}
Constructor Summary | |
AQEngine(KnowledgeBase kb)
Constructs a new AQEngine. |
|
AQEngine(KnowledgeBase kb,
arom.kr.query.util.InstancesCollections instancesCollections)
Constructs a new AQEngine. |
Method Summary | |
void |
compile(AQCondition node)
compile full query path. |
void |
compileNode(AQCondition node)
compile single Condition Node |
KnowledgeBase |
getKb()
get current knowledge base |
AQResult |
query(AQCondition node)
execute query |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AQEngine(KnowledgeBase kb, arom.kr.query.util.InstancesCollections instancesCollections) throws NullPointerException
public AQEngine(KnowledgeBase kb) throws NullPointerException
Method Detail |
public KnowledgeBase getKb()
public void compileNode(AQCondition node) throws AQParserException, AQStructureException, AQInstancesCollectionsException
node
- a AQCondition to compile
AQParserException
- if parsing of algebraic expression failed
AQStructureException
AQInstancesCollectionsException
public void compile(AQCondition node) throws AQParserException, AQStructureException, AQInstancesCollectionsException
node
- the root of query path to compile
AQParserException
- if parsing of algebraic expression failed
AQStructureException
AQInstancesCollectionsException
public AQResult query(AQCondition node) throws AQInstancesCollectionsException
node
- the root of query path to execute
AQInstancesCollectionsException
|
AROM-2_2_13 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |