Version: 1.1.1

org.biomoby.shared
Class MobyObjectDecompositionImpl

java.lang.Object
  extended by org.biomoby.shared.MobyObjectDecompositionImpl
All Implemented Interfaces:
MobyObjectDecomposition

public class MobyObjectDecompositionImpl
extends Object
implements MobyObjectDecomposition

Author:
Eddie Kawas

Note: if you are using this class with java 1.4.x, use the Endorsed Standards Override Mechanism to over-ride org.w3c.dom. Place the Xerces-J jars in the \lib\endorsed directory, where is where the runtime software is installed. This class behaves well with java 1.5.0.

For questions, comments, or bugs

email me at edward.kawas@gmail.com


Constructor Summary
MobyObjectDecompositionImpl()
           
 
Method Summary
 Object clone()
           
 MobyDataObject createPrimitiveType(String localName, String articleName)
           
 MobyDataObject[] getFlattenedPrims(String object)
          PRE:None.
 Map getObjectComposition(String name, String endpoint)
          PRE:None.
static String getTextContent(Node parent)
          Method to simulate DOM level 3 (Java 1.5 default) method for recursively getting text children from a Node.
static String getTextContent(Node parent, boolean includeChildrensText)
          Grabs the text and CDATA children of a Node (not necessairly contiguous) and returns them concatenated.
 boolean isPrimitive(String object)
          PRE:None.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MobyObjectDecompositionImpl

public MobyObjectDecompositionImpl()
Method Detail

getFlattenedPrims

public final MobyDataObject[] getFlattenedPrims(String object)
Description copied from interface: MobyObjectDecomposition
PRE:None.

POST:If object is a valid MOBY object, then all of the primitives in the objects HAS and HASA containers are returned as an array of strings.

Specified by:
getFlattenedPrims in interface MobyObjectDecomposition
Parameters:
object - - the object to flatten into its primitives.
Returns:
- the full decomposition of an object into its primitives.

getTextContent

public static String getTextContent(Node parent)
Method to simulate DOM level 3 (Java 1.5 default) method for recursively getting text children from a Node. A wrapper around getTextContent(Node, boolean) with boolean = true, since DOM 3 getTextContent() ignores things that match Text.isContentElementWhitespace().


getTextContent

public static String getTextContent(Node parent,
                                    boolean includeChildrensText)
Grabs the text and CDATA children of a Node (not necessairly contiguous) and returns them concatenated. Added by Paul Gordon. Simulates ignoring of DOM 3 Text.isContentElementWhitespace() fully, I *think*.

Parameters:
parent - the node who's text children should be concatenated
includeChildrensText - if true, recursively appends children's text depth first
Returns:
non-normalized text contents of the passed-in Node, and its children if so requested

getObjectComposition

public final Map getObjectComposition(String name,
                                      String endpoint)
                               throws MobyException
Description copied from interface: MobyObjectDecomposition
PRE:None.

POST:A Map of relationships with the keys being "isa", "has", and "hasa". The values are string arrays or null if no relationship exists.

Specified by:
getObjectComposition in interface MobyObjectDecomposition
Parameters:
name - - the object to decompose into its HAS & HASA container objects.
Returns:
- A Map of relationships with the keys being "isa", "has", and "hasa". The values are string arrays consisting of [object,articleName], for has and hasa relationships, or null if no relationship exists.
Throws:
MobyException - - if no such object exists in the MOBY ontology.

isPrimitive

public final boolean isPrimitive(String object)
Description copied from interface: MobyObjectDecomposition
PRE:None.

POST:if object is a primitive, boolean true is returned, otherwise false is returned.

Specified by:
isPrimitive in interface MobyObjectDecomposition
Parameters:
object - - the MOBY object to check.
Returns:
true if object is a primitive, false otherwise.

createPrimitiveType

public final MobyDataObject createPrimitiveType(String localName,
                                                String articleName)

clone

public final Object clone()
                   throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

main

public static void main(String[] args)
                 throws MobyException
Throws:
MobyException

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010