ARQ is a query engine for Jena that supports the SPARQL RDF Query language. SPARQL is the query language developed by the W3C RDF Data Access Working Group.You can easily access the data in the store using SELECT, ASK, DESCRIBE, and CONSTRUCT queries.
Query query = QueryFactory.create("queryString");It results in a ResultSet or an Interator of triples which can easily be processed further.
QueryExecution queryExec = QueryExecutionFactory.sparqlService( endpoint, query );
ResultSet result = queryExec.execSelect(); // or execSelectTriples()
while (result.hasNext()) {One QuerySolution thereby is one result row of the query and each cell can be accessed by the variable name used in the SPARQL query.
QuerySolution solution = result.next();
Resource id = solution.getResource("id");
Resource title = solution.getLiteral("title");
}
But sometimes you do not want to just extract data from your triple store, but INSERT, UPDATE or DELETE triples. This can also be done using Jena.
UpdateRequest update = UpdateFactory.create(queryString);Attention: This just works with triple stores supporting SPARQL 1.1 UPDATE.
UpdateProcessor uExec = UpdateExecutionFactory.createRemote(update, endpoint);
uExec.execute();
Keine Kommentare:
Kommentar veröffentlichen