Cyparkler
Cyparkler 1.0 implements a query factory for SPARQL and SeRQL. Sesame 2 onejar.jar required (included in the download). The source code is GNU, you're free to make modifications and build on it.
Documentation and Help
Usage:
HTTPRepository repository = new HTTPRepository(url, rid);
QueryFactory query = new QueryFactory(repository);
// select a language type
query.setLanguage(QueryLangauge.SPARQL);
// add a variable to the projection item list
ProjectionItemFactory subject = query.addVariable("subject");
// ask for all resources with explicit path
Path p = query.addPath(subject, RDF.TYPE, "type");
//make the path optional
p.setOptional(true);
// create a condition
qf.addCondition("subject", ConditionFactory.INEQUALITY_OPERATOR_TYPE, RDF.TYPE);
ConditionFactory cf = qf.addCondition("type", ConditionFactory.EQUALITY_OPERATOR_TYPE, RDF.SUBCLASSOF);
// negate the condition
cf.setNot(true);
query.setLogicalConnector(SPARQLConstants.AND_LOGICAL_CONNECTOR);
// build the query string, add namespace clause
query.build(true);
String str = query.getQueryString();
// execute the query (automatically builds the query string)
// results[i] = result row, results[i][j] = column (variable)
Value[][] results = query.execute();
Documentation can be found here. The Cypher forum provides a place to submit questions, contribute to discussion, etc.
Wishlist (June 24, 2007)
- Create Jave Bean (POJO) abstraction layer similar to Hibernate
- Create SPARQL adapter
- Connect to other triples stores (e.g. Virtuoso) through a JDBC-like connection
- reconcile with the Tripresso project