[MOBY-l] Datatype queries on central registry with jmoby API

Michael DiBernardo mikedebo at gmail.com
Tue Jun 12 21:58:47 UTC 2007


Hello all,

I'm working on a project where I'd like to be able to

(a) Get the definitions of all services from the registry
(b) Examine the inputs and outputs for each service
(c) Get a list of all _subclasses_ and all _children_ (i.e. types of  
which the type is composed) of the input and output parameter types.

Using the jmoby API, I do roughly the following as a stripped-down test:

		CentralDigestCachedImpl digest = new CentralDigestCachedImpl("/tmp");
		MobyService[] services = digest.getServices();
				
		for (int i = 0; i < 100; i++) {
			MobyService example = services[i];
			System.out.println(example.getName());
			
			// Just fetch the first output for now as a test.			
			MobyPrimaryData output1 = (example.getPrimaryOutputs())[0];
			System.out.println("Output is " + output1.getName());			
			
			MobyDataType type = output1.getDataType();
			MobyRelationship[] children = type.getAllChildren();
			System.out.println("Data type has " + children.length + "  
relationships.");
			
			for (MobyRelationship child : children) {
				System.out.println(child);
			}
		}

Note that I am doing this just to get the types of which the output  
type is composed. However, in each case the number of children  
returned by the getAllChildren call is 0. A similar thing happens if  
I request the names of the parent types of any of the input or output  
data types; 0 parents are returned. I can't even find a way of  
getting the _subclasses_ of a type, since there doesn't appear to be  
a getAllSubclasses() call on MobyType, just a getParents().

I wrote my own utility class that uses Jena to parse the Object  
ontology RDF to fetch the parents of any type, and I could do the  
same in order to get all of the components of any type, but I'd  
rather not dodge the API if I don't have to. Does anyone have any  
idea why the types of the parameters returned by the getPrimaryInputs/ 
getPrimaryOutputs calls aren't being completely populated? Also, does  
anyone have any suggestions of a nonhacky way to find the _subclass_  
of a given type as easily as one can find its superclass?

It seems to me that fetching the subclasses of a type would be a far  
more common operation than examining parents, because if you're  
writing any kind of software to orchestrate calls to MOBY services  
and you require an input to be of type T, you'd also want to admit  
any subclasses of type T as well. The parent classes, on the other  
hand, are irrelevant in this context. So basically I assume that this  
is possible and I'm just too stupid to figure it out.

Pointers would be appreciated!

-Mike



More information about the moby-l mailing list