Skip to content

Commit

Permalink
seperated graphs/cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
langens-jonathan committed Sep 4, 2016
1 parent 103c46e commit d151f98
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
prefix mu:<http://mu.semte.ch/vocabularies/core/>
prefix foaf:<http://xmlns.com/foaf/0.1/>
prefix graphs:<http://mu.semte.ch/vocabularies/graphs/>

insert
{
Expand All @@ -16,6 +17,7 @@ a <mu:Graph>.
<mu:graphType> "personal";
a <mu:Graph>.


<http://mu.semte.ch/graphs/graph1> <mu:uuid> "GRAPH1";
<foaf:name> "Graph 1";
<mu:graphType> "hive";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public String calculateGraphToQuery()
}
}

String clearMetaInfoQuery = "WITH <http://mu.semte.ch/application>\n DELETE\n{\n";
clearMetaInfoQuery += "?user <http://mu.semte.ch/vocabularies/core/hasInstanceGraph> ?uuid .\n";
clearMetaInfoQuery += "?uuid <http://mu.semte.ch/vocabularies/core/hasGraph> ?gname .\n}";
String clearMetaInfoQuery = "WITH <http://mu.semte.ch/instances>\n DELETE\n{\n";
clearMetaInfoQuery += "?user <http://mu.semte.ch/vocabularies/graphs/hasInstanceGraph> ?uuid .\n";
clearMetaInfoQuery += "?uuid <http://mu.semte.ch/vocabularies/graphs/hasGraph> ?gname .\n}";
clearMetaInfoQuery += "WHERE\n{\n?user <http://mu.semte.ch/vocabularies/core/uuid> \"" + this.name + "\" .\n}";
try {
SPARQLService.getInstance().postSPARQLResponse(SPARQLService.getLocalURL(), clearMetaInfoQuery);
Expand All @@ -105,9 +105,9 @@ public String calculateGraphToQuery()
}

String UUID = java.util.UUID.randomUUID().toString();
String setMetaInfoQuery = "WITH <http://mu.semte.ch/application>\n INSERT\n{\n";
setMetaInfoQuery += "?user <http://mu.semte.ch/vocabularies/core/hasInstanceGraph> <http://mu.semte.ch/vocabularies/core/InstanceGraph/" + UUID + "> .\n";
setMetaInfoQuery += "<http://mu.semte.ch/vocabularies/core/InstanceGraph/" + UUID + "> <http://mu.semte.ch/vocabularies/core/hasGraph> \"" + instanceGraph + "\".\n}";
String setMetaInfoQuery = "WITH <http://mu.semte.ch/instances>\n INSERT\n{\n";
setMetaInfoQuery += "?user <http://mu.semte.ch/vocabularies/graphs/hasInstanceGraph> <http://mu.semte.ch/vocabularies/graphs/InstanceGraph/" + UUID + "> .\n";
setMetaInfoQuery += "<http://mu.semte.ch/vocabularies/graphs/InstanceGraph/" + UUID + "> <http://mu.semte.ch/vocabularies/graphs/hasGraph> \"" + instanceGraph + "\".\n}";
setMetaInfoQuery += "WHERE\n{\n?user <http://mu.semte.ch/vocabularies/core/uuid> \"" + this.name + "\" .\n}";
try {
SPARQLService.getInstance().postSPARQLResponse(SPARQLService.getLocalURL(), setMetaInfoQuery);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package scopes_service.query_pre_processor.Scopes;

import com.tenforce.semtech.SPARQLParser.SPARQL.SPARQLQuery;
import org.openrdf.model.vocabulary.SP;
import scopes_service.query_pre_processor.query.SPARQLService;

Expand All @@ -14,7 +15,7 @@
public class ScopeNode {
private String name;
private String UUID = java.util.UUID.randomUUID().toString();
private String query = "select * from { ?s ?p ?o .}";
private String query = "";
private ScopeNode parent;
private int scopeNodeType;
private List<ScopeNode> children = new ArrayList<ScopeNode>();
Expand Down Expand Up @@ -103,6 +104,19 @@ public String calculateScopes()
}
}

// performing the scope's query, if it exists
if(this.query != null && !this.query.isEmpty())
{
try {
SPARQLQuery query = new SPARQLQuery(this.query);
query.setGraph(instanceGraph);
SPARQLService.getInstance().postSPARQLResponse(SPARQLService.getLocalURL(), query.constructQuery());
} catch(Exception e)
{
e.printStackTrace();
}
}

// adding my own inserts
String pullInInsertsQuery = "INSERT\n{\n GRAPH <" + instanceGraph + ">\n {\n ?s ?p ?o .\n }\n}";
pullInInsertsQuery += "WHERE\n{\n GRAPH <" + getInsertName(this.getUUID()) + ">\n {\n ?s ?p ?o.\n }\n}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,6 @@ public static String getLocalURL()
if(System.getenv("SPARQLENDPOINT") != null && !System.getenv("SPARQLENDPOINT").isEmpty())
return System.getenv("SPARQLENDPOINT");
else
return "http://localhost/sparql";
return "http://localhost:8890/sparql";
}
}
Loading

0 comments on commit d151f98

Please sign in to comment.