jcolibri.datatypes
Class Instance

java.lang.Object
  extended by jcolibri.datatypes.Instance
All Implemented Interfaces:
TypeAdaptor

public class Instance
extends java.lang.Object
implements TypeAdaptor

Represents an Instance of an ontology.

This class uses OntoBridge to connect with the ontology.

It can manage both short or long names to localize an instance:
For example: In the gaia.fdi.ucm.es/ontologies/Restaurant.owl ontology, the long name of the concept "wine" is "gaia.fdi.ucm.es/ontologies/Restaurant.owl#wine. The short name is just "wine" or "restaurant:wine" if "restaurant" is a defined prefix for that ontology.

Version:
2.0
Author:
Juan A. Recio-García.
See Also:
TypeAdaptor

Constructor Summary
Instance()
           
Instance(java.lang.String instance)
          Creates an instance connected with the instance in the ontology.
Instance(java.lang.String instance, boolean useShortName)
          Creates an Instance looking for the instance in the ontology with the same name.
 
Method Summary
static Instance createInstance(java.lang.String instanceName, java.lang.String parentConcept)
           
 boolean equals(java.lang.Object o)
          You must define this method to avoid problems with the data base connector (Hibernate)
 void fromString(java.lang.String content)
          Reads the type from a string.
 int hashCode()
           
 java.lang.String toString()
          Returns a string representation of the type.
 void useShortName(boolean yesno)
          Indicates if using a long or short name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Instance

public Instance()

Instance

public Instance(java.lang.String instance,
                boolean useShortName)
         throws OntologyAccessException
Creates an Instance looking for the instance in the ontology with the same name.

The useShortName param allows using short or long names. For example:
In the gaia.fdi.ucm.es/ontologies/Restaurant.owl ontology, the long name of the concept "wine" is "gaia.fdi.ucm.es/ontologies/Restaurant.owl#wine. The short name is just "wine" or "restaurant:wine" if "restaurant" is a defined prefix for that ontology.

Parameters:
instance - Name of the concept in the ontology
useShortName - Use long or short name
Throws:
OntologyAccessException

Instance

public Instance(java.lang.String instance)
         throws OntologyAccessException
Creates an instance connected with the instance in the ontology. It uses a short name format.

Parameters:
instance - Name of the concept in the ontology
Throws:
OntologyAccessException
Method Detail

createInstance

public static Instance createInstance(java.lang.String instanceName,
                                      java.lang.String parentConcept)

fromString

public void fromString(java.lang.String content)
                throws OntologyAccessException
Description copied from interface: TypeAdaptor
Reads the type from a string.

Specified by:
fromString in interface TypeAdaptor
Throws:
OntologyAccessException

toString

public java.lang.String toString()
Description copied from interface: TypeAdaptor
Returns a string representation of the type.

Specified by:
toString in interface TypeAdaptor
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Description copied from interface: TypeAdaptor
You must define this method to avoid problems with the data base connector (Hibernate)

Specified by:
equals in interface TypeAdaptor
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

useShortName

public void useShortName(boolean yesno)
Indicates if using a long or short name.

Parameters:
yesno -

GAIA - Group for Artificial Intelligence Applications
http://gaia.fdi.ucm.es