



 Learning Center Documentation Updates • Info FAQ

| AGPrologDisjunction.javapackage com.franz.ag.examples;
import com.franz.ag.*;
public class AGPrologDisjunction {
@param
@throws
public static void main(String[] args) throws AllegroGraphException {
AllegroGraphConnection ags = new AllegroGraphConnection();
try {
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem", e);
}
AllegroGraph ts = ags.renew("prologdisjunction", AGPaths.TRIPLE_STORES);
AGLoadNtriples.loadNTriplesWithTiming(ts, AGPaths.dataSources("kennedy.ntriples"));
AGIndexAllTriples.indexAllTriplesWithTiming(ts);
ts.registerNamespace("ex", "http://example.org/kennedy/");
AGPrologRules.addPrologRule("(<-- (ancestor ?x ?y) (q ?x !ex:has-child ?y))", ags);
AGPrologRules.addPrologRule("(<- (ancestor ?x ?y) (q ?x !ex:has-child ?z) (ancestor ?z ?y))", ags);
String pquery = "(?x)" + "(ancestor ?x !ex:person13)";
AGPrologSelect.doPrologSelect(ts, pquery);
AGPrologRules.addPrologRule("(<-- (descendent ?x ?y) (ancestor ?y ?x))", ags);
pquery = "(?x)" + "(descendent ?x !ex:person13)";
AGPrologSelect.doPrologSelect(ts, pquery);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next
© 2008 Franz Inc - Privacy Statement
[ Consulting Services
| Franz
| TopQuadrant
| Racer Systems
]
|