diff --git a/insert-this-into-your-store-or-none-of-this-shit-will-work.txt b/insert-this-into-your-store-or-none-of-this-shit-will-work.txt
index 3ec2d63..c17cb6b 100644
--- a/insert-this-into-your-store-or-none-of-this-shit-will-work.txt
+++ b/insert-this-into-your-store-or-none-of-this-shit-will-work.txt
@@ -1,5 +1,6 @@
prefix mu:
prefix foaf:
+prefix graphs:
insert
{
@@ -16,6 +17,7 @@ a .
"personal";
a .
+
"GRAPH1";
"Graph 1";
"hive";
diff --git a/src/main/java/scopes_service/query_pre_processor/Scopes/Scope.java b/src/main/java/scopes_service/query_pre_processor/Scopes/Scope.java
index 76811a1..ec05021 100644
--- a/src/main/java/scopes_service/query_pre_processor/Scopes/Scope.java
+++ b/src/main/java/scopes_service/query_pre_processor/Scopes/Scope.java
@@ -94,9 +94,9 @@ public String calculateGraphToQuery()
}
}
- String clearMetaInfoQuery = "WITH \n DELETE\n{\n";
- clearMetaInfoQuery += "?user ?uuid .\n";
- clearMetaInfoQuery += "?uuid ?gname .\n}";
+ String clearMetaInfoQuery = "WITH \n DELETE\n{\n";
+ clearMetaInfoQuery += "?user ?uuid .\n";
+ clearMetaInfoQuery += "?uuid ?gname .\n}";
clearMetaInfoQuery += "WHERE\n{\n?user \"" + this.name + "\" .\n}";
try {
SPARQLService.getInstance().postSPARQLResponse(SPARQLService.getLocalURL(), clearMetaInfoQuery);
@@ -105,9 +105,9 @@ public String calculateGraphToQuery()
}
String UUID = java.util.UUID.randomUUID().toString();
- String setMetaInfoQuery = "WITH \n INSERT\n{\n";
- setMetaInfoQuery += "?user .\n";
- setMetaInfoQuery += " \"" + instanceGraph + "\".\n}";
+ String setMetaInfoQuery = "WITH \n INSERT\n{\n";
+ setMetaInfoQuery += "?user .\n";
+ setMetaInfoQuery += " \"" + instanceGraph + "\".\n}";
setMetaInfoQuery += "WHERE\n{\n?user \"" + this.name + "\" .\n}";
try {
SPARQLService.getInstance().postSPARQLResponse(SPARQLService.getLocalURL(), setMetaInfoQuery);
diff --git a/src/main/java/scopes_service/query_pre_processor/Scopes/ScopeNode.java b/src/main/java/scopes_service/query_pre_processor/Scopes/ScopeNode.java
index 49c02ca..c26efc2 100644
--- a/src/main/java/scopes_service/query_pre_processor/Scopes/ScopeNode.java
+++ b/src/main/java/scopes_service/query_pre_processor/Scopes/ScopeNode.java
@@ -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;
@@ -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 children = new ArrayList();
@@ -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}";
diff --git a/src/main/java/scopes_service/query_pre_processor/query/SPARQLService.java b/src/main/java/scopes_service/query_pre_processor/query/SPARQLService.java
index 81e32d0..f5f3cd2 100644
--- a/src/main/java/scopes_service/query_pre_processor/query/SPARQLService.java
+++ b/src/main/java/scopes_service/query_pre_processor/query/SPARQLService.java
@@ -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";
}
}
\ No newline at end of file
diff --git a/src/main/java/scopes_service/query_pre_processor/web/RootController.java b/src/main/java/scopes_service/query_pre_processor/web/RootController.java
index bdfa844..e468b5b 100644
--- a/src/main/java/scopes_service/query_pre_processor/web/RootController.java
+++ b/src/main/java/scopes_service/query_pre_processor/web/RootController.java
@@ -6,14 +6,11 @@
import scopes_service.query_pre_processor.Scopes.Scope;
import scopes_service.query_pre_processor.Scopes.ScopeNode;
import scopes_service.query_pre_processor.callback.CallBackService;
-import scopes_service.query_pre_processor.callback.CallBackSetNotFoundException;
-import scopes_service.query_pre_processor.query.DifferenceTriples;
import scopes_service.query_pre_processor.query.QueryService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
-import scopes_service.query_pre_processor.query.Triple;
-
+import scopes_service.query_pre_processor.query.SPARQLService;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
@@ -49,6 +46,208 @@ public void init()
this.localSPARQLURL = System.getenv("SPARQLENDPOINT");
}
+ @RequestMapping(value="/users", method = RequestMethod.GET)
+ public ResponseEntity getGraphUserSettings()
+ {
+ Map graphUuids = new HashMap();
+ List userUuids = new ArrayList();
+
+ try
+ {
+ String graphsJSON = SPARQLService.getInstance().getSPARQLResponse(SPARQLService.getLocalURL() +
+ "?query=" + URLEncoder.encode("SELECT ?uuid ?name FROM WHERE {" +
+ "?uri a . ?uri ?uuid ." +
+ "?uri ?name .}", "UTF-8"));
+
+
+ ObjectMapper mapper = new ObjectMapper();
+ Map jsonMap = mapper.readValue(graphsJSON, Map.class);
+ Map nodeMap = new HashMap();
+
+ List l = ((List