6
6
import java .util .Date ;
7
7
import java .util .List ;
8
8
9
+ import org .checkerframework .checker .units .qual .t ;
10
+
9
11
import org .diskproject .server .repository .DiskRDF ;
10
12
import org .diskproject .server .util .KBCache ;
11
13
import org .diskproject .server .util .KBUtils ;
@@ -530,7 +532,7 @@ private DataQueryTemplate loadDataQueryTemplate (KBObject objTemplate) {
530
532
}
531
533
532
534
private KBObject writeDataQueryResults (DataQueryResult queryResults ) {
533
- KBObject dq = domainKB .createObjectOfClass (GUID .randomId ("dqt " ), DISKOnt .getClass (DISK .DATA_QUERY_TEMPLATE ));
535
+ KBObject dq = domainKB .createObjectOfClass (GUID .randomId ("dqr " ), DISKOnt .getClass (DISK .DATA_QUERY_RESULTS ));
534
536
KBObject qr = _writeDataQueryTemplate (queryResults , dq );
535
537
if (queryResults .getQuery () != null )
536
538
domainKB .setPropertyValue (qr , DISKOnt .getProperty (DISK .HAS_QUERY ), domainKB .createLiteral (queryResults .getQuery ()));
@@ -700,10 +702,10 @@ public List<LineOfInquiry> listLOIPreviews() {
700
702
private KBObject writeWorkflowSeed (WorkflowSeed seed , String parentId ) {
701
703
String prefix = parentId != null ? parentId + "/seeds/" : null ;
702
704
KBObject seedObj = domainKB .createObjectOfClass (prefix != null ? prefix + GUID .randomId ("" ) : null , DISKOnt .getClass (DISK .WORKFLOW_SEED ));
703
- return _writeWorkflowSeed (seed , seedObj , parentId );
705
+ return _writeWorkflowSeed (seed , seedObj );
704
706
}
705
707
706
- private KBObject _writeWorkflowSeed (WorkflowSeed seed , KBObject seedObj , String parentId ) {
708
+ private KBObject _writeWorkflowSeed (WorkflowSeed seed , KBObject seedObj ) {
707
709
if (seed .getName () != null )
708
710
domainKB .setLabel (seedObj , seed .getName ());
709
711
if (seed .getDescription () != null )
@@ -717,19 +719,19 @@ private KBObject _writeWorkflowSeed (WorkflowSeed seed, KBObject seedObj, String
717
719
if (parameters != null && parameters .size () > 0 ) {
718
720
for (VariableBinding vBinding : parameters ) {
719
721
domainKB .addPropertyValue (seedObj , DISKOnt .getProperty (DISK .HAS_PARAMETER ),
720
- writeVariableBinding (vBinding , parentId ));
722
+ writeVariableBinding (vBinding , seedObj . getID () ));
721
723
}
722
724
}
723
725
if (inputs != null && inputs .size () > 0 ) {
724
726
for (VariableBinding vBinding : inputs ) {
725
727
domainKB .addPropertyValue (seedObj , DISKOnt .getProperty (DISK .HAS_INPUT ),
726
- writeVariableBinding (vBinding , parentId ));
728
+ writeVariableBinding (vBinding , seedObj . getID () ));
727
729
}
728
730
}
729
731
if (outputs != null && outputs .size () > 0 ) {
730
732
for (VariableBinding vBinding : outputs ) {
731
733
domainKB .addPropertyValue (seedObj , DISKOnt .getProperty (DISK .HAS_OUTPUT ),
732
- writeVariableBinding (vBinding , parentId ));
734
+ writeVariableBinding (vBinding , seedObj . getID () ));
733
735
}
734
736
}
735
737
return seedObj ;
@@ -775,7 +777,8 @@ private WorkflowSeed loadWorkflowSeed (KBObject seedObj) {
775
777
private KBObject writeWorkflowInstantiation (WorkflowInstantiation inst , String parentId ) {
776
778
String prefix = parentId != null ? parentId + "/instantiations/" : null ;
777
779
KBObject seedObj = domainKB .createObjectOfClass (prefix != null ? prefix + GUID .randomId ("" ) : null , DISKOnt .getClass (DISK .WORKFLOW_INSTANTIATION ));
778
- KBObject instObj = _writeWorkflowSeed (inst , seedObj , parentId );
780
+ KBObject instObj = _writeWorkflowSeed (inst , seedObj );
781
+ String instId = instObj .getID ();
779
782
780
783
if (inst .getStatus () != null )
781
784
domainKB .setPropertyValue (instObj , DISKOnt .getClass (DISK .HAS_STATUS ), domainKB .createLiteral (getStringFromStatus (inst .getStatus ())) );
@@ -784,15 +787,15 @@ private KBObject writeWorkflowInstantiation (WorkflowInstantiation inst, String
784
787
if (data != null && data .size () > 0 ) {
785
788
for (VariableBinding vBinding : data ) {
786
789
domainKB .addPropertyValue (instObj , DISKOnt .getProperty (DISK .HAS_DATA_BINDINGS ),
787
- writeVariableBinding (vBinding , parentId ));
790
+ writeVariableBinding (vBinding , instId ));
788
791
}
789
792
}
790
793
791
794
List <Execution > execs = inst .getExecutions ();
792
795
if (execs != null && execs .size () > 0 ) {
793
796
for (Execution exec : execs ) {
794
797
domainKB .addPropertyValue (instObj , DISKOnt .getProperty (DISK .HAS_EXECUTION ),
795
- writeExecution (exec , parentId ));
798
+ writeExecution (exec , instId ));
796
799
}
797
800
}
798
801
return instObj ;
@@ -1052,7 +1055,6 @@ public boolean writeTLOI(TriggeredLOI tloi) {
1052
1055
Boolean newTLOI = tloi .getId () == null || tloi .getId ().equals ("" );
1053
1056
if (newTLOI ) tloi .setId (createTloiURI (GUID .randomId ("TriggeredLOI" )));
1054
1057
String tloiId = tloi .getId ();
1055
- //if (domainKB == null) return false;
1056
1058
1057
1059
this .rdf .startWrite ();
1058
1060
KBObject tloiItem = writeCommonResource (tloi , tloiId , DISKOnt .getClass (DISK .TRIGGERED_LINE_OF_INQUIRY ));
@@ -1112,27 +1114,27 @@ public TriggeredLOI loadTLOI(String id) {
1112
1114
KBObject status = domainKB .getPropertyValue (obj , DISKOnt .getProperty (DISK .HAS_STATUS ));
1113
1115
if (status != null )
1114
1116
tloi .setStatus (getStatusFromString (status .getValueAsString ()));
1115
- KBObject queryResult = domainKB .getPropertyValue (obj , DISKOnt .getProperty (DISK .HAS_RESULT ));
1117
+ KBObject queryResult = domainKB .getPropertyValue (obj , DISKOnt .getProperty (DISK .HAS_QUERY_RESULTS ));
1116
1118
if (queryResult != null )
1117
1119
tloi .setQueryResults (loadDataQueryResult (queryResult ));
1118
1120
1119
1121
List <KBObject > wfInst = domainKB .getPropertyValues (obj , DISKOnt .getProperty (DISK .HAS_WORKFLOW_INST ));
1120
1122
List <KBObject > mwfInst = domainKB .getPropertyValues (obj , DISKOnt .getProperty (DISK .HAS_META_WORKFLOW_INST ));
1123
+ List <WorkflowInstantiation > wfList = new ArrayList <WorkflowInstantiation >();
1124
+ List <WorkflowInstantiation > metaWfList = new ArrayList <WorkflowInstantiation >();
1121
1125
1122
1126
if (wfInst != null && wfInst .size () > 0 ) {
1123
- List <WorkflowInstantiation > list = new ArrayList <WorkflowInstantiation >();
1124
1127
for (KBObject t : wfInst ) {
1125
- list .add (loadWorkflowInstantiation (t ));
1128
+ wfList .add (loadWorkflowInstantiation (t ));
1126
1129
}
1127
- tloi .setWorkflows (list );
1128
1130
}
1129
1131
if (mwfInst != null && mwfInst .size () > 0 ) {
1130
- List <WorkflowInstantiation > list = new ArrayList <WorkflowInstantiation >();
1131
1132
for (KBObject t : mwfInst ) {
1132
- list .add (loadWorkflowInstantiation (t ));
1133
+ metaWfList .add (loadWorkflowInstantiation (t ));
1133
1134
}
1134
- tloi .setMetaWorkflows (list );
1135
1135
}
1136
+ tloi .setWorkflows (wfList );
1137
+ tloi .setMetaWorkflows (metaWfList );
1136
1138
1137
1139
this .rdf .end ();
1138
1140
return tloi ;
@@ -1167,9 +1169,11 @@ public List<TriggeredLOI> listTLOIs() {
1167
1169
List <String > ids = listObjectIdPerClass (DISKOnt .getClass (DISK .TRIGGERED_LINE_OF_INQUIRY ));
1168
1170
for (String fullId : ids ) {
1169
1171
String id = getLocalId (fullId );
1170
- list .add (this .loadTLOI (id ));
1172
+ TriggeredLOI cur = this .loadTLOI (id );
1173
+ if (cur != null ) {
1174
+ list .add (cur );
1175
+ }
1171
1176
}
1172
- //TriggeredLOI tloi = loadTLOI(username, tloiId.replaceAll("^.*\\/", ""));
1173
1177
return list ;
1174
1178
}
1175
1179
0 commit comments