[MOBY-guts] biomoby commit
Martin Senger
senger at pub.open-bio.org
Tue Jul 19 12:39:58 UTC 2005
senger
Tue Jul 19 08:39:58 EDT 2005
Update of /home/repository/moby/moby-live/Java/src/Clients
In directory pub.open-bio.org:/tmp/cvs-serv19358/src/Clients
Modified Files:
MobyCmdLineClient.java MobyGraphs.java
Log Message:
moby-live/Java/src/Clients MobyCmdLineClient.java,1.8,1.9 MobyGraphs.java,1.7,1.8
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/MobyCmdLineClient.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- /home/repository/moby/moby-live/Java/src/Clients/MobyCmdLineClient.java 2004/12/05 22:28:02 1.8
+++ /home/repository/moby/moby-live/Java/src/Clients/MobyCmdLineClient.java 2005/07/19 12:39:58 1.9
@@ -95,12 +95,29 @@
if (cmd.hasOption ("-ls")) {
decorationLn ("Service names:");
decorationLn ("--------------");
- Map names = worker.getServiceNames();
+ Map authorities = worker.getServiceNamesByAuthority();
- for (Iterator it = names.entrySet().iterator(); it.hasNext(); ) {
+ for (Iterator it = authorities.entrySet().iterator(); it.hasNext(); ) {
+ Map.Entry entry = (Map.Entry)it.next();
+ String[] names = (String[])entry.getValue();
+ for (int i = 0; i < names.length; i++) {
+ System.out.println (names[i]);
+ System.out.println ("\t" + entry.getKey());
+ }
+ }
+ }
+
+ if (cmd.hasOption ("-la")) {
+ decorationLn ("Service names by authorities:");
+ decorationLn ("-----------------------------");
+ Map authorities = worker.getServiceNamesByAuthority();
+
+ for (Iterator it = authorities.entrySet().iterator(); it.hasNext(); ) {
Map.Entry entry = (Map.Entry)it.next();
System.out.println (entry.getKey());
- System.out.println ("\t" + entry.getValue());
+ String[] names = (String[])entry.getValue();
+ for (int i = 0; i < names.length; i++)
+ System.out.println ("\t" + names[i]);
}
}
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java 2004/11/12 23:09:02 1.7
+++ /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java 2005/07/19 12:39:58 1.8
@@ -126,7 +126,55 @@
decorationLn ("Retrieving services...");
MobyService[] services = worker.getServices();
decorationLn ("Creating a graph of the services...");
- ServicesEdge[] edges = ServiceConnections.build (dataTypes, services);
+ ServicesEdge[] edges = null;
+ DataServiceEdge[] debugStartingEdges = null;
+ DataServiceEdge[] debugEndingEdges = null;
+
+ // an undocumented option for debugging (see an
+ // example file in 'data' directory)
+ String xfile = cmd.getParam ("-X");
+ boolean xfileing = (xfile != null);
+
+ if (xfileing) {
+ Vector ev = new Vector();
+ Vector evs = new Vector();
+ Vector eve = new Vector();
+ String line;
+ BufferedReader data = null;
+ data = new BufferedReader
+ (new InputStreamReader (new FileInputStream (xfile)));
+ while ((line = data.readLine()) != null) {
+ if (line.trim().equals ("")) continue;
+ if (line.trim().startsWith ("#")) continue;
+ String[] fields = StringUtils.split (line);
+ if (fields.length > 1) {
+ if (fields[0].equalsIgnoreCase ("start")) {
+ DataServiceEdge dse = new DataServiceEdge (new MobyDataType ("start"),
+ new MobyService (fields[1]),
+ "");
+ evs.addElement (dse);
+ } else if (fields[1].equalsIgnoreCase ("end")) {
+ DataServiceEdge dse = new DataServiceEdge (new MobyService (fields[0]),
+ new MobyDataType ("end"),
+ "");
+ eve.addElement (dse);
+ } else ev.addElement (new ServicesEdge (new MobyService (fields[0]),
+ new MobyService (fields[1]),
+ ""));
+ }
+ }
+ edges = new ServicesEdge[ev.size()];
+ ev.copyInto (edges);
+ debugStartingEdges = new DataServiceEdge[evs.size()];
+ evs.copyInto (debugStartingEdges);
+ debugEndingEdges = new DataServiceEdge[eve.size()];
+ eve.copyInto (debugEndingEdges);
+
+ } else {
+ edges = ServiceConnections.build (dataTypes, services);
+ }
+
+ System.out.println ("EDGES: " + edges.length);
// filter edges
String[] authorities = null;
@@ -144,13 +192,23 @@
}
edges = FilterServices.filter (edges, authorities, serviceNames, depth);
+ System.out.println ("Filtered EDGES: " + edges.length);
+
+ if (xfileing) {
+ System.out.println ("List of EDGES: ");
+ for (int i = 0; i < edges.length; i++) {
+ System.out.println ("\t" + edges[i].toString());
+ }
+ }
+
if (cmd.hasParam ("-path")) {
String[] pathEnds = cmd.getParam ("-path", 2);
if (pathEnds[0] == null || pathEnds[1] == null) {
System.err.println ("Missing value for parameter '-path'. It should be followed by two service names.");
System.exit (1);
}
- edges = FilterServices.pathes (edges, pathEnds[0], pathEnds[1]);
+// edges = FilterServices.pathes (edges, pathEnds[0], pathEnds[1]);
+ edges = FilterServices.pathes2 (edges, pathEnds[0], pathEnds[1]);
if (edges == null) {
System.err.println ("No connection found between '" +
pathEnds[0] + "' and '" + pathEnds[1] + "'");
@@ -170,20 +228,62 @@
MobyPrimaryDataSimple sourceData = createSimpleData (pathEnds[0]);
MobyPrimaryDataSimple targetData = createSimpleData (pathEnds[1]);
- DataServiceEdge[] startingEdges = ServiceConnections.findStartingEdges (sourceData, dataTypes, services);
- DataServiceEdge[] endingEdges = ServiceConnections.findEndingEdges (targetData, dataTypes, services);
+ DataServiceEdge[] startingEdges = null;
+ if (debugStartingEdges == null)
+ startingEdges = ServiceConnections.findStartingEdges (sourceData, dataTypes, services);
+ else
+ startingEdges = debugStartingEdges;
+ DataServiceEdge[] endingEdges = null;
+ if (debugEndingEdges == null)
+ endingEdges = ServiceConnections.findEndingEdges (targetData, dataTypes, services);
+ else
+ endingEdges = debugEndingEdges;
+
+ System.out.println ("SE: " + startingEdges.length);
+ if (xfileing) {
+ for (int i = 0; i < startingEdges.length; i++) {
+ System.out.println ("\t" + startingEdges[i].toString());
+ }
+ }
+ System.out.println ("EE: " + endingEdges.length);
+ if (xfileing) {
+ for (int i = 0; i < endingEdges.length; i++) {
+ System.out.println ("\t" + endingEdges[i].toString());
+ }
+ }
// this creates *all* pathes, but some of them have cycles and inside branches
- separatePaths = FilterServices.dataPaths (startingEdges, edges, endingEdges);
+ separatePaths = FilterServices.dataPaths (startingEdges, edges, endingEdges);
if (separatePaths.length == 0) {
System.err.println ("No connection found between '" +
pathEnds[0] + "' and '" + pathEnds[1] + "'");
System.exit(1);
}
+
+ System.out.println ("After dataPaths: " + separatePaths.length);
+ if (xfileing) {
+ for (int i = 0; i < separatePaths.length; i++) {
+ System.out.println ("Separate data path " + (i+1));
+ for (int j = 0; j < separatePaths[i].length; j++) {
+ System.out.println ("\t" + separatePaths[i][j]);
+ }
+ }
+ }
+
allPaths = FilterServices.joinPaths (separatePaths);
+ System.out.println ("After joinPaths: " + allPaths.length);
+ if (xfileing) {
+ System.out.println ("Join paths: ");
+ for (int i = 0; i < allPaths.length; i++) {
+ System.out.println ("\t" + allPaths[i].toString());
+ }
+ }
+
+ // separate paths to straight paths (no cycles, no branches)
+ separatePaths = FilterServices.straightDataPaths (startingEdges, allPaths, endingEdges);
- // this separate paths to straight paths (no cycles, no branches)
- separatePaths = FilterServices.straightDataPaths (startingEdges, allPaths, endingEdges);
+ System.out.println ("After straightDataPaths: " + separatePaths.length);
+// System.exit (1);
}
// create a graph (in whatever format)
@@ -236,7 +336,7 @@
} else {
graphs = new String [1];
- graphs[0] = Graphviz.createServicesGraph (allPaths, props);
+ graphs[0] = Graphviz.createServicesGraph (allPaths, props);
}
String fn = cmd.getParam ("-fs");
More information about the MOBY-guts
mailing list