[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Sat Jul 28 03:46:16 UTC 2007


gordonp
Fri Jul 27 23:46:16 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services
In directory dev.open-bio.org:/tmp/cvs-serv26982/src/main/ca/ucalgary/seahawk/services

Modified Files:
	MobyClient.java 
Log Message:
Made less verbose
moby-live/Java/src/main/ca/ucalgary/seahawk/services MobyClient.java,1.15,1.16
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java	2007/06/28 16:45:44	1.15
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/services/MobyClient.java	2007/07/28 03:46:16	1.16
@@ -586,13 +586,15 @@
     /**
      * Using the regular expression mappings that have been set up, 
      * maps a string using rules producing moby objects of the given type.
+     * @param targetDataType matches any data type if null, otherwise restricts returned items to those that are of (or inherit from) the given type
      */
     public MobyDataObject[] getMobyObjects(String textData, MobyDataType targetDataType){
 	Vector<MobyDataObject> objectVector = new Vector<MobyDataObject>();
 
 	for(Pattern pattern: regexMap.keySet()){
 	    MobyComplexBuilder rule = regexMap.get(pattern);
-	    if(rule.getDataType().inheritsFrom(targetDataType)){
+	    if(targetDataType == null ||
+	       rule.getDataType().inheritsFrom(targetDataType)){
 		Matcher matcher = pattern.matcher(textData);
 
 		while(matcher.find()){
@@ -1212,7 +1214,7 @@
 	    throw new Exception("Cannot find definition of data type "+mobyDataType+
 				" in the ontology, therefore the rule cannot be properly parsed");
 	}
-	MobyRelationship[] memberRelationships = dataType.getChildren();
+	MobyRelationship[] memberRelationships = dataType.getAllChildren();
 	
 	String newRegexp = processRegExp(regexp, membersMap);
 	Map<Integer,Boolean> captured = new HashMap<Integer,Boolean>();
@@ -1221,7 +1223,7 @@
 		String[] rule = membersMap.get(memberRelationship.getName());
 		if(rule == null){
 		    System.err.println("Skipping HAS member "+memberRelationship.getName() + 
-				       " without a rule");		    
+				       " without an explicit rule (may be defined by inheritance?)");		    
 		    continue;
 		}
 		Pattern pattern = Pattern.compile(newRegexp, Pattern.DOTALL | Pattern.COMMENTS);
@@ -1268,10 +1270,10 @@
 		} // end for(group count)
 	    }  // end if (member's relationship is HAS)
 	    else{
-		System.err.println("Relationship for member " + memberRelationship.getName() + " of "+ mobyDataType +
-				   "is *not* HAS");
+		//System.err.println("Relationship for member " + memberRelationship.getName() + " of "+ mobyDataType +
+		//		   "is *not* HAS");
 	    }
-	}  //end for(member replationships)
+	}  //end for(member relationships)
 	return newRegexp;
     }
 




More information about the MOBY-guts mailing list