/**
* Initialise Joseki configuration to allow SPARQL querying of the
* Jena back-end.
*/
private void initSparqlQueryEngine() {
ServiceRegistry myReg = new ServiceRegistry();
Processor proc = new SPARQL();
String baseRootURI = "#dataset";
String serviceURI = "joseki/sparql";
String dbPath = JenaDatabaseSupport.getDatabasePath();
if (dbPath != null
&& JenaDatabaseSupport.getType().equals(JenaDatabaseType.TDB)) {
Model model = ModelFactory.createDefaultModel();
Resource baseResource = model.createResource(baseRootURI);
Resource datasetTDB = ResourceFactory.createResource(TDB.namespace
+ "DatasetTDB");
model.add(baseResource, RDF.type, datasetTDB);
model.add(baseResource,
ResourceFactory.createProperty(TDB.namespace, "location"), dbPath);
model.add(datasetTDB, RDFS.subClassOf,
ResourceFactory.createResource(JA.uri + "RDFDataset"));
DatasetDesc datasetDesc = new DatasetDesc(baseResource);
datasetDesc.initialize();
Service handler = new Service(proc, serviceURI, datasetDesc);
myReg.add(serviceURI, handler);
Registry.add(RDFServer.ServiceRegistryName, myReg);
} else {
LOGGER.warn("Could not initialise Joseki, dbPath == " + dbPath);
}