[MOBY-guts] biomoby commit

senger@ebi.ac.uk senger at pub.open-bio.org
Sat Nov 8 00:27:24 UTC 2003


senger
Fri Nov  7 19:27:24 EST 2003
Update of /home/repository/moby/moby-live/Java/src/Clients
In directory pub.open-bio.org:/tmp/cvs-serv17161/src/Clients

Modified Files:
	MobyGraphs.java 
Added Files:
	EchoClient.java EchoClient2.java 
Log Message:
added graphs for exploring biomoby registry

moby-live/Java/src/Clients EchoClient.java,NONE,1.1 EchoClient2.java,NONE,1.1 MobyGraphs.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java	2003/10/17 13:13:34	1.1
+++ /home/repository/moby/moby-live/Java/src/Clients/MobyGraphs.java	2003/11/08 00:27:24	1.2
@@ -50,7 +50,7 @@
 
 	    BaseCmdLine cmd = new BaseCmdLine (args, true);
 	    if (cmd.hasParam ("-help") || cmd.hasParam ("-h")) {
-		System.out.print (MobyCmdLineClient.getUsage());
+		System.out.print (MobyGraphs.getUsage());
 		System.exit (0);
 	    }
 
@@ -127,10 +127,41 @@
 		services = new MobyService [v.size()];
 		v.copyInto (services);
 
-		// create a graph
+		// create a set of graph edges
 		decorationLn ("Creating a graph of the services...");
 		ServicesEdge[] edges = ServiceConnections.build (dataTypes, services);
-		String graph = Graphviz.createServicesGraph (edges, props);
+
+		// filter edges
+		String[] authorities = null;
+		String[] serviceNames = null;
+		int depth = 1;
+                if ((param = cmd.getParam ("-auth")) != null )
+		    authorities = StringUtils.split (param, ",");
+                if ((param = cmd.getParam ("-name")) != null )
+		    serviceNames = StringUtils.split (param, ",");
+		param = cmd.getParam ("-depth");
+		if (param != null) {
+		    try {
+			depth = Integer.valueOf (param).intValue();
+		    } catch (java.lang.NumberFormatException e) {}
+		}		
+		edges = FilterServices.filter (edges, authorities, serviceNames, depth);
+
+		String[] pathEnds = cmd.getParam ("-path", 2);
+		if (pathEnds.length == 2)
+		    edges = FilterServices.pathes (edges, pathEnds[0], pathEnds[1]);
+		if (edges == null) {
+		    System.err.println ("No connection found between '" +
+					pathEnds[0] + "' and '" + pathEnds[1] + "'");
+		    System.exit(1);
+		}
+
+		// create a graph (in whatever format)
+		String graph;
+		if (cmd.hasOption ("-rdf"))
+		    graph = RDF.createServicesGraph (edges, props);
+		else
+		    graph = Graphviz.createServicesGraph (edges, props);
 
 		// output the graph
 		param = cmd.getParam ("-fs");




More information about the MOBY-guts mailing list