|
@@ -12,9 +12,8 @@ import org.springframework.stereotype.Repository;
|
|
|
import ua.be.wee.model.nodes.Activity;
|
|
|
import ua.be.wee.model.nodes.Artifact;
|
|
|
import ua.be.wee.model.nodes.FinalNode;
|
|
|
-import ua.be.wee.model.nodes.ForkNode;
|
|
|
+import ua.be.wee.model.nodes.ForkJoinNode;
|
|
|
import ua.be.wee.model.nodes.InitialNode;
|
|
|
-import ua.be.wee.model.nodes.JoinNode;
|
|
|
import ua.be.wee.model.nodes.Node;
|
|
|
import ua.be.wee.model.nodes.ports.ControlInputPort;
|
|
|
import ua.be.wee.model.nodes.ports.ControlOutputPort;
|
|
@@ -38,7 +37,7 @@ public class NodeRespository {
|
|
|
+ "PREFIX ob: <http://ua.be/sdo2l/vocabulary/formalisms/object_diagram#>\n"
|
|
|
+ "SELECT ?node ?nodetype WHERE {\n" + " ?pm a pm:Model ;\n" + " ob:hasName ?pmName ;\n"
|
|
|
+ " owl:sameAs <" + pm.getIri() + "> ;\n" + " ob:hasObject ?node .\n" + " ?node a ?nodetype .\n"
|
|
|
- + " FILTER (?nodetype in (pm:Initial, pm:Activity, pm:Final, pm:Join, pm:Fork, pm:Artifact)) . \n"
|
|
|
+ + " FILTER (?nodetype in (pm:Initial, pm:Activity, pm:Final, pm:ForkJoin, pm:Artifact)) . \n"
|
|
|
+ "}";
|
|
|
ResultSet results = FusekiWrapper.getInstance().execQuery(query);
|
|
|
while (results.hasNext()) {
|
|
@@ -64,83 +63,25 @@ public class NodeRespository {
|
|
|
updateInitialNode(nodes, (InitialNode) node);
|
|
|
} else if (node instanceof FinalNode) {
|
|
|
updateFinalNode(nodes, (FinalNode) node);
|
|
|
- } else if (node instanceof ForkNode) {
|
|
|
- updateForkNode(nodes, (ForkNode) node);
|
|
|
- } else if (node instanceof JoinNode) {
|
|
|
- updateJoinNode(nodes, (JoinNode) node);
|
|
|
+ } else if (node instanceof ForkJoinNode) {
|
|
|
+ updateForkJoinNode(nodes, (ForkJoinNode) node);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void updateJoinNode(List<Node> nodes, JoinNode node) {
|
|
|
- String query = "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
- + "PREFIX pm: <http://ua.be/sdo2l/vocabulary/formalisms/pm#>\n" + "SELECT ?next ?nodetype ?act\n"
|
|
|
- + "WHERE { \n" + " ?node owl:sameAs<" + node.getIri() + ">.\n" + " ?node pm:ctrlTo ?next.\n"
|
|
|
- + " ?next a ?nodetype ;\n"
|
|
|
- + " FILTER (?nodetype in (pm:CtrlOutputPort, pm:Initial, pm:Final,pm:Fork, pm:Join)) \n"
|
|
|
- + " OPTIONAL {\n" + " ?next pm:ofActivity ?act .\n" + " }\n" + "}";
|
|
|
- List<Node> list = new ArrayList<Node>();
|
|
|
- ResultSet results = FusekiWrapper.getInstance().execQuery(query);
|
|
|
- while (results.hasNext()) {
|
|
|
- QuerySolution soln = results.nextSolution();
|
|
|
- RDFNode type = soln.get("?nodetype");
|
|
|
- String nextIri;
|
|
|
- if (type.toString().equals(Node.CTRL_OUTPUT_PORT_IRI)) {
|
|
|
- nextIri = soln.get("?act").toString();
|
|
|
- } else {
|
|
|
- nextIri = soln.get("?next").toString();
|
|
|
- }
|
|
|
- for (Node node2 : nodes) {
|
|
|
- if (node2.getIri().equals(nextIri)) {
|
|
|
- list.add(node2);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- node.setPreviousNodes(list);
|
|
|
-
|
|
|
-
|
|
|
- query = "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
- + "PREFIX pm: <http://ua.be/sdo2l/vocabulary/formalisms/pm#>\n"
|
|
|
- + "SELECT ?next ?nodetype ?act\n"
|
|
|
- + "WHERE { \n" + " ?node owl:sameAs<" + node.getIri() + ">.\n"
|
|
|
- + " ?node pm:ctrlFrom ?next.\n"
|
|
|
- + " ?next a ?nodetype ;\n"
|
|
|
- + " FILTER (?nodetype in (pm:CtrlOutputPort,pm:Fork, pm:Join, pm:Initial)) \n"
|
|
|
- + " OPTIONAL {\n"
|
|
|
- + " ?next pm:ofActivity ?act .\n" + " }\n" + "}";
|
|
|
- results = FusekiWrapper.getInstance().execQuery(query);
|
|
|
- while (results.hasNext()) {
|
|
|
- QuerySolution soln = results.nextSolution();
|
|
|
- RDFNode type = soln.get("?nodetype");
|
|
|
- String nextIri;
|
|
|
- if (type.toString().equals(Node.CTRL_OUTPUT_PORT_IRI)) {
|
|
|
- nextIri = soln.get("?act").toString();
|
|
|
- } else {
|
|
|
- nextIri = soln.get("?next").toString();
|
|
|
- }
|
|
|
- for (Node node2 : nodes) {
|
|
|
- if (node2.getIri().equals(nextIri)) {
|
|
|
- node.setNext(node2);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private void updateForkNode(List<Node> nodes, ForkNode node) {
|
|
|
+ private void updateForkJoinNode(List<Node> nodes, ForkJoinNode node) {
|
|
|
String query = "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ "PREFIX pm: <http://ua.be/sdo2l/vocabulary/formalisms/pm#>\n"
|
|
|
+ "SELECT ?next ?nodetype ?act\n"
|
|
|
+ "WHERE { \n" + " ?node owl:sameAs<" + node.getIri() + ">.\n"
|
|
|
+ " ?node pm:ctrlFrom ?next.\n"
|
|
|
+ " ?next a ?nodetype ;\n"
|
|
|
- + " FILTER (?nodetype in (pm:CtrlOutputPort,pm:Fork, pm:Join, pm:Initial)) \n"
|
|
|
+ + " FILTER (?nodetype in (pm:CtrlOutputPort,pm:ForkJoin, pm:Initial)) \n"
|
|
|
+ " OPTIONAL {\n"
|
|
|
+ " ?next pm:ofActivity ?act .\n" + " }\n" + "}";
|
|
|
ResultSet results = FusekiWrapper.getInstance().execQuery(query);
|
|
|
+ List<Node> list = new ArrayList<Node>();
|
|
|
while (results.hasNext()) {
|
|
|
QuerySolution soln = results.nextSolution();
|
|
|
RDFNode type = soln.get("?nodetype");
|
|
@@ -152,19 +93,19 @@ public class NodeRespository {
|
|
|
}
|
|
|
for (Node node2 : nodes) {
|
|
|
if (node2.getIri().equals(nextIri)) {
|
|
|
- node.setPrevious(node2);
|
|
|
- break;
|
|
|
+ list.add(node2);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ node.setPrevious(list);
|
|
|
|
|
|
query = "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ "PREFIX pm: <http://ua.be/sdo2l/vocabulary/formalisms/pm#>\n" + "SELECT ?next ?nodetype ?act\n"
|
|
|
+ "WHERE { \n" + " ?node owl:sameAs<" + node.getIri() + ">.\n" + " ?node pm:ctrlTo ?next.\n"
|
|
|
+ " ?next a ?nodetype ;\n"
|
|
|
- + " FILTER (?nodetype in (pm:CtrlInputPort, pm:Initial, pm:Final,pm:Fork, pm:Join)) \n"
|
|
|
+ + " FILTER (?nodetype in (pm:CtrlInputPort, pm:Initial, pm:Final,pm:ForkJoin)) \n"
|
|
|
+ " OPTIONAL {\n" + " ?next pm:ofActivity ?act .\n" + " }\n" + "}";
|
|
|
- List<Node> list = new ArrayList<Node>();
|
|
|
+ list.clear();
|
|
|
results = FusekiWrapper.getInstance().execQuery(query);
|
|
|
while (results.hasNext()) {
|
|
|
QuerySolution soln = results.nextSolution();
|
|
@@ -190,7 +131,7 @@ public class NodeRespository {
|
|
|
+ "PREFIX pm: <http://ua.be/sdo2l/vocabulary/formalisms/pm#>\n" + "SELECT ?next ?nodetype ?act\n"
|
|
|
+ "WHERE { \n" + " ?node owl:sameAs<" + node.getIri() + ">.\n" + " ?node pm:ctrlFrom ?next.\n"
|
|
|
+ " ?next a ?nodetype ;\n"
|
|
|
- + " FILTER (?nodetype in (pm:CtrlOutputPort, pm:Initial, pm:Final,pm:Fork, pm:Join)) \n"
|
|
|
+ + " FILTER (?nodetype in (pm:CtrlOutputPort, pm:Initial, pm:Final,pm:ForkJoin)) \n"
|
|
|
+ " OPTIONAL {\n" + " ?next pm:ofActivity ?act .\n" + " }\n" + "}";
|
|
|
List<Node> list = new ArrayList<Node>();
|
|
|
ResultSet results = FusekiWrapper.getInstance().execQuery(query);
|
|
@@ -216,7 +157,7 @@ public class NodeRespository {
|
|
|
String query = "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
|
|
|
+ "PREFIX pm: <http://ua.be/sdo2l/vocabulary/formalisms/pm#>\n" + "SELECT ?next ?nodetype ?act\n"
|
|
|
+ "WHERE { \n" + " ?node owl:sameAs<" + node.getIri() + ">.\n" + " ?node pm:ctrlTo ?next.\n"
|
|
|
- + " ?next a ?nodetype ;\n" + " FILTER (?nodetype in (pm:CtrlInputPort, pm:Final,pm:Fork, pm:Join)) \n"
|
|
|
+ + " ?next a ?nodetype ;\n" + " FILTER (?nodetype in (pm:CtrlInputPort, pm:Final,pm:ForkJoin)) \n"
|
|
|
+ " OPTIONAL {\n" + " ?next pm:ofActivity ?act .\n" + " }\n" + "}";
|
|
|
ResultSet results = FusekiWrapper.getInstance().execQuery(query);
|
|
|
while (results.hasNext()) {
|
|
@@ -297,7 +238,7 @@ public class NodeRespository {
|
|
|
break;
|
|
|
case Node.FORKJOIN_IRI:
|
|
|
// addlogic for fork join
|
|
|
- node = new JoinNode();
|
|
|
+ node = new ForkJoinNode();
|
|
|
break;
|
|
|
case Node.ARTIFACT_IRI:
|
|
|
// addlogic for fork join
|