kaos.ontology.util
Class KAoSInstanceBuilderImpl

java.lang.Object
  extended by kaos.ontology.util.KAoSInstanceBuilderImpl
All Implemented Interfaces:
java.io.Serializable, KAoSInstanceBuilder

public class KAoSInstanceBuilderImpl
extends java.lang.Object
implements KAoSInstanceBuilder, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
KAoSInstanceBuilderImpl(java.io.InputStream ontologyXMLStream, java.lang.String baseURI)
           
KAoSInstanceBuilderImpl(SerializableOntModelImpl mod)
          Create an instance builder from an existing ontology model.
KAoSInstanceBuilderImpl(java.lang.String classURI, java.lang.String instanceURI)
          Create a new ontology instance.
 
Method Summary
 void addDatatypePropertyValue(java.lang.String propertyName, java.lang.Object val)
          Add a value to given Datatype property such as a String, Integer, Float, etc.
 void addObjectPropertyValue(java.lang.String propertyName, java.lang.String conceptName)
          Add a value to given Object property.
 java.util.Enumeration getAllPropertyNames()
          Get the names of all properties contained within this ontology instance.
 java.lang.String getClassName()
          Get the name of the class of this instance.
 java.util.Vector getDatatypePropertyValues(java.lang.String propertyName)
          Get the values of the given Datatype property.
 java.lang.String getInstanceName()
          Get the name of this instance.
 SerializableOntModelImpl getInstanceOntModel()
          Get the jena-based Ontology Model object for this instance.
 java.util.Vector getObjectPropertyValues(java.lang.String propertyName)
          Get the values of the given Object property.
static void main(java.lang.String[] args)
           
 void showInstance()
          Show the properties and their values in this instance.
 void write(java.io.OutputStream out)
          Write the XML (OWL) representation of this instance to the text output stream provided
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KAoSInstanceBuilderImpl

public KAoSInstanceBuilderImpl(java.lang.String classURI,
                               java.lang.String instanceURI)
Create a new ontology instance.

Parameters:
classURI - The URI identifying the class this instance is a member of.
instanceURI - URI representing the instance name.

KAoSInstanceBuilderImpl

public KAoSInstanceBuilderImpl(SerializableOntModelImpl mod)
Create an instance builder from an existing ontology model. Typically used for de-serialization.

Parameters:
mod - The ontology Model object containing an ontology instance.

KAoSInstanceBuilderImpl

public KAoSInstanceBuilderImpl(java.io.InputStream ontologyXMLStream,
                               java.lang.String baseURI)
Parameters:
ontologyXMLStream - InputStream containing ontology XML (OWL) defining one instance
baseURI - Namespace for the instance defined in the ontologyXMLStream. If the baseURI is null or invalid, the DefaultKAoSInstanceNamespace will be used
Method Detail

write

public void write(java.io.OutputStream out)
Write the XML (OWL) representation of this instance to the text output stream provided

Specified by:
write in interface KAoSInstanceBuilder
Parameters:
out - The OutputStream that will receive the XML representation of this instance

getClassName

public java.lang.String getClassName()
Get the name of the class of this instance.

Specified by:
getClassName in interface KAoSInstanceBuilder
Returns:
String the URI that is the name of the class for this instance.

getInstanceName

public java.lang.String getInstanceName()
Get the name of this instance.

Specified by:
getInstanceName in interface KAoSInstanceBuilder
Returns:
String the URI that is the name of this instance.

getAllPropertyNames

public java.util.Enumeration getAllPropertyNames()
Get the names of all properties contained within this ontology instance.

Specified by:
getAllPropertyNames in interface KAoSInstanceBuilder
Returns:
Vector of Strings, each of which contains a URI identifying a property for this instance.

addDatatypePropertyValue

public void addDatatypePropertyValue(java.lang.String propertyName,
                                     java.lang.Object val)
                              throws ValueNotSet
Add a value to given Datatype property such as a String, Integer, Float, etc.

Specified by:
addDatatypePropertyValue in interface KAoSInstanceBuilder
Parameters:
String - propertyName the URI that is the name of the property to set
Object - val the value of the Datatype property which must support the toString() method
Throws:
ValueNotSet - if the property is not part of the underlying class.

getDatatypePropertyValues

public java.util.Vector getDatatypePropertyValues(java.lang.String propertyName)
                                           throws ValueNotSet
Get the values of the given Datatype property.

Specified by:
getDatatypePropertyValues in interface KAoSInstanceBuilder
Parameters:
propertyName - the URI that is the name of the property
Returns:
the values of the property as a Vector of Strings
Throws:
ValueNotSet - if the property is not part of the underlying class.

addObjectPropertyValue

public void addObjectPropertyValue(java.lang.String propertyName,
                                   java.lang.String conceptName)
                            throws ValueNotSet
Add a value to given Object property.

Specified by:
addObjectPropertyValue in interface KAoSInstanceBuilder
Parameters:
String - propertyName the URI that is the name of the property
String - resourceURI the URI of the resource which is set as the value of this Object property
Throws:
ValueNotSet - if the property is not part of the underlying class.

getObjectPropertyValues

public java.util.Vector getObjectPropertyValues(java.lang.String propertyName)
                                         throws ValueNotSet
Get the values of the given Object property.

Specified by:
getObjectPropertyValues in interface KAoSInstanceBuilder
Parameters:
propertyName - the name of the property
Returns:
the resource URI values of the property as a Vector of Strings
Throws:
ValueNotSet - if the property is not part of the underlying class.

getInstanceOntModel

public SerializableOntModelImpl getInstanceOntModel()
Get the jena-based Ontology Model object for this instance.

Specified by:
getInstanceOntModel in interface KAoSInstanceBuilder
Returns:

showInstance

public void showInstance()
Show the properties and their values in this instance. Prints an XML (OWL) representation of this instance to the log.

Specified by:
showInstance in interface KAoSInstanceBuilder

main

public static void main(java.lang.String[] args)