|
@@ -21,10 +21,10 @@ public class PTRepository {
|
|
|
int index = getNextIndex(pm);
|
|
|
String traceiri = pm.getIri().split("#")[0] + "/traces#pt_" + index;
|
|
|
String query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
|
|
|
- + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/base/processtraces#>\n"
|
|
|
+ + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#>\n"
|
|
|
+ "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ "INSERT DATA {\n"
|
|
|
- + " <"+ traceiri + "> rdf:type <http://ua.be/sdo2l/vocabulary/base/processtraces#Event> , <http://ua.be/sdo2l/vocabulary/base/processtraces#StartTraceEvent> , owl:Thing , <http://ua.be/sdo2l/vocabulary/base/acyclic#element> , <http://ua.be/sdo2l/vocabulary/base/processtraces#element> ;\n"
|
|
|
+ + " <"+ traceiri + "> rdf:type <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#Event> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#StartTraceEvent> , owl:Thing , <http://ua.be/sdo2l/vocabulary/base/acyclic#element> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#element> ;\n"
|
|
|
+ " tr:relatesTo <" + pm.getIri() + "> ;\n"
|
|
|
+ " owl:sameAs <" + traceiri + "> .\n"
|
|
|
+ "}";
|
|
@@ -43,7 +43,7 @@ public class PTRepository {
|
|
|
|
|
|
private int getNextIndex(PM pm) {
|
|
|
int index = 0;
|
|
|
- String query = "PREFIX tr: <http://ua.be/sdo2l/vocabulary/base/processtraces#>\n"
|
|
|
+ String query = "PREFIX tr: <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#>\n"
|
|
|
+ "SELECT ?pt WHERE {\n"
|
|
|
+ " ?pt a tr:StartTraceEvent ;\n"
|
|
|
+ " tr:relatesTo <" + pm.getIri() + "> .\n"
|
|
@@ -65,11 +65,11 @@ public class PTRepository {
|
|
|
String preiri = pt.getLastEvent() != null ? pt.getLastEvent().getIri() : pt.getIri();
|
|
|
String portiri = act.getCtrlInPorts().get(0).getIri(); //TODO: change it later to consider multiple input ports
|
|
|
String query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
|
|
|
- + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/base/processtraces#>\n"
|
|
|
+ + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#>\n"
|
|
|
+ "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ "PREFIX base: <http://ua.be/sdo2l/vocabulary/base/acyclic#>\n"
|
|
|
+ "INSERT DATA {\n"
|
|
|
- + " <" + iri + "> rdf:type <http://ua.be/sdo2l/vocabulary/base/processtraces#StartActivityEvent> , <http://ua.be/sdo2l/vocabulary/base/processtraces#element> , <http://ua.be/sdo2l/vocabulary/base/processtraces#Event> , owl:Thing , <http://ua.be/sdo2l/vocabulary/base/acyclic#element> ;\n"
|
|
|
+ + " <" + iri + "> rdf:type <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#StartActivityEvent> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#element> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#Event> , owl:Thing , <http://ua.be/sdo2l/vocabulary/base/acyclic#element> ;\n"
|
|
|
+ " base:acyclicForward <" + endiri + "> ;\n"
|
|
|
+ " tr:isFollowedBy <" + endiri + "> ;\n"
|
|
|
+ " tr:isPrecededBy <" + preiri + "> ;\n"
|
|
@@ -96,7 +96,7 @@ public class PTRepository {
|
|
|
transitive = transitive.substring(0, transitive.length()-1);
|
|
|
|
|
|
String query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
|
|
|
- + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/base/processtraces#>\n"
|
|
|
+ + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#>\n"
|
|
|
+ "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ "PREFIX base: <http://ua.be/sdo2l/vocabulary/base/acyclic#>\n"
|
|
|
+ "DELETE { ?pt ?p ?v . }\n"
|
|
@@ -106,7 +106,7 @@ public class PTRepository {
|
|
|
+ " ?pt ?p ?v .\n"
|
|
|
+ "};\n"
|
|
|
+ "INSERT DATA {\n"
|
|
|
- + " <" + pt.getIri() + "> rdf:type <http://ua.be/sdo2l/vocabulary/base/processtraces#Event> , <http://ua.be/sdo2l/vocabulary/base/processtraces#StartTraceEvent> , owl:Thing , <http://ua.be/sdo2l/vocabulary/base/acyclic#element> , <http://ua.be/sdo2l/vocabulary/base/processtraces#element> ;\n"
|
|
|
+ + " <" + pt.getIri() + "> rdf:type <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#Event> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#StartTraceEvent> , owl:Thing , <http://ua.be/sdo2l/vocabulary/base/acyclic#element> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#element> ;\n"
|
|
|
+ " base:acyclicForward <" + pt.getEvents().get(0).getIri() + "> ;\n"
|
|
|
+ " base:transitiveForward "+ transitive + " ;\n"
|
|
|
+ " tr:isFollowedBy <" + pt.getEvents().get(0).getIri() + "> ;\n"
|
|
@@ -137,16 +137,49 @@ public class PTRepository {
|
|
|
String startiri = pt.getIri().replace('#', '/') + "#" + "start_activity" + index;
|
|
|
String endiri = pt.getIri().replace('#', '/') + "#" + "end_activity" + index;
|
|
|
|
|
|
+ List<String> artifactsIRI = new ArrayList<String>();
|
|
|
+ for (Artifact art : arts) {
|
|
|
+ String artifactIRI = pt.getIri().replace('#', '/') + "#" + art.getGUID();
|
|
|
+ artifactsIRI.add(artifactIRI);
|
|
|
+ String query = "PREFIX pt: <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#>\n"
|
|
|
+ + "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
|
|
|
+ + "PREFIX base: <http://ua.be/sdo2l/vocabulary/base/base#>\n"
|
|
|
+ + "INSERT DATA { \n"
|
|
|
+ + " <" + artifactIRI + "> rdf:type base:Versionable , pt:Artifact , owl:Thing , pt:element , base:ImmutableThing ;\n"
|
|
|
+ + " base:hasGUID \"" + art.getGUID() + "\" ;\n"
|
|
|
+ + " base:hasTag \"" + art.getTag() + "\" ;\n"
|
|
|
+ + " pt:hasLocation \"" + art.getLocation() + "\" ;\n"
|
|
|
+ //+ " pt:isConsumedBy <http://ua.be/sdo2l/description/traces/my_pt#start_activity1> ;\n"
|
|
|
+ //+ " pt:isModel <http://ua.be/sdo2l/description/artifacts/my_xopp#model> ;\n"
|
|
|
+ + " pt:isProducedBy <" + endiri + "> ;\n"
|
|
|
+ + " pt:relatesTo <" + art.getIri() + "> ;\n"
|
|
|
+ + " owl:sameAs <" + artifactIRI + "> .\n"
|
|
|
+ + "}";
|
|
|
+ if (FusekiWrapper.getInstance().updateQuery(query) ) {
|
|
|
+ artifactsIRI.add(artifactIRI);
|
|
|
+ } else {
|
|
|
+ throw new Exception("Error inserting data.");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
String query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
|
|
|
- + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/base/processtraces#>\n"
|
|
|
+ + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#>\n"
|
|
|
+ "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ "PREFIX base: <http://ua.be/sdo2l/vocabulary/base/acyclic#>\n"
|
|
|
+ "INSERT DATA {\n"
|
|
|
- + " <" + endiri + "> rdf:type <http://ua.be/sdo2l/vocabulary/base/processtraces#StartActivityEvent> , <http://ua.be/sdo2l/vocabulary/base/processtraces#element> , <http://ua.be/sdo2l/vocabulary/base/processtraces#Event> , owl:Thing , <http://ua.be/sdo2l/vocabulary/base/acyclic#element> ;\n"
|
|
|
+ + " <" + endiri + "> rdf:type <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#StartActivityEvent> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#element> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#Event> , owl:Thing , <http://ua.be/sdo2l/vocabulary/base/acyclic#element> ;\n"
|
|
|
+ " tr:isPrecededBy <" + startiri + "> ;\n"
|
|
|
- + " tr:relatesTo <" + p.getIri() + "> ;\n"
|
|
|
- + " owl:sameAs <" + endiri + "> .\n"
|
|
|
+ + " tr:relatesTo <" + p.getIri() + "> ;\n";
|
|
|
+
|
|
|
+ for (String iri : artifactsIRI) {
|
|
|
+ query += " tr:produces <" + iri + "> ;\n" ;
|
|
|
+ }
|
|
|
+ query += " owl:sameAs <" + endiri + "> .\n"
|
|
|
+ "}";
|
|
|
+
|
|
|
if (FusekiWrapper.getInstance().updateQuery(query) ) {
|
|
|
EndActivityEvent ev = new EndActivityEvent();
|
|
|
ev.setIri(endiri);
|
|
@@ -157,15 +190,17 @@ public class PTRepository {
|
|
|
throw new Exception("Error inserting data.");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public Event createEndTraceEvent(String ptIRI, String previous, String pmIRI) throws Exception {
|
|
|
String traceiri = ptIRI + "_end";
|
|
|
String query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
|
|
|
- + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/base/processtraces#>\n"
|
|
|
+ + "PREFIX tr: <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#>\n"
|
|
|
+ "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ "INSERT DATA {\n"
|
|
|
- + " <"+ traceiri + "> rdf:type <http://ua.be/sdo2l/vocabulary/base/acyclic#element> , <http://ua.be/sdo2l/vocabulary/base/processtraces#EndTraceEvent> , <http://ua.be/sdo2l/vocabulary/base/processtraces#Event> , <http://ua.be/sdo2l/vocabulary/base/processtraces#element> , owl:Thing ;\n"
|
|
|
+ + " <"+ traceiri + "> rdf:type <http://ua.be/sdo2l/vocabulary/base/acyclic#element> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#EndTraceEvent> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#Event> , <http://ua.be/sdo2l/vocabulary/formalisms/processtraces#element> , owl:Thing ;\n"
|
|
|
+ " tr:isPrecededBy <" + previous + "> ;\n"
|
|
|
+ " tr:relatesTo <" + pmIRI + "> ;\n"
|
|
|
+ " owl:sameAs <" + traceiri + "> .\n"
|