[MOBY-guts] biomoby commit

Gary Schlitz gss at pub.open-bio.org
Thu Nov 4 22:21:20 UTC 2004


gss
Thu Nov  4 17:21:20 EST 2004
Update of /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools
In directory pub.open-bio.org:/tmp/cvs-serv31225/src/org/smoby/graph/tools

Modified Files:
	MOBYProviderXMLGenerator.java MOBYProviderVisitor.java 
	MOBYProviderTraverser.java 
Added Files:
	MOBYProviderVisitorAdapter.java 
Log Message:
Experimental package

moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools MOBYProviderVisitorAdapter.java,NONE,1.1 MOBYProviderXMLGenerator.java,1.1,1.2 MOBYProviderVisitor.java,1.1,1.2 MOBYProviderTraverser.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools/MOBYProviderXMLGenerator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools/MOBYProviderXMLGenerator.java	2004/07/29 23:34:45	1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools/MOBYProviderXMLGenerator.java	2004/11/04 22:21:19	1.2
@@ -1,6 +1,7 @@
 package org.smoby.graph.tools;
 
 import org.smoby.graph.*;
+
 import java.io.*;
 
 public class MOBYProviderXMLGenerator implements MOBYProviderVisitor
@@ -45,11 +46,11 @@
 	}
 	
 	public boolean visitGraphBegin(MOBYGraph graph) {
-		return start("graph", null, false);
+		return start("moby-graph", null, false);
 	}
 	
 	public void visitGraphEnd(MOBYGraph graph) {
-		end("graph");
+		end("moby-graph");
 	}
 	
 	public boolean visitHasMappingBegin(MOBYGraphNode graphNode) {
@@ -159,4 +160,18 @@
 	{
 		currentIndent -= 4;
 	}
+
+	public boolean visitSubjectPropValStmtsBegin(MOBYCollection stmts) throws MOBYProviderTraversalException {
+		return false;
+	}
+
+	public void visitSubjectPropValStmtsEnd(MOBYCollection stmts) throws MOBYProviderTraversalException {
+	}
+
+	public boolean visitSubjectPropValStmtBegin(MOBYPropertyValueStatement stmt) throws MOBYProviderTraversalException {
+		return false;
+	}
+
+	public void visitSubjectPropValStmtEnd(MOBYPropertyValueStatement stmt) throws MOBYProviderTraversalException {
+	}
 }

===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools/MOBYProviderVisitor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools/MOBYProviderVisitor.java	2004/07/29 23:34:45	1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools/MOBYProviderVisitor.java	2004/11/04 22:21:19	1.2
@@ -8,41 +8,48 @@
 	//
 	public boolean visitProviderBegin(MOBYProvider provider)
 		throws MOBYProviderTraversalException;
-	public void visitProviderEnd(MOBYProvider provider);
+	public void visitProviderEnd(MOBYProvider provider)
+		throws MOBYProviderTraversalException;
 
 	// Visitation of the collection of things the provider operates on
 	//
 	public boolean visitOperatesOnBegin(MOBYCollection subgraphs)
 		throws MOBYProviderTraversalException;
-	public void visitOperatesOnEnd(MOBYCollection subgraphs);
+	public void visitOperatesOnEnd(MOBYCollection subgraphs)
+		throws MOBYProviderTraversalException;
 	
 	// Visitation of an operatesOn subgraph
 	//
 	public boolean visitGraphBegin(MOBYGraph graph)
 		throws MOBYProviderTraversalException;
-	public void visitGraphEnd(MOBYGraph graph);
+	public void visitGraphEnd(MOBYGraph graph)
+		throws MOBYProviderTraversalException;
 	
 	// Visitation of a hasMapping
 	//
 	public boolean visitHasMappingBegin(MOBYGraphNode graphNode)
 		throws MOBYProviderTraversalException;
-	public void visitHasMappingEnd(MOBYGraphNode graphNode);
+	public void visitHasMappingEnd(MOBYGraphNode graphNode)
+		throws MOBYProviderTraversalException;
 	
 	// Visitation of a subject
 	//
 	public boolean visitSubjectBegin(MOBYSubject subject)
 		throws MOBYProviderTraversalException;
-	public void visitSubjectEnd(MOBYSubject subject);
+	public void visitSubjectEnd(MOBYSubject subject)
+		throws MOBYProviderTraversalException;
 	
 	// Visitation of a set of property value statements
 	//
-	public boolean visitPropValStmtsBegin(MOBYCollection stmts)
+	public boolean visitSubjectPropValStmtsBegin(MOBYCollection stmts)
+		throws MOBYProviderTraversalException;
+	public void visitSubjectPropValStmtsEnd(MOBYCollection stmts)
 		throws MOBYProviderTraversalException;
-	public void visitPropValStmtsEnd(MOBYCollection stmts);
 	
 	// Visitation of a given property value statement
 	//
-	public boolean visitPropValStmtBegin(MOBYPropertyValueStatement stmt)
+	public boolean visitSubjectPropValStmtBegin(MOBYPropertyValueStatement stmt)
+		throws MOBYProviderTraversalException;
+	public void visitSubjectPropValStmtEnd(MOBYPropertyValueStatement stmt)
 		throws MOBYProviderTraversalException;
-	public void visitPropValStmtEnd(MOBYPropertyValueStatement stmt);
 }

===================================================================
RCS file: /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools/MOBYProviderTraverser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools/MOBYProviderTraverser.java	2004/07/29 23:34:45	1.1
+++ /home/repository/moby/moby-live/S-MOBY/ref-impl/core/src/org/smoby/graph/tools/MOBYProviderTraverser.java	2004/11/04 22:21:19	1.2
@@ -7,6 +7,13 @@
 
 public class MOBYProviderTraverser
 {
+	public void traverse(MOBYProvider provider, MOBYProviderVisitor visitor)
+	{
+		try {
+			traverse(provider, visitor, false);
+		} catch (MOBYProviderTraversalException e) {}
+	}
+	
 	/**
 	 * Traverse the given provider, visiting its components with the
 	 * given visitor.
@@ -16,7 +23,9 @@
 	 * @return whether or not the visitor said to stop before the
 	 * entire provider graph was traversed
 	 */
-	private void traverse(MOBYProvider provider, MOBYProviderVisitor visitor)
+	public void traverse(MOBYProvider provider, MOBYProviderVisitor visitor,
+			             boolean rethrowExceptions)
+		throws MOBYProviderTraversalException
 	{
 		try
 		{
@@ -54,7 +63,12 @@
 		}
 		// Visitors indicate that traversal should stop by throwing
 		// provider traversal exceptions.
-		catch (MOBYProviderTraversalException e) {}
+		catch (MOBYProviderTraversalException e)
+		{
+			if (rethrowExceptions) {
+				throw e;
+			}
+		}
 	}
 	
 	/**
@@ -96,7 +110,7 @@
 			if (keepGoing)
 			{
 				MOBYCollection coll = subject.getPropertyValueStatements();
-				keepGoing = visitor.visitPropValStmtsBegin(coll);
+				keepGoing = visitor.visitSubjectPropValStmtsBegin(coll);
 				if (keepGoing)
 				{
 					Iterator it = subject.getPropertyValueStatements().iterator();
@@ -104,12 +118,12 @@
 					{
 						MOBYPropertyValueStatement stmt =
 							(MOBYPropertyValueStatement) it.next();
-						if (visitor.visitPropValStmtBegin(stmt)) {
-							visitor.visitPropValStmtEnd(stmt);
+						if (visitor.visitSubjectPropValStmtBegin(stmt)) {
+							visitor.visitSubjectPropValStmtEnd(stmt);
 						}
 					}
 				}
-				visitor.visitPropValStmtsEnd(coll);
+				visitor.visitSubjectPropValStmtsEnd(coll);
 			}
 			
 			if (keepGoing)
@@ -140,15 +154,15 @@
 		return keepGoing;
 	}
 	
-	public static void main(String[] args) throws Exception
-	{
-		File f = new File("get-individuals.n3");
-		Parser parser = Parser.forN3File(f);
-		MOBYProvider provider = parser.parseProvider();
-		
-		MOBYProviderTraverser traverser = new MOBYProviderTraverser();
-		MOBYProviderXMLGenerator printer = new MOBYProviderXMLGenerator();
-		
-		traverser.traverse(provider, printer);
-	}
+//	public static void main(String[] args) throws Exception
+//	{
+//		File f = new File("get-individuals.n3");
+//		Parser parser = Parser.forN3File(f);
+//		MOBYProvider provider = parser.parseProvider();
+//		
+//		MOBYProviderTraverser traverser = new MOBYProviderTraverser();
+//		MOBYProviderXMLGenerator printer = new MOBYProviderXMLGenerator();
+//		
+//		traverser.traverse(provider, printer);
+//	}
 }




More information about the MOBY-guts mailing list