@@ -66,7 +66,7 @@ public class DiskRepository extends WriteKBRepository {
6666 static DiskRepository singleton ;
6767 private static boolean creatingKB = false ;
6868
69- private static SimpleDateFormat dateformatter = new SimpleDateFormat ("yyyy-MM-dd'T'HH:mm:ssX " );
69+ private static SimpleDateFormat dateformatter = new SimpleDateFormat ("HH:mm:ss yyyy-MM-dd" );
7070 Pattern varPattern = Pattern .compile ("\\ ?(.+?)\\ b" );
7171 Pattern varCollPattern = Pattern .compile ("\\ [\\ s*\\ ?(.+?)\\ s*\\ ]" );
7272
@@ -525,6 +525,14 @@ public Hypothesis addHypothesis (String username, Hypothesis hypothesis) {
525525 String name = hypothesis .getName ();
526526 String desc = hypothesis .getDescription ();
527527 String question = hypothesis .getQuestion ();
528+ String dateCreated = hypothesis .getDateCreated ();
529+ if (dateCreated == null || dateCreated .equals ("" )) {
530+ //SET DATE
531+ hypothesis .setDateCreated (dateformatter .format (new Date ()));
532+ } else {
533+ //Update date
534+ hypothesis .setDateModified (dateformatter .format (new Date ()));
535+ }
528536 if (name != null && desc != null && question != null && !name .equals ("" ) && !desc .equals ("" ) && !question .equals ("" )) {
529537 String id = hypothesis .getId ();
530538 if (id == null || id .equals ("" )) // Create new Hypothesis ID
@@ -577,6 +585,14 @@ public LineOfInquiry addLOI(String username, LineOfInquiry loi) {
577585 String name = loi .getName ();
578586 String desc = loi .getDescription ();
579587 String question = loi .getQuestion ();
588+ String dateCreated = loi .getDateCreated ();
589+ if (dateCreated == null || dateCreated .equals ("" )) {
590+ //SET DATE
591+ loi .setDateCreated (dateformatter .format (new Date ()));
592+ } else {
593+ //Update date
594+ loi .setDateModified (dateformatter .format (new Date ()));
595+ }
580596 if (name != null && desc != null && question != null &&
581597 !name .equals ("" ) && !desc .equals ("" ) && !question .equals ("" ) &&
582598 writeLOI (username , loi )
@@ -1137,6 +1153,7 @@ public List<TriggeredLOI> queryHypothesis(String username, String id) {
11371153 tloi .setMetaWorkflows (
11381154 this .getTLOIBindings (username , loi .getMetaWorkflows (), dataVarBindings , endpoint ));
11391155 tloi .setDataQuery (dq );
1156+ tloi .setDateCreated (dateformatter .format (new Date ()));
11401157 tloi .setRelevantVariables (loi .getRelevantVariables ());
11411158 tloi .setExplanation (loi .getExplanation ());
11421159 tlois .add (tloi );
@@ -1554,7 +1571,6 @@ public void deleteAssertion(String username, Graph assertion) {
15541571
15551572 public Map <String , String > getNarratives (String username , String tloid ) {
15561573 Map <String ,String > narratives = new HashMap <String , String >();
1557- //if (true) return narratives;
15581574 TriggeredLOI tloi = this .getTriggeredLOI (username , tloid );
15591575 if (tloi != null ) {
15601576 String hypId = tloi .getParentHypothesisId ();
@@ -1594,7 +1610,6 @@ public Map<String, String> getNarratives (String username, String tloid) {
15941610 len = ds .getBindingAsArray ().length > len ? ds .getBindingAsArray ().length : len ;
15951611 }
15961612 if (allCollections ) {
1597- //dataset += "<table>";
15981613 dataset += "<table><thead><tr><td><b>#</b></td>" ;
15991614 for (VariableBinding ds : wf .getBindings ()) {
16001615 dataset += "<td><b>" + ds .getVariable () + "</b></td>" ;
@@ -1636,6 +1651,11 @@ public Map<String, String> getNarratives (String username, String tloid) {
16361651
16371652 String pval = df .format (confidence );
16381653 //Execution narratives
1654+ //String executionTemplate = "The Hypothesis with title: <b>${HYP.NAME}</b> was runned <span class=\"${TLOI.STATUS}\">${TLOI.STATUS}</span>"
1655+ // + "with the Line of Inquiry: <b>${LOI.NAME}"</b>."
1656+ // + "The LOI triggered the <a target=\"_blank\" href="{WF.getWorkflowLink()}">workflow on WINGS</a>"
1657+ // + " where it was tested with the following datasets:<div class=\"data-list\"><ol> ${[WF.getInputFiles]}"
1658+ // + "</ol></div>The resulting p-value is $(tloi.pval).";
16391659 String execution = "The Hypothesis with title: <b>" + hyp .getName ()
16401660 + "</b> was runned <span class=\" " + tloi .getStatus () + "\" >"
16411661 + tloi .getStatus () + "</span>"
@@ -1751,8 +1771,7 @@ public List<TriggeredLOI> runHypothesisAndLOI (String username, String hypid, St
17511771 //Set basic metadata
17521772 tloi .setAuthor ("System" );
17531773 Date date = new Date ();
1754- SimpleDateFormat formatter = new SimpleDateFormat ("HH:mm:ss yyyy-MM-dd" );
1755- tloi .setDateCreated (formatter .format (date ));
1774+ tloi .setDateCreated (dateformatter .format (date ));
17561775 addTriggeredLOI (username , tloi );
17571776 //match = tloi;
17581777 break ;
0 commit comments