[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Sun Apr 18 00:23:42 UTC 2010
gordonp
Sat Apr 17 20:23:42 EDT 2010
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util
In directory dev.open-bio.org:/tmp/cvs-serv27510/src/main/ca/ucalgary/seahawk/util
Modified Files:
DataFlowRecorder.java
Log Message:
Fixed so no problem when original data comes from the clipboard, or a saved moby xml file
moby-live/Java/src/main/ca/ucalgary/seahawk/util DataFlowRecorder.java,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/DataFlowRecorder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/DataFlowRecorder.java 2010/04/16 17:33:26 1.5
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/DataFlowRecorder.java 2010/04/18 00:23:42 1.6
@@ -342,6 +342,7 @@
// true means treat as a collection if that's what the sample data is
String sinkPortName = getPortName(sampleData, true);
+ // No user data means non-moby origin...backtracking stops.
if(data != null && data.length != 0){
URL dataSrcURL = null;
try{
@@ -351,6 +352,16 @@
"a provenance URL as expected URL (" + sampleData.getUserData().toString() + ")");
continue;
}
+
+ // If srcService == null, the input source for this param was a Moby doc that wasn't a
+ // service output, e.g. the clipboard or an old doc loaded from file.
+ MobyService srcService = DataUtils.getService(dataSrcURL);
+ if(srcService == null){
+ addWorkflowInput(processorName, condPassProcessorAndPorts, sinkPortName, sampleData,
+ datalinks, processors, inputPorts, doc);
+ continue;
+ }
+
// recursion for workflow creation by backtracking service input provenance
String feedingProcessorName = null;
String feedingProcessorPort = null;
@@ -429,52 +440,57 @@
}
// Otherwise it's a workflow input the user will need to specify
else{
- // pName is editable name for input processor target...
- // allows injection of condition without affecting method's return value
- String pName = processorName;
- if(condPassProcessorAndPorts != null){
- // inject condition filter between data creator and current service
- datalinks.appendChild(createDataLinkElement(condPassProcessorAndPorts[0],
- condPassProcessorAndPorts[2],
- pName,
- sinkPortName,
- doc));
- pName = condPassProcessorAndPorts[0];
- sinkPortName = condPassProcessorAndPorts[1];
- }
- // The sample data may be used in more than one branch of the flow...avoid duplication
- // Get the real data XML, to see if we've encountered it before as input (it'd be in the hash)
- // Remember that sd is the loop's original MobyDataInstance before it's been coerced into a MobyPrimaryData,
- // which doesn't have XML modes, etc.
- String inputKey = getInputKey(sd);
- // System.err.println("Input key for " + processorName + " is " + inputKey);
-
- String[] mobifyingProcessorNameAndPorts = null;
- if(input2Processor.containsKey(inputKey)){
- mobifyingProcessorNameAndPorts = input2Processor.get(inputKey);
- }
- else{
- if(sampleData.getDataType().getName().equals(MobyTags.MOBYOBJECT)){
- mobifyingProcessorNameAndPorts = addIdMobifyingProcessor(processors, datalinks, inputPorts,
- sampleData, doc);
- input2Processor.put(inputKey, mobifyingProcessorNameAndPorts);
- }
- else{
- // TODO: Need to build complex input from MOB rule or spreadsheet fields?
- }
- }
- // link the created data to the workflow service
- datalinks.appendChild(createDataLinkElement(mobifyingProcessorNameAndPorts[0],
- mobifyingProcessorNameAndPorts[1],
- pName, sinkPortName,
- doc));
+ addWorkflowInput(processorName, condPassProcessorAndPorts, sinkPortName, sampleData,
+ datalinks, processors, inputPorts, doc);
}
-
}
return processorName;
}
+ private void addWorkflowInput(String pName, String[] condPassProcessorAndPorts, String sinkPortName,
+ MobyPrimaryData sampleData, Element datalinks, Element processors,
+ Element inputPorts, Document doc) throws Exception{
+ // pName is editable name for input processor target...
+ // allows injection of condition without affecting method's return value
+ if(condPassProcessorAndPorts != null){
+ // inject condition filter between data creator and current service
+ datalinks.appendChild(createDataLinkElement(condPassProcessorAndPorts[0],
+ condPassProcessorAndPorts[2],
+ pName,
+ sinkPortName,
+ doc));
+ pName = condPassProcessorAndPorts[0];
+ sinkPortName = condPassProcessorAndPorts[1];
+ }
+ // The sample data may be used in more than one branch of the flow...avoid duplication
+ // Get the real data XML, to see if we've encountered it before as input (it'd be in the hash)
+ // Remember that sd is the loop's original MobyDataInstance before it's been coerced into a MobyPrimaryData,
+ // which doesn't have XML modes, etc.
+ String inputKey = getInputKey((MobyDataInstance) sampleData);
+ // System.err.println("Input key for " + processorName + " is " + inputKey);
+
+ String[] mobifyingProcessorNameAndPorts = null;
+ if(input2Processor.containsKey(inputKey)){
+ mobifyingProcessorNameAndPorts = input2Processor.get(inputKey);
+ }
+ else{
+ if(sampleData.getDataType().getName().equals(MobyTags.MOBYOBJECT)){
+ mobifyingProcessorNameAndPorts = addIdMobifyingProcessor(processors, datalinks, inputPorts,
+ sampleData, doc);
+ input2Processor.put(inputKey, mobifyingProcessorNameAndPorts);
+ }
+ else{
+ // TODO: Need to build complex input from MOB rule or spreadsheet fields?
+ }
+ }
+ // link the created data to the workflow service
+ datalinks.appendChild(createDataLinkElement(mobifyingProcessorNameAndPorts[0],
+ mobifyingProcessorNameAndPorts[1],
+ pName, sinkPortName,
+ doc));
+ }
+
// returns the same value for moby sample data instances containing the same data in XML form
private String getInputKey(MobyDataInstance sd){
int oldXmlMode = sd.getXmlMode();
More information about the MOBY-guts
mailing list