[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Fri Dec 7 20:26:44 UTC 2007


gordonp
Fri Dec  7 15:26:44 EST 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory dev.open-bio.org:/tmp/cvs-serv2232/src/main/org/biomoby/shared

Modified Files:
	MobyServiceType.java 
Log Message:
Added support for base 'Service' term in the service ontology, which is the now the default if no other value is specified
moby-live/Java/src/main/org/biomoby/shared MobyServiceType.java,1.12,1.13
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyServiceType.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyServiceType.java	2007/12/06 23:40:34	1.12
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyServiceType.java	2007/12/07 20:26:44	1.13
@@ -42,6 +42,8 @@
     private static Map<String,MobyServiceType[]> servicetypesMapBySynonym = new HashMap<String,MobyServiceType[]>();
     private static Map<URL,MobyServiceType[]> servicetypesMapByURL = new HashMap<URL,MobyServiceType[]>();
 
+    public static final String UNCATEGORIZED_LABEL = "Service";
+
     public int compareTo (MobyServiceType obj) {
 	return name.compareToIgnoreCase ( obj.getName() );
     }
@@ -53,7 +55,7 @@
      * Default constructor.
      *************************************************************************/
     public MobyServiceType() {
-	this ("_dummy_");
+	this (UNCATEGORIZED_LABEL);
     }
 
     /**************************************************************************
@@ -61,7 +63,12 @@
      * wrong - therefore use 'set' method to fill them.
      *************************************************************************/
     public MobyServiceType (String typeName) {
-	setName (typeName);
+	this(typeName, null);
+    }
+    
+    public MobyServiceType (String typeName, Registry reg) {
+	setName(typeName);
+	setRegistry(reg);
     }
 
     public Registry getRegistry(){
@@ -69,7 +76,7 @@
     }
 
     public void setRegistry(Registry reg){
-	reg = registry;
+	registry = reg;
     }
  
     /**
@@ -81,7 +88,7 @@
 	    if(reg == null){
 		reg = RegistryCache.getDefaultRegistry();
 	    }
-	    
+
 	    MobyServiceType[] servicetypes;
 	    ServiceTypeParser p = new ServiceTypeParser(serviceDefURL);	    
 	    servicetypes = p.getMobyServiceTypesFromRDF();
@@ -99,8 +106,8 @@
     }
 
     public static MobyServiceType getServiceType(String className, Registry reg){
-	if(className == null){
-	    return null;
+	if(className == null || className.length() == 0 || className.equals(UNCATEGORIZED_LABEL)){
+	    return new MobyServiceType(UNCATEGORIZED_LABEL, reg);
 	}
 
 	if(reg == null){
@@ -147,7 +154,7 @@
 	}
 
 	// Wasn't found if we got to here.  For now, base "Service" type isn't in the RDF!
-	//System.err.println("Couldn't find service type " + className);
+	System.err.println("Couldn't find service type " + className);
 	return null;
     }
 
@@ -185,7 +192,13 @@
     }
 
     public MobyServiceType getParent() {
-	return getServiceType(getParentName());
+	String parentName = getParentName();
+	if(parentName.length() == 0){
+	    return null;
+	}
+	else{
+	    return getServiceType(parentName, getRegistry());
+	}
     }
 
     public MobyServiceType[] getLineage(){




More information about the MOBY-guts mailing list