org.openanzo.jastor.inference
Class OntologyClass

java.lang.Object
  extended by org.openanzo.jastor.inference.OntologyClass

public class OntologyClass
extends java.lang.Object

This class is a wrapper for an ontology class. Most of the time, the containing ontology class is a name classes but occasionally, instances are internally used as place holders for restrictions.

Author:
Ben Szekely ( bhszekel@us.ibm.com )

Constructor Summary
OntologyClass(Class ontClass, JastorContext ctx)
          Construct an OntologyClass wrapper around the given org.openanzo.owl.Class.
OntologyClass(JastorContext ctx)
          Construct a new OntologyClass to represent a Thing.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 Restriction findCardinalityRestrictionInSubClassHierarchy(OntologyProperty prop)
          Finds a cardinality restriction in sub-class hierarchy for the given property.
 OntologyComment getComment()
          Get the comment for this class
 JastorContext getContext()
          Get the context for this ontology
 java.lang.String getFactoryClassname()
          Get the classname for this class's parent factory
 java.io.File getFactoryFile(java.io.File baseDir)
          Get the file for this class's parent factory
 java.lang.String getFactoryFullClassname()
          Get the full classname for this class's parent factory
 java.lang.String getImplClassname()
          Get the classname for this class's implementation
 java.io.File getImplFile(java.io.File baseDir)
          Get the file for this class's implementation
 java.lang.String getImplFullClassname()
          Get the full classname for this class's implementation
 java.lang.String getIndividualIdentifierName(org.openrdf.model.Resource ind)
          Get the identifier name for the given individual
 java.lang.String getInterfaceClassname()
          Get the classname for this class's interface
 java.io.File getInterfaceFile(java.io.File baseDir)
          Get the file for this class's interface
 java.lang.String getInterfaceFullClassname()
          Get the full classname for this class's interface
 java.lang.String getListenerAdapterClassname()
          Get the classname for this class's listener adapter
 java.io.File getListenerAdapterFile(java.io.File baseDir)
          Get the file for this class's listener adapter
 java.lang.String getListenerAdapterFullClassname()
          Get the full classname for this class's listener adapter
 java.lang.String getListenerClassname()
          Get the classname for this class's listener
 java.io.File getListenerFile(java.io.File baseDir)
          Get the file for this class's listener
 java.lang.String getListenerFullClassname()
          Get the full classname for this class's listener
 java.lang.String getLocalName()
          Get the local name of this classes uri
 Class getOntClass()
          Get the Jastor Class bean for this class
 java.lang.String getPackageName()
          Get the package name for the class
 org.openrdf.model.URI getURI()
          Get the URI for this class
 java.lang.String getVariableName()
          Return a string that can be used to represent one of these as an instance variable
 boolean isAncestor(OntologyClass oc)
          Get whether or not the given class is an ancestor of this class.
 boolean isEnumeratedClass()
          Is this an enumerated class
 java.util.List<OntologyClass> listAllExtensionClasses()
          Get a deep listing of all named extension classes.
 java.util.List<OntologyClass> listImmediateExtensionClasses()
          Get a list of immediate extension classes derived from subClassOf, intersectionOf and unionOf
 java.util.List<org.openrdf.model.Resource> listIndividuals()
          List all individuals for this type
 java.util.List<org.openrdf.model.Resource> listOneOfClasses()
          Return the oneOf classes
 java.util.List<OntologyProperty> listProperties(boolean includeExtensionClasses)
          Get list of OntologyProperties for the class
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OntologyClass

public OntologyClass(JastorContext ctx)
Construct a new OntologyClass to represent a Thing. Such instances will not contain an org.openanzo.owl.Class, but will return basic naming questions. Several methods such as listProperties will never be called on such an instance so we leave them unmodified. In particular, the file name generation routines will generate a file for Thing as though it resided with the generated classes. This is wrong, but OK, since such methods will never be called.

Parameters:
ctx - parent context for this class

OntologyClass

public OntologyClass(Class ontClass,
                     JastorContext ctx)
Construct an OntologyClass wrapper around the given org.openanzo.owl.Class. This org.openanzo.owl.Class can be an anonymous restriction on a property in which case the listProperties call will return the restricted property

Parameters:
ontClass - Jastor class bean
ctx - parent context for this class
Method Detail

getContext

public JastorContext getContext()
Get the context for this ontology

Returns:
the context for this ontology

getOntClass

public Class getOntClass()
Get the Jastor Class bean for this class

Returns:
the Jastor Class bean for this class

getURI

public org.openrdf.model.URI getURI()
Get the URI for this class

Returns:
the URI for this class

getLocalName

public java.lang.String getLocalName()
Get the local name of this classes uri

Returns:
the local name of this classes uri

getComment

public OntologyComment getComment()
Get the comment for this class

Returns:
the comment for this class

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getVariableName

public java.lang.String getVariableName()
Return a string that can be used to represent one of these as an instance variable

Returns:
a string that can be used to represent one of these as an instance variable

getInterfaceFullClassname

public java.lang.String getInterfaceFullClassname()
Get the full classname for this class's interface

Returns:
the full classname for this class's interface

getImplFullClassname

public java.lang.String getImplFullClassname()
Get the full classname for this class's implementation

Returns:
the full classname for this class's implementation

getListenerFullClassname

public java.lang.String getListenerFullClassname()
Get the full classname for this class's listener

Returns:
the full classname for this class's listener

getListenerAdapterFullClassname

public java.lang.String getListenerAdapterFullClassname()
Get the full classname for this class's listener adapter

Returns:
the full classname for this class's listener adapter

getInterfaceFile

public java.io.File getInterfaceFile(java.io.File baseDir)
Get the file for this class's interface

Parameters:
baseDir - directory where file is to be created
Returns:
the file for this class's interface

getImplFile

public java.io.File getImplFile(java.io.File baseDir)
Get the file for this class's implementation

Parameters:
baseDir - directory where file is to be created
Returns:
the file for this class's implementation

getListenerFile

public java.io.File getListenerFile(java.io.File baseDir)
Get the file for this class's listener

Parameters:
baseDir - directory where file is to be created
Returns:
the file for this class's listener

getListenerAdapterFile

public java.io.File getListenerAdapterFile(java.io.File baseDir)
Get the file for this class's listener adapter

Parameters:
baseDir - directory where file is to be created
Returns:
the file for this class's listener adapter

getInterfaceClassname

public java.lang.String getInterfaceClassname()
Get the classname for this class's interface

Returns:
the classname for this class's interface

getImplClassname

public java.lang.String getImplClassname()
Get the classname for this class's implementation

Returns:
the classname for this class's implementation

getListenerClassname

public java.lang.String getListenerClassname()
Get the classname for this class's listener

Returns:
the classname for this class's listener

getListenerAdapterClassname

public java.lang.String getListenerAdapterClassname()
Get the classname for this class's listener adapter

Returns:
the classname for this class's listener adapter

getPackageName

public java.lang.String getPackageName()
Get the package name for the class

Returns:
the package name for the class

getFactoryFullClassname

public java.lang.String getFactoryFullClassname()
Get the full classname for this class's parent factory

Returns:
the full classname for this class's parent factory

getFactoryClassname

public java.lang.String getFactoryClassname()
Get the classname for this class's parent factory

Returns:
the classname for this class's parent factory

getFactoryFile

public java.io.File getFactoryFile(java.io.File baseDir)
Get the file for this class's parent factory

Parameters:
baseDir - directory where file is to be created
Returns:
the file for this class's parent factory

isAncestor

public boolean isAncestor(OntologyClass oc)
Get whether or not the given class is an ancestor of this class.

Parameters:
oc - class to check ancestorial status
Returns:
whether or not the given class is an ancestor of this class.

listProperties

public java.util.List<OntologyProperty> listProperties(boolean includeExtensionClasses)
Get list of OntologyProperties for the class

Parameters:
includeExtensionClasses - whether or not to include properties in extensions from subClassOf, interesectionOf, and unionOf
Returns:
list of OntologyProperties for the class

listAllExtensionClasses

public java.util.List<OntologyClass> listAllExtensionClasses()
Get a deep listing of all named extension classes. Unfortunately, we can't use this routine to do much, but we do use to generate type-closure code.

Returns:
list of all classes that extend this class

listImmediateExtensionClasses

public java.util.List<OntologyClass> listImmediateExtensionClasses()
Get a list of immediate extension classes derived from subClassOf, intersectionOf and unionOf

Returns:
a list of immediate extension classes derived from subClassOf, intersectionOf and unionOf

findCardinalityRestrictionInSubClassHierarchy

public Restriction findCardinalityRestrictionInSubClassHierarchy(OntologyProperty prop)
                                                          throws JastorException
Finds a cardinality restriction in sub-class hierarchy for the given property. This method is needed because some super-classes won't specify a range, but all of there subclasses will have the same (hopefully) restriction. If not, this approach will surely break.

Parameters:
prop - property to check
Returns:
Restriction for this property in the classes hierarchy
Throws:
JastorException

listIndividuals

public java.util.List<org.openrdf.model.Resource> listIndividuals()
List all individuals for this type

Returns:
all individuals for this type

getIndividualIdentifierName

public java.lang.String getIndividualIdentifierName(org.openrdf.model.Resource ind)
Get the identifier name for the given individual

Parameters:
ind - resource of individual
Returns:
the identifier name for the given individual

isEnumeratedClass

public boolean isEnumeratedClass()
Is this an enumerated class

Returns:
true if this an enumerated class

listOneOfClasses

public java.util.List<org.openrdf.model.Resource> listOneOfClasses()
Return the oneOf classes

Returns:
the oneOf classes


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.