AGJenaQueryAllGraphs.java
package com.franz.agjena.examples;
import com.franz.agbase.AllegroGraph;
import com.franz.agbase.AllegroGraphConnection;
import com.franz.agbase.AllegroGraphException;
import com.franz.agbase.examples.AGPaths;
import com.franz.agjena.AllegroGraphGraphMaker;
import com.franz.agjena.AllegroGraphModel;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.rdf.model.Model;
public class AGJenaQueryAllGraphs {
@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("jenatest5", AGPaths.TRIPLE_STORES);
AllegroGraphGraphMaker maker = new AllegroGraphGraphMaker(ts);
maker.setDefaultIsGraphOfAllGraphs(true);
String demoNamespace = "http://ag.franz.com/demo#";
String graphName1 = demoNamespace + "context1";
Graph graphOne = maker.createGraph(graphName1);
Model modelOne = new AllegroGraphModel(graphOne);
String inputFileName1 = AGPaths.dataSources("vc-db-1.rdf");
modelOne.read(inputFileName1, "RDF/XML" );
String query = "select ?s ?p ?o where {?s ?p ?o }";
AGJenaUtils.doQuery(query, maker.getGraph());
maker.setDefaultIsGraphOfAllGraphs(false);
query = "select ?s ?p ?o where {?s ?p ?o }";
AGJenaUtils.doQuery(query, maker.getGraph());
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next