ResourceID drerId = new ResourceID("DataRequestExecutionResource");
ServerProxy serverProxy = new ServerProxy();
serverProxy.setDefaultBaseServicesURL(serverBaseUrl);
DataRequestExecutionResource drer = serverProxy
.getDataRequestExecutionResource(drerId);
// Create the activities
String SPARQLquery;
// SPARQLquery = "PREFIX p: <http://dbpedia.org/property/>" +
// " SELECT ?film1 ?actor1 ?film2 ?actor2 " +
// "WHERE {" +
// " ?film1 p:starring <http://dbpedia.org/resource/Kevin_Bacon> ." +
// " ?film1 p:starring ?actor1 . ?film2 p:starring ?actor1 ." +
// " ?film2 p:starring ?actor2 . }";
// SPARQLquery =
// "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
// "PREFIX type: <http://dbpedia.org/class/yago/> " +
// "PREFIX prop: <http://dbpedia.org/property/> " +
// "SELECT ?country_name ?population " +
// "WHERE {" +
// " ?country a type:LandlockedCountries ;" +
// " rdfs:label ?country_name ;" +
// " prop:populationEstimate ?population ." +
// "FILTER (?population < 15000000) . }";
SPARQLquery = "PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> "
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
+ "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> "
+ "PREFIX p: <http://dbpedia.org/property/> "
+ "SELECT ?s ?a ?homepage "
+
// "FROM <http://dbpedia.org> " +
"WHERE {"
+ " <http://dbpedia.org/resource/New_York_City> geo:lat ?nyLat ."
+ " <http://dbpedia.org/resource/New_York_City> geo:long ?nyLong ."
+ " ?s geo:lat ?lat ."
+ " ?s geo:long ?long ."
+ " ?s p:architect ?a ."
+ " ?a foaf:homepage ?homepage ."
+ " FILTER ( ?lat <= ?nyLat + 0.3190235436 &&"
+ " ?long >= ?nyLong - 0.8679199218 &&"
+ " ?lat >= ?nyLat - 0.3190235436 &&"
+ " ?long <= ?nyLong + 0.8679199218) }";
SPARQLquery = "SELECT ?p ?o " +
// "FROM <http://dbpedia.org> " +
"WHERE { <http://dbpedia.org/resource/Metropolitan_Museum_of_Art> ?p ?o }";
SPARQLquery = "PREFIX p: <http://dbpedia.org/property/> "
+ "SELECT ?artist ?artwork ?museum ?director "
+ "WHERE {" + " ?artwork p:artist ?artist ."
+ " ?artwork p:museum ?museum ."
+ " ?museum p:director ?director }";
// SPARQLquery =
// "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
// "PREFIX foaf: <http://xmlns.com/foaf/0.1/> " +
// "SELECT ?x ?name " +
// "WHERE {" +
// // " ?x rdf:type foaf:Person ." +
// " ?x foaf:name ?name ." +
// " }";
SPARQLquery = "PREFIX p: <http://dbpedia.org/property/> "
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"
+ "SELECT * WHERE {"
+ " ?album p:artist <http://dbpedia.org/resource/The_Allman_Brothers_Band>."
+ " OPTIONAL {?album p:released ?dateofrelease}. }";
SPARQLquery = "PREFIX mo: <http://purl.org/ontology/mo/>"
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
+ "SELECT ?a ?name ?hp " + "WHERE { "
+ " ?a foaf:name ?name ."
+ " OPTIONAL { ?a foaf:homepage ?hp } " + "}";
SPARQLquery = " SELECT COUNT(*) "
+ "WHERE "
+ " { ?player <http://dbpedia.org/property/currentclub> ?club .} ";
// SPARQLquery =
// "SELECT ?player ?club " +
// "WHERE {" +
// " ?player <http://dbpedia.org/property/currentclub> ?club }";
SPARQLquery = "SELECT ?player "
+ "WHERE"
+ " { ?player <http://dbpedia.org/property/cityofbirth> <http://dbpedia.org/resource/Stryn> .}";
SPARQLquery = "SELECT ?player ?club "
+ "WHERE"
+ " { ?player <http://dbpedia.org/property/currentclub> ?club .}";
SPARQLquery = "select * where { ?s ?p ?o . } LIMIT 1000 ";
SPARQLquery = "PREFIX dmi: <http://www.admire-project.eu/ontologies/CRISP-DMIOntology.owl#> "
+ "SELECT DISTINCT * "
+ "WHERE {"
+ " ?x dmi:hasStructuralType ?y ."
+ " ?y dmi:hasInput ?z . "
+ " ?y dmi:hasOutput ?k . } ORDER BY ?x ";
SPARQLquery = "select * where {<http://bio2rdf.org/iproclass:Q8KD2> <http://bio2rdf.org/ns/iproclass#xGeneid> ?gene .}";
SPARQLquery = "PREFIX dmi: <http://www.admire-project.eu/ontologies/CRISP-DMIOntology.owl#> "
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
+ "SELECT ?x ?y "
+ "WHERE { ?x dmi:hasInput ?y . "
+ "?y rdf:type dmi:SQLSentence .}";
RDFActivity rdfActivity = new RDFActivity(SPARQLquery);
DeliverToRequestStatus deliverToRequestStatus = new DeliverToRequestStatus();
TupleToWebRowSetCharArrays tupleToWebRowSet = new TupleToWebRowSetCharArrays();
tupleToWebRowSet.connectDataInput(rdfActivity.getDataOutput());
// Connect the output of RDFResource to DeliverToRequestStatus
deliverToRequestStatus.connectInput(tupleToWebRowSet.getResultOutput());
// Create the workflow
PipelineWorkflow pipeline = new PipelineWorkflow();
pipeline.add(rdfActivity);
pipeline.add(tupleToWebRowSet);
pipeline.add(deliverToRequestStatus);
// Excecute the workflow
RequestResource req = null;
try
{
req = drer.execute(pipeline, RequestExecutionType.SYNCHRONOUS);
}
catch (RequestExecutionException e)
{
System.out.println("There was an error executing the workflow");
System.out.println(e.getRequestResource().getRequestStatus());