|
@@ -1,7 +1,5 @@
|
|
|
package ua.be.wee.model.repository;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
-
|
|
|
import org.apache.jena.query.QueryExecution;
|
|
|
import org.apache.jena.query.ResultSet;
|
|
|
import org.apache.jena.rdfconnection.RDFConnectionFuseki;
|
|
@@ -18,7 +16,13 @@ public class FusekiWrapper {
|
|
|
|
|
|
private String serviceURI;
|
|
|
|
|
|
+
|
|
|
+ public String getServiceURI() {
|
|
|
+ return serviceURI;
|
|
|
+ }
|
|
|
+
|
|
|
private FusekiWrapper() {
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public static FusekiWrapper getInstance() {
|
|
@@ -62,53 +66,6 @@ public class FusekiWrapper {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-//
|
|
|
-// private static void uploadRDF(File rdf, String serviceURI)
|
|
|
-// throws IOException {
|
|
|
-//
|
|
|
-// // parse the file
|
|
|
-// Model m = ModelFactory.createDefaultModel();
|
|
|
-// try (FileInputStream in = new FileInputStream(rdf)) {
|
|
|
-// m.read(in, null, "RDF/XML");
|
|
|
-// }
|
|
|
-//
|
|
|
-// // upload the resulting model
|
|
|
-//// DatasetAccessor accessor = DatasetAccessorFactory
|
|
|
-//// .createHTTP(serviceURI);
|
|
|
-//// accessor.putModel(m);
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// private static void execSelectAndPrint(String serviceURI, String queryStr) {
|
|
|
-//
|
|
|
-// QueryExecution q = QueryExecutionFactory.sparqlService(serviceURI,
|
|
|
-// queryStr);
|
|
|
-// ResultSet results = q.execSelect();
|
|
|
-//
|
|
|
-// ResultSetFormatter.out(System.out, results);
|
|
|
-//
|
|
|
-// while (results.hasNext()) {
|
|
|
-// QuerySolution soln = results.nextSolution();
|
|
|
-// RDFNode x = soln.get("?pm");
|
|
|
-// System.out.println(x);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// private static void execSelectAndProcess(String serviceURI, String query) {
|
|
|
-// QueryExecution q = QueryExecutionFactory.sparqlService(serviceURI,
|
|
|
-// query);
|
|
|
-// ResultSet results = q.execSelect();
|
|
|
-//
|
|
|
-// while (results.hasNext()) {
|
|
|
-// QuerySolution soln = results.nextSolution();
|
|
|
-// // assumes that you have an "?x" in your query
|
|
|
-// RDFNode x = soln.get("x");
|
|
|
-// System.out.println(x);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
public boolean testEndpoint() {
|
|
|
String query = "PREFIX pm: <http://ua.be/sdo2l/vocabulary/formalisms/pm#>\n"
|
|
|
+ "SELECT ?pm WHERE {\n"
|
|
@@ -123,27 +80,4 @@ public class FusekiWrapper {
|
|
|
}
|
|
|
return execSelect.hasNext();
|
|
|
}
|
|
|
-
|
|
|
- public static void main(String[] argv) throws IOException {
|
|
|
- // uploadRDF(new File("test.rdf"), );
|
|
|
-// execSelectAndPrint(
|
|
|
-// "http://localhost:3030/Drivetrain",
|
|
|
-// "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
|
|
|
-// + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
|
|
|
-// + "PREFIX wf: <http://ua.be/sdo2l/vocabulary/workflow#>\n"
|
|
|
-// + "SELECT ?pm ?nodes WHERE {\n"
|
|
|
-// + " ?pm a wf:Workflow .\n"
|
|
|
-// + " ?pm wf:coordinates ?nodes .\n"
|
|
|
-// + "}");
|
|
|
-
|
|
|
-// execSelectAndProcess(
|
|
|
-// "http://localhost:3030/Drivetrain",
|
|
|
-// "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
|
|
|
-// + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
|
|
|
-// + "PREFIX wf: <http://ua.be/sdo2l/vocabulary/workflow#>\n"
|
|
|
-// + "SELECT ?pm ?nodes WHERE {\n"
|
|
|
-// + " ?pm a wf:Workflow .\n"
|
|
|
-// + " ?pm wf:coordinates ?nodes .\n"
|
|
|
-// + "}");
|
|
|
- }
|
|
|
}
|