



 Learning Center Documentation Updates • Info FAQ

| AGSparqlPlanner.javapackage com.franz.ag.examples;
import com.franz.ag.*;
public class AGSparqlPlanner {
@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("sparqlplanner", AGPaths.TRIPLE_STORES);
AGLoadNtriples.loadNTriplesWithTiming(ts, AGPaths.dataSources("kennedy.ntriples"));
AGIndexAllTriples.indexAllTriplesWithTiming(ts);
String query =
"PREFIX ex: <http://example.org/kennedy/> " +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
"SELECT ?father ?mother ?child ?univ " +
"WHERE {" +
"?father rdf:type ex:person . " +
"?mother rdf:type ex:person . " +
"?mother ex:spouse ?father . " +
"?child rdf:type ex:person . " +
"?father ex:has-child ?child . " +
"?mother ex:has-child ?child . " +
"?father ex:alma-mater ?univ . " +
"?child ex:alma-mater ?univ . " +
"}";
SPARQLQuery sq = new SPARQLQuery();
sq.setTripleStore(ts);
sq.setQuery(query);
sq.setPlanner(SPARQLQuery.PLANNER.COVERAGE);
AGSparqlSelect.doSparqlSelect(sq);
sq.setPlanner(SPARQLQuery.PLANNER.IDENTITY);
AGSparqlSelect.doSparqlSelect(sq);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next
© 2008 Franz Inc - Privacy Statement
[ Consulting Services
| Franz
| TopQuadrant
| Racer Systems
]
|