gate.creole.ontology
Interface Ontology

All Superinterfaces:
FeatureBearer, LanguageResource, NameBearer, Resource, Serializable

public interface Ontology
extends LanguageResource

Interface for ontology language resources. A client program may only use the methods defined in this interface to manipulate ontologies and must never use any methods from the implementing package.

All ontology language resources must be created using the Factory.createResource method.

See the documentation for the implementing plugins for details on how to create ontology language resources programmatically.

Unless stated otherwise, this documentation describes the behavior of the methods as implemented in the ontology API implementation plugin, Ontology

The backwards-compatibility plugin a href="../../../../../plugins/Ontology/doc/javadoc/index.html" target="_parent">Ontology_OWLIM2 implements all of the deprecated methods and classes but none of the new methods that were added to the API in version 5.1. Some but not all depracated methods are also implemented in the new plugin Ontology

The use of deprecated methods should be avoided and replaced by other methods as soon as possible as the backwards-compatibility plugin may get removed in the future and deprecated methods may get removed from the API.

Author:
Niraj Aswani, Johann Petrak

Method Summary
 AllValuesFromRestriction addAllValuesFromRestriction(ObjectProperty onProperty, OClass theClass)
           
 AllValuesFromRestriction addAllValuesFromRestriction(RDFProperty onProperty, OResource hasValue)
          Deprecated. - this method is deprecated and kept for backwards compatibility as long as the OntologyOWLIM2 plugin is kept. Use the method addAllValuesFromRestriction(ObjectProperty, OClass) instead.
 AnnotationProperty addAnnotationProperty(OURI aPropertyURI)
          Creates a new AnnotationProperty.
 AnonymousClass addAnonymousClass()
           
 CardinalityRestriction addCardinalityRestriction(RDFProperty onProperty, String cardinalityValue)
          Adds a new Cardinality Restriction to the ontology.
 DatatypeProperty addDatatypeProperty(OURI aPropertyURI, Set<OClass> domain, DataType aDatatype)
          Create a DatatypeProperty with the given domain and range.
 HasValueRestriction addHasValueRestriction(RDFProperty onProperty, OResource hasValue)
          Adds a new HasValue Restriction to the ontology.
 MaxCardinalityRestriction addMaxCardinalityRestriction(RDFProperty onProperty, String maxCardinalityValue)
          Adds a new MaxCardinality Restriction to the ontology.
 MinCardinalityRestriction addMinCardinalityRestriction(RDFProperty onProperty, String minCardinalityValue)
          Adds a new MinCardinality Restriction to the ontology.
 ObjectProperty addObjectProperty(OURI aPropertyURI, Set<OClass> domain, Set<OClass> range)
          Creates a new object property (a property that takes instances as values).
 OClass addOClass(OURI aURI)
          Creates a new OWL Class and adds it the ontology.
 OClass addOClass(OURI aURI, byte classType)
          Deprecated. - use one of the dedicated methods to add a named class or a restriction instead
 OInstance addOInstance(OURI theInstanceURI, OClass theClass)
          Creates a new OInstance and returns it.
 void addOntologyModificationListener(OntologyModificationListener oml)
          Register the Ontology Modification Listeners
 void addOResourceToMap(String uri, OResource resource)
          Deprecated.  
 RDFProperty addRDFProperty(OURI aPropertyURI, Set<OResource> domain, Set<OResource> range)
          Deprecated.  
 SomeValuesFromRestriction addSomeValuesFromRestriction(RDFProperty onProperty, OResource hasValue)
          Adds a new AllValuesFrom Restriction to the ontology.
 SymmetricProperty addSymmetricProperty(OURI aPropertyURI, Set<OClass> domainAndRange)
          Creates a new symmetric property (an object property that is symmetric).
 TransitiveProperty addTransitiveProperty(OURI aPropertyURI, Set<OClass> domain, Set<OClass> range)
          Creates a new transitive property (an object property that is transitive).
 void cleanOntology()
          This method removes the entire data from the ontology and emptys it.
 void commitTransaction()
          Deprecated.  
 boolean containsOClass(OClass theClass)
          Checks whether the ontology contains this class.
 boolean containsOClass(ONodeID theURI)
          Checks whether a class with the specified URI or blank node ID exists in the ontology.
 boolean containsOInstance(OInstance theInstance)
          Checks whether the provided Instance exists in the ontology.
 boolean containsOInstance(OURI theInstanceURI)
          Checks whether the provided URI refers to an Instance that exists in the ontology.
 OntologyBooleanQuery createBooleanQuery(String theQuery, OConstants.QueryLanguage queryLanguage)
          This method creates a OntologyBooleanQuery object and passes on the specified query string and the specified query language.
 OURI createOURI(String theURI)
          Create an ORUI object from the given URI string.
 OURI createOURIForName(String resourceName)
          Create an OURI from the given resource name, using the ontology base URI (default name space).
 OntologyTupleQuery createTupleQuery(String theQuery, OConstants.QueryLanguage queryLanguage)
          This method creates a OntologyTupleQuery object and passes on the specified query string in the specified query language.
 String executeQuery(String serqlQuery)
          Deprecated.  
 void fireOntologyReset()
          A method to invoke when the ontology is reset.
 void fireOntologyResourceAdded(OResource resource)
          A Method to invoke an event for newly added ontology resource
 void fireOntologyResourcesRemoved(String[] resources)
          A Method to invoke an event for a removed ontology resource
 void fireResourcePropertyValueChanged(OResource resource, RDFProperty property, Object value, int eventType)
          A method to invoke when a resource's property value is changed
 void fireResourceRelationChanged(OResource resource1, OResource resource2, int eventType)
          A method to invoke when a resource's property value is changed
 OURI generateOURI(String resourceNamePrefix)
          Generate a new unique OURI for this ontology.
 OURI generateOURI(String resourceNamePrefix, String baseURI)
          Generate a new unique OURI for this ontology.
 List<OResource> getAllResources()
          Deprecated.  
 Set<AnnotationProperty> getAnnotationProperties()
          Gets the set of Annotation Properties in the ontology where for a property there exists a statement .
 AnnotationProperty getAnnotationProperty(OURI theURI)
          Returns the annotation property for the given URI or null if there is no annotation property with that URI.
 Set<DatatypeProperty> getDatatypeProperties()
          Gets the set of Datatype Properties in the ontology.
 DatatypeProperty getDatatypeProperty(OURI theURI)
          Returns the datatype property for the given URI or null if there is no datatype property with that URI.
 String getDefaultNameSpace()
          Gets the default name space for this ontology.
 int getDistance(OClass class1, OClass class2)
          Gets the taxonomic distance between 2 classes.
 Set<ObjectProperty> getObjectProperties()
          Gets the set of Object Properties in the ontology.
 ObjectProperty getObjectProperty(OURI theURI)
          Returns the object property for the given URI or null if there is no object property with that URI.
 OClass getOClass(ONodeID theClassID)
          Retrieves a both named classes and anonymous classes and retrictions that match either the URI or the blank node identifier represented by ONodeID
 Set<OClass> getOClasses(boolean top)
          Retrieves all ontology classes in a set.
 ClosableIterator<OClass> getOClassesIterator(boolean top)
          Return an iterator to retrieve all ontology classes in the ontology.
 OInstance getOInstance(OURI theInstanceURI)
          Gets the instance with the given URI.
 Set<OInstance> getOInstances()
          Gets all instances in the ontology.
 Set<OInstance> getOInstances(OClass theClass, byte closure)
          Deprecated. 
 Set<OInstance> getOInstances(OClass theClass, OConstants.Closure closure)
          Gets instances in the ontology, which belong to this class.
 ClosableIterator<OInstance> getOInstancesIterator()
           
 ClosableIterator<OInstance> getOInstancesIterator(OClass theClass, OConstants.Closure closure)
           
 List<Literal> getOntologyAnnotationValues(AnnotationProperty ann)
          Get the values of an ontology annotation property.
 String getOntologyData(byte format)
          Deprecated. not supported any more - throws UnsupportedOperationException
 OntologyTripleStore getOntologyTripleStore()
          Return an object representing the triple store which backs the ontology.
 OURI getOntologyURI()
          Get the URI of this ontology.
 OResource getOResourceByName(String resourceName)
          Deprecated.  
 OResource getOResourceFromMap(String uri)
          Deprecated.  
 List<OResource> getOResourcesByName(String resourceName)
          This method checks in its cache to find out the OResources for the given resource name.
 List<OResource> getOResourcesWith(RDFProperty aProperty, Literal aValue)
          This method given a property (either an annotation or datatype), retrieves a list of resources which have the provided literal set as a value.
 List<OResource> getOResourcesWith(RDFProperty aProperty, OResource aValue)
          This method given a property (either object, transitive, symmetric or rdf), retrieves a list of resources which have the provided resource set as a value.
 RDFProperty getProperty(OURI thePropertyURI)
          Returns the property for a given URI or null if there is no property with that URI.
 Set<RDFProperty> getPropertyDefinitions()
          Gets the set of RDF, Object, Datatype, Symmetric and Transitive property definitions in this ontology.
 Set<RDFProperty> getRDFProperties()
          Gets the set of RDF Properties in the ontology where for a property there exists a statement .
 Object getSesameRepository()
          Deprecated.  
 String getSesameRepositoryID()
          Deprecated.  
 Set<SymmetricProperty> getSymmetricProperties()
          Gets the set of Symmetric Properties in the ontology.
 Set<TransitiveProperty> getTransitiveProperties()
          Gets the set of Transitive Properties in the ontology.
 URL getURL()
          Gets the URL of this ontology.
 String getVersion()
          Deprecated. use method getOntologyAnnotationValues instead
 boolean isAnnotationProperty(OURI thePropertyURI)
          Checkes whether there exists a statement in the ontology or not.
 boolean isDatatypeProperty(OURI thePropertyURI)
          Checkes whether the ontology contains a datatype property with the given URI.
 boolean isModified()
          Checks the modified flag.
 boolean isObjectProperty(OURI thePropertyURI)
          Checks if there exists an object property with the given URI
 boolean isRDFProperty(OURI thePropertyURI)
          Checkes whether there exists a statement in the ontology or not.
 boolean isSymmetricProperty(OURI thePropertyURI)
          Checkes whether there exists a statement in the ontology or not.
 boolean isTransitiveProperty(OURI thePropertyURI)
          Checkes whether there exists a statement in the ontology or not.
 void readOntologyData(InputStream in, String baseURI, OConstants.OntologyFormat format, boolean asImport)
          Read ontology data from the specified stream in the specified format and load it into the ontology.
 void readOntologyData(Reader in, String baseURI, OConstants.OntologyFormat format, boolean asImport)
          Read ontology data from the specified reader in the specified format and load it into the ontology.
 void removeOClass(OClass theClass)
          Removes a class from this ontology.
 void removeOInstance(OInstance theInstance)
          Removes the instance from the ontology.
 void removeOntologyModificationListener(OntologyModificationListener oml)
          Removed the registered ontology modification listeners
 void removeOResourceFromMap(String uri)
          Deprecated.  
 void removeProperty(RDFProperty theProperty)
          A method to remove the existing propertyDefinition (exclusive of Annotation Property).
 void resolveImports(Map<String,String> importMappings)
          Loads all imported ontologies.
 void setDefaultNameSpace(String aNameSpace)
          Sets the default name space/base URI for the ontology.
 void setModified(boolean isModified)
          Sets the modified flag.
 void setOntologyAnnotation(AnnotationProperty ann, Literal value)
          Set an annotation property for the ontology to the specified literal value.
 void setOntologyURI(OURI theURI)
          Set the ontology URI of the current ontology.
 void setURL(URL aUrl)
          Set the URL of this ontology.
 void setVersion(String theVersion)
          Deprecated. use method setOntologyAnnotation instead
 void store(File newOntology)
          Deprecated. not implemented any more, throws UnsupportedOperationException
 boolean transationStarted()
          Deprecated.  
 void writeOntologyData(OutputStream out, byte format)
          Deprecated. not supported any more - throws UnsupportedOperationException
 void writeOntologyData(OutputStream out, OConstants.OntologyFormat format, boolean includeExports)
          Write the ontology data to the provided output stream in the specified serialization format.
 void writeOntologyData(Writer out, byte format)
          Deprecated. not supported any more and will throw and exception in the new implementation plugin
 void writeOntologyData(Writer out, OConstants.OntologyFormat format, boolean includeExports)
          Write the ontology data to the provided writer in the specified serialization format.
 
Methods inherited from interface gate.LanguageResource
getDataStore, getLRPersistenceId, getParent, setDataStore, setLRPersistenceId, setParent, sync
 
Methods inherited from interface gate.Resource
cleanup, getParameterValue, init, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Method Detail

cleanOntology

void cleanOntology()
This method removes the entire data from the ontology and emptys it. This will also re-initialize the ontology to the state it would have after creation and perform the import of system data into the ontology store (OWL and RDFS assertions).


getOntologyData

@Deprecated
String getOntologyData(byte format)
Deprecated. not supported any more - throws UnsupportedOperationException

Retrieves the ontology data and returns a string with the serialization of the data in the specified format.

Parameters:
format - the format to be used for serialization <@see OConstants>
Returns:
a string containing the serialization of the ontology

writeOntologyData

@Deprecated
void writeOntologyData(OutputStream out,
                                  byte format)
Deprecated. not supported any more - throws UnsupportedOperationException

Exports the ontology data into the provided format to the provided output stream.

Parameters:
out - OutputStream the serialized ontology data is written to
format - the serialization format, see OConstants

writeOntologyData

void writeOntologyData(OutputStream out,
                       OConstants.OntologyFormat format,
                       boolean includeExports)
Write the ontology data to the provided output stream in the specified serialization format. The output stream has to be closed by the caller.

Parameters:
out - an open OutpuStream for writing the data.
format - the serialization format
includeExports - if false, do not write any data that was loaded as an ontology import.
Since:
5.1

writeOntologyData

@Deprecated
void writeOntologyData(Writer out,
                                  byte format)
Deprecated. not supported any more and will throw and exception in the new implementation plugin

Exports the ontology data into the provided format using the provided writer.

Parameters:
out - an open Writer for writing the data
format - the ontology serialization format , see OConstants

writeOntologyData

void writeOntologyData(Writer out,
                       OConstants.OntologyFormat format,
                       boolean includeExports)
Write the ontology data to the provided writer in the specified serialization format. The writer object has to be closed by the caller.

Parameters:
out - an open Writer for writing the data
format - the ontology serialization format , see OConstants.OntologyFormat
includeExports - if false, do not write any data that was loaded as and ontology import.

readOntologyData

void readOntologyData(InputStream in,
                      String baseURI,
                      OConstants.OntologyFormat format,
                      boolean asImport)
Read ontology data from the specified stream in the specified format and load it into the ontology. The input stream has to be closed by the caller.

Parameters:
in - an InputStream object for reading the ontology data
baseURI - the URI to use for resolving URI references
format - the serialization format of the ontology, see OConstants.OntologyFormat
asImport - if true, load the data as an ontology import which means that it will not be written as part of the user data, unless explicitly requested.

readOntologyData

void readOntologyData(Reader in,
                      String baseURI,
                      OConstants.OntologyFormat format,
                      boolean asImport)
Read ontology data from the specified reader in the specified format and load it into the ontology.

Parameters:
in -
baseURI -
format -
asImport - asImport if true, load the data as an ontology import which means that it will not be written as part of the user data, unless explicitly requested.

getOntologyURI

OURI getOntologyURI()
Get the URI of this ontology. If no ontology URI is found, null is returned. If more than one ontology URI is found, an exception is thrown.

Returns:
the OURI of the current ontology or null

setOntologyURI

void setOntologyURI(OURI theURI)
Set the ontology URI of the current ontology. If the ontology URI is already set to a different value, this method throws an exception.

NOTE: this method does not set the default namespace!

NOTE: at the moment, this method allows to set the ontology URI as long as no URI is set yet. Once an ontology URI is set, it cannot be changed since it would not be clear what to do with assertions that alreadt reference that ontology URI (e.g. ontology annotations or import specifications).

Parameters:
theURI -

resolveImports

void resolveImports(Map<String,String> importMappings)
Loads all imported ontologies. This method finds all ontology import URIs in the current ontology and loads as imports the ontologies referenced by these URIs. If an URI is found in importMappings, and maps to an empty String, the import will be ignored. If an URI is found and maps to a non-empty string, the string will be interpreted as an URL from which to load the imported ontology. If no entry is found for the URI, the URI will be interpreted as an URL from which to load the ontology. All import URIs of ontologies loaded during this process will be recursively processed in the same way.

A GateOntologyException is thrown if any import that should be loaded cannot be loaded and the import loading process is aborted before potential additional imports are processed.

Parameters:
importMappings -

getURL

URL getURL()
Gets the URL of this ontology. This usually is the URL the ontology was loaded from. If several files were loaded, the URL of the first file is returned. Files loaded as imports are not considered for this. If and how this is set automatically when an ontology LR is created depends on the implementation. For an ontology LR that connects to an existing ontology repository, an URL derived from the ontology repository location may be returned.

Returns:
the URL of this ontology if set, or null otherwise

setURL

void setURL(URL aUrl)
Set the URL of this ontology. This URL set by this method will be returned by the getURL() method. The ontology store is not modified by this.

Parameters:
aUrl - the url to be set

store

@Deprecated
void store(File newOntology)
           throws IOException
Deprecated. not implemented any more, throws UnsupportedOperationException

Saves the ontology in the specified File

Parameters:
newOntology - a File object describing the file where to save to
Throws:
IOException

setDefaultNameSpace

void setDefaultNameSpace(String aNameSpace)
Sets the default name space/base URI for the ontology. This URI must end in "#" or "/". This URI is used when a new OURI is created using the createOURIForName(String) method. Setting the default name space with this method does not change the ontology store and does not add a default namespace declaration to the store or when the ontology is saved.

Parameters:
aNameSpace - a String that can be used as a base URI

getDefaultNameSpace

String getDefaultNameSpace()
Gets the default name space for this ontology. This is used as the base URI for the ontology. This returns the last value set with the method setDefaultNameSpace. If the default name space was not set with this method, it is set to a default value when an ontology is loaded in the following way: If a base URI is specified for the loading, that base URI is used, otherwise, if there was no ontology URI already set from a previous load and this load determined exactly one ontology URI, that URI will be used to set the default name space.

Returns:
a String value.

setVersion

@Deprecated
void setVersion(String theVersion)
Deprecated. use method setOntologyAnnotation instead

Sets the version information for the ontology.

Parameters:
theVersion - the version to be set

getVersion

@Deprecated
String getVersion()
Deprecated. use method getOntologyAnnotationValues instead

Gets the version of this ontology.

Returns:
the version of this ontology

setOntologyAnnotation

void setOntologyAnnotation(AnnotationProperty ann,
                           Literal value)
Set an annotation property for the ontology to the specified literal value.

Parameters:
ann - the annotation property object
value - a Literal object describing the value. This usually should be a String literal.

getOntologyAnnotationValues

List<Literal> getOntologyAnnotationValues(AnnotationProperty ann)
Get the values of an ontology annotation property.

Parameters:
ann - the annotation property object
Returns:
a a list of literals describing the values for the property

addOClass

@Deprecated
OClass addOClass(OURI aURI,
                            byte classType)
Deprecated. - use one of the dedicated methods to add a named class or a restriction instead

Creates a new OClass and adds it the ontology.

Parameters:
aURI - URI of this class
classType - one of the values from OConstants.OCLASS_TYPE_OWL_CLASS and OConstants.OCLASS_TYPE_OWL_RESTRICTION;
Returns:
the newly created class or an existing class if available with the same URI.

addOClass

OClass addOClass(OURI aURI)
Creates a new OWL Class and adds it the ontology. If a class with that URI already exists, that class is returned.

Parameters:
aURI - URI of this class
Returns:
the newly created class or an existing class if available with the same URI.

getOClass

OClass getOClass(ONodeID theClassID)
Retrieves a both named classes and anonymous classes and retrictions that match either the URI or the blank node identifier represented by ONodeID

Parameters:
theClassID -
Returns:
the class matching the URI or blank node ID or null if no matches.

removeOClass

void removeOClass(OClass theClass)
Removes a class from this ontology.

Parameters:
theClass - the class to be removed

containsOClass

boolean containsOClass(ONodeID theURI)
Checks whether a class with the specified URI or blank node ID exists in the ontology.

Parameters:
theURI - a ONodeID, usually an OURI specifying the ID of the ontology class
Returns:
true, if the class exists

containsOClass

boolean containsOClass(OClass theClass)
Checks whether the ontology contains this class.

Parameters:
theClass - a ontology class object
Returns:
true, if the class exists, otherwise - false.

getOClasses

Set<OClass> getOClasses(boolean top)
Retrieves all ontology classes in a set. This method returns a set of either all classes in the ontology or just the "top" classes. A "top" class is a class that is not a subclass of any other class that is not a predefined system class like owl:Thing or rdfs:Resource or a trivial subclass (of itself or of a class that is defined to be equivalent to itself).

NOTE: for large ontologies with a large number of classes it may be preferable to use method getOClassesIterator(boolean) instead.

Parameters:
top - If set to true, only returns those classes with no super classes, otherwise - a set of all classes.
Returns:
set of all the classes in this ontology

getOClassesIterator

ClosableIterator<OClass> getOClassesIterator(boolean top)
Return an iterator to retrieve all ontology classes in the ontology. The iterator should be closed() as soon as it is not needed anymore but will auto-close when it is exhausted and the hasNext() method returned false.

Parameters:
top - If set to true, only returns those classes with no super classes, otherwise all classes
Returns:
a ClosableIterator for accessing the returned ontology classes

getDistance

int getDistance(OClass class1,
                OClass class2)
Gets the taxonomic distance between 2 classes.

Parameters:
class1 - the first class
class2 - the second class
Returns:
the taxonomic distance between the 2 classes

addOInstance

OInstance addOInstance(OURI theInstanceURI,
                       OClass theClass)
Creates a new OInstance and returns it.

Parameters:
theInstanceURI -
theClass - the class to which the instance belongs.
Returns:
the OInstance that has been added to the ontology.

removeOInstance

void removeOInstance(OInstance theInstance)
Removes the instance from the ontology.

Parameters:
theInstance - to be removed

getOInstances

Set<OInstance> getOInstances()
Gets all instances in the ontology.

Returns:
a Set of OInstance objects

getOInstancesIterator

ClosableIterator<OInstance> getOInstancesIterator()

getOInstances

@Deprecated
Set<OInstance> getOInstances(OClass theClass,
                                        byte closure)
Deprecated. 

Gets instances in the ontology, which belong to this class.

Parameters:
theClass - the class of the instances
closure - either DIRECT_CLOSURE or TRANSITIVE_CLOSURE of OConstants
Returns:
Set of OInstance objects

getOInstances

Set<OInstance> getOInstances(OClass theClass,
                             OConstants.Closure closure)
Gets instances in the ontology, which belong to this class. The second parameter specifies if the the given class needs to be a direct class of the instance (direct closure) or a class to which the instance belongs indirectly (transitive closure)

Parameters:
theClass - the class of the instances
closure - either OConstants.Closure.DIRECT_CLOSURE or OConstants.Closure.TRANSITIVE_CLOSURE
Returns:
Set of OInstance objects

getOInstancesIterator

ClosableIterator<OInstance> getOInstancesIterator(OClass theClass,
                                                  OConstants.Closure closure)

getOInstance

OInstance getOInstance(OURI theInstanceURI)
Gets the instance with the given URI.

Parameters:
theInstanceURI - the instance URI
Returns:
the OInstance object with this URI. If there is no such instance then null.

containsOInstance

boolean containsOInstance(OInstance theInstance)
Checks whether the provided Instance exists in the ontology.

Parameters:
theInstance -
Returns:
true, if the Instance exists in ontology, otherwise - false.

containsOInstance

boolean containsOInstance(OURI theInstanceURI)
Checks whether the provided URI refers to an Instance that exists in the ontology.

Parameters:
theInstanceURI -
Returns:
true, if the URI exists in ontology and refers to an Instance, otherwise - false.

addRDFProperty

@Deprecated
RDFProperty addRDFProperty(OURI aPropertyURI,
                                      Set<OResource> domain,
                                      Set<OResource> range)
Deprecated. 

Creates a new RDFProperty.

Parameters:
aPropertyURI - URI of the property to be added into the ontology.
domain - a set of OResource (e.g. a Class, a Property etc.).
range - a set of OResource (e.g. a Class, a Property etc.).

getRDFProperties

Set<RDFProperty> getRDFProperties()
Gets the set of RDF Properties in the ontology where for a property there exists a statement .

Returns:
a Set of RDFProperty.

isRDFProperty

boolean isRDFProperty(OURI thePropertyURI)
Checkes whether there exists a statement in the ontology or not.

Parameters:
thePropertyURI -
Returns:
true, only if there exists the above statement, otherwise - false.

addAnnotationProperty

AnnotationProperty addAnnotationProperty(OURI aPropertyURI)
Creates a new AnnotationProperty.

Parameters:
aPropertyURI - URI of the property to be added into the ontology.

getAnnotationProperties

Set<AnnotationProperty> getAnnotationProperties()
Gets the set of Annotation Properties in the ontology where for a property there exists a statement .

Returns:
a Set of AnnotationProperty.

isAnnotationProperty

boolean isAnnotationProperty(OURI thePropertyURI)
Checkes whether there exists a statement in the ontology or not.

Parameters:
thePropertyURI -
Returns:
true, only if there exists the above statement, otherwise - false.

addDatatypeProperty

DatatypeProperty addDatatypeProperty(OURI aPropertyURI,
                                     Set<OClass> domain,
                                     DataType aDatatype)
Create a DatatypeProperty with the given domain and range. The domain must be specified as a set of OClass objects, the resulting domain is the intersection of all specified classes.

If this method is called with an OURI of a datatype property that already exists, any specified domain class is added to the intersection of classes already defined for the domain.

Parameters:
aPropertyURI - the URI for the new property.
domain - the set of ontology classes that constitutes the domain for the new property.
aDatatype - a DataType object describing the datatype of the range.
Returns:
the newly created property.

getDatatypeProperties

Set<DatatypeProperty> getDatatypeProperties()
Gets the set of Datatype Properties in the ontology.

Returns:
a Set of DatatypeProperty.

isDatatypeProperty

boolean isDatatypeProperty(OURI thePropertyURI)
Checkes whether the ontology contains a datatype property with the given URI.

Parameters:
thePropertyURI -
Returns:
true if there is an instance of owl:DatatypeProperty with the given URI in the ontology.

addObjectProperty

ObjectProperty addObjectProperty(OURI aPropertyURI,
                                 Set<OClass> domain,
                                 Set<OClass> range)
Creates a new object property (a property that takes instances as values).

If this method is called with an OURI of an object property that already exists, any specified domain or range class is added to the intersection of classes already defined for the domain or range.

Parameters:
aPropertyURI - the URI for the new property.
domain - the set of ontology classes (i.e. OClass objects} that constitutes the domain of the property. An instance must belong to the intersection of all classes in the set to be a valid member of the domain of the property. If an empty set or null is passed, the instance can belong to any class.
range - the set of ontology classes (i.e. OClass objects} that constitutes the range for the new property. The instance that is the value of a property must belong to the intersection of all classes in this set to be valid. If an empty set or null is passed on, the instance can belong to any class.
Returns:
the newly created property.

getObjectProperties

Set<ObjectProperty> getObjectProperties()
Gets the set of Object Properties in the ontology.

Returns:
a Set of ObjectProperty.

isObjectProperty

boolean isObjectProperty(OURI thePropertyURI)
Checks if there exists an object property with the given URI

Parameters:
thePropertyURI -
Returns:
true, only if there exists an object property with the given URI.

addSymmetricProperty

SymmetricProperty addSymmetricProperty(OURI aPropertyURI,
                                       Set<OClass> domainAndRange)
Creates a new symmetric property (an object property that is symmetric).

If this method is called with an OURI of a datatype property that already exists, any specified domainAndRange class is added to the intersection of classes already defined for the domain and range.

Parameters:
aPropertyURI - the URI for the new property.
domainAndRange - the set of ontology classes (i.e. OClass objects} that constitutes the domain and the range for the new property. The property only applies to instances that belong to the intersection of all classes included in its domain. An empty set means that the property applies to instances of any class.
Returns:
the newly created property.

getSymmetricProperties

Set<SymmetricProperty> getSymmetricProperties()
Gets the set of Symmetric Properties in the ontology.

Returns:
a Set of SymmetricProperty.

isSymmetricProperty

boolean isSymmetricProperty(OURI thePropertyURI)
Checkes whether there exists a statement in the ontology or not.

Parameters:
thePropertyURI -
Returns:
true, only if there exists the above statement, otherwise - false.

addTransitiveProperty

TransitiveProperty addTransitiveProperty(OURI aPropertyURI,
                                         Set<OClass> domain,
                                         Set<OClass> range)
Creates a new transitive property (an object property that is transitive).

If this method is called with an OURI of a transitive property that already exists, any specified domain or range class is added to the intersection of classes already defined for the domain or range.

Parameters:
aPropertyURI - the URI for the new property.
domain - the set of ontology classes (i.e. OClass objects} that constitutes the range for the new property. The property only applies to instances that belong to the intersection of all classes included in its domain. An empty set means that the property applies to instances of any class.
range - the set of ontology classes (i.e. OClass objects} that constitutes the range for the new property.
Returns:
the newly created property.

getTransitiveProperties

Set<TransitiveProperty> getTransitiveProperties()
Gets the set of Transitive Properties in the ontology.

Returns:
a Set of TransitiveProperty.

isTransitiveProperty

boolean isTransitiveProperty(OURI thePropertyURI)
Checkes whether there exists a statement in the ontology or not.

Parameters:
thePropertyURI -
Returns:
true, only if there exists the above statement, otherwise - false.

getPropertyDefinitions

Set<RDFProperty> getPropertyDefinitions()
Gets the set of RDF, Object, Datatype, Symmetric and Transitive property definitions in this ontology.

Returns:
a Set of RDFProperty, DatatypeProperty, ObjectProperty, TransitiveProperty and , SymmetricProperty objects. Please note that the method does not include annotation properties.

getProperty

RDFProperty getProperty(OURI thePropertyURI)
Returns the property for a given URI or null if there is no property with that URI.

Parameters:
thePropertyURI - the URI of the property
Returns:
the RDFProperty object or null if no property with that URI is found

getAnnotationProperty

AnnotationProperty getAnnotationProperty(OURI theURI)
Returns the annotation property for the given URI or null if there is no annotation property with that URI.

Parameters:
theURI - the URI of the property
Returns:
the AnnotationProperty obejct

getDatatypeProperty

DatatypeProperty getDatatypeProperty(OURI theURI)
Returns the datatype property for the given URI or null if there is no datatype property with that URI.

Parameters:
theURI - the URI of the property
Returns:
the DatatypeProperty obejct

getObjectProperty

ObjectProperty getObjectProperty(OURI theURI)
Returns the object property for the given URI or null if there is no object property with that URI.

Parameters:
theURI - the URI of the property
Returns:
the AnnotationProperty obejct

removeProperty

void removeProperty(RDFProperty theProperty)
A method to remove the existing propertyDefinition (exclusive of Annotation Property).

Parameters:
theProperty -

addMinCardinalityRestriction

MinCardinalityRestriction addMinCardinalityRestriction(RDFProperty onProperty,
                                                       String minCardinalityValue)
                                                       throws InvalidValueException
Adds a new MinCardinality Restriction to the ontology. It automatically creates a randon anonymous class, which it uses to denote the restriction. The default datatype is set to NonNegativeIntegerNumber

Parameters:
onProperty - - Specifies the property for which the restriction is being set.
minCardinalityValue - - generally a numeric number.
Throws:
InvalidValueException - - if a value is not compatible with the nonNegativeIntegerNumber datatype.

addMaxCardinalityRestriction

MaxCardinalityRestriction addMaxCardinalityRestriction(RDFProperty onProperty,
                                                       String maxCardinalityValue)
                                                       throws InvalidValueException
Adds a new MaxCardinality Restriction to the ontology. It automatically creates a randon anonymous class, which it uses to denote the restriction. The default datatype is set to NonNegativeIntegerNumber

Parameters:
onProperty - - Specifies the property for which the restriction is being set.
maxCardinalityValue - - generally a numeric number.
Throws:
InvalidValueException - - if a value is not compatible with the nonNegativeIntegerNumber datatype.

addCardinalityRestriction

CardinalityRestriction addCardinalityRestriction(RDFProperty onProperty,
                                                 String cardinalityValue)
                                                 throws InvalidValueException
Adds a new Cardinality Restriction to the ontology. It automatically creates a randon anonymous class, which it uses to denote the restriction. The default datatype is set to NonNegativeIntegerNumber

Parameters:
onProperty - - Specifies the property for which the restriction is being set.
cardinalityValue - - generally a numeric number.
Throws:
InvalidValueException - - if a value is not compatible with the nonNegativeIntegerNumber datatype.

addHasValueRestriction

HasValueRestriction addHasValueRestriction(RDFProperty onProperty,
                                           OResource hasValue)
Adds a new HasValue Restriction to the ontology. It automatically creates a randon anonymous class, which it uses to denote the restriction.

Parameters:
onProperty - - Specifies the property for which the restriction is being set.
hasValue - - a resource used as a value for hasValue element of the restriction.

addAllValuesFromRestriction

@Deprecated
AllValuesFromRestriction addAllValuesFromRestriction(RDFProperty onProperty,
                                                                OResource hasValue)
Deprecated. - this method is deprecated and kept for backwards compatibility as long as the OntologyOWLIM2 plugin is kept. Use the method addAllValuesFromRestriction(ObjectProperty, OClass) instead.

Adds a new AllValuesFrom Restriction to the ontology.

Parameters:
onProperty - - Specifies the property for which the restriction is being set.
hasValue - - a resource used as a value for hasValue element of the restriction.

addAllValuesFromRestriction

AllValuesFromRestriction addAllValuesFromRestriction(ObjectProperty onProperty,
                                                     OClass theClass)

addSomeValuesFromRestriction

SomeValuesFromRestriction addSomeValuesFromRestriction(RDFProperty onProperty,
                                                       OResource hasValue)
Adds a new AllValuesFrom Restriction to the ontology. It automatically creates a randon anonymous class, which it uses to denote the restriction.

Parameters:
onProperty - - Specifies the property for which the restriction is being set.
hasValue - - a resource used as a value for hasValue element of the restriction.

addAnonymousClass

AnonymousClass addAnonymousClass()

setModified

void setModified(boolean isModified)
Sets the modified flag.

Parameters:
isModified - sets this param as a value of the modified property of the ontology

isModified

boolean isModified()
Checks the modified flag.

Specified by:
isModified in interface LanguageResource
Returns:
whether the ontology has been modified after the loading

addOntologyModificationListener

void addOntologyModificationListener(OntologyModificationListener oml)
Register the Ontology Modification Listeners


removeOntologyModificationListener

void removeOntologyModificationListener(OntologyModificationListener oml)
Removed the registered ontology modification listeners


fireResourcePropertyValueChanged

void fireResourcePropertyValueChanged(OResource resource,
                                      RDFProperty property,
                                      Object value,
                                      int eventType)
A method to invoke when a resource's property value is changed


fireResourceRelationChanged

void fireResourceRelationChanged(OResource resource1,
                                 OResource resource2,
                                 int eventType)
A method to invoke when a resource's property value is changed

Parameters:
resource1 -
resource2 -
eventType -

fireOntologyResourceAdded

void fireOntologyResourceAdded(OResource resource)
A Method to invoke an event for newly added ontology resource

Parameters:
resource -

fireOntologyResourcesRemoved

void fireOntologyResourcesRemoved(String[] resources)
A Method to invoke an event for a removed ontology resource

Parameters:
resources -

fireOntologyReset

void fireOntologyReset()
A method to invoke when the ontology is reset.


commitTransaction

@Deprecated
void commitTransaction()
Deprecated. 

Commit all changes to the ontology. This will commit all changesall the transaction (so far included after the call to start transaction) into the repository.


transationStarted

@Deprecated
boolean transationStarted()
Deprecated. 

Checks whether the transation is already started.


getSesameRepository

@Deprecated
Object getSesameRepository()
Deprecated. 

Returns the repository created for this particular instance of the ontology.


getSesameRepositoryID

@Deprecated
String getSesameRepositoryID()
Deprecated. 

Returns the ID of a Sesame Repository created for this particular instance of the ontology.


getOResourceFromMap

@Deprecated
OResource getOResourceFromMap(String uri)
Deprecated. 

Given a URI object, this method returns its equivalent object


addOResourceToMap

@Deprecated
void addOResourceToMap(String uri,
                                  OResource resource)
Deprecated. 

Adds the resource to central map


removeOResourceFromMap

@Deprecated
void removeOResourceFromMap(String uri)
Deprecated. 

Removes the resource from the central map

Parameters:
uri -

getOResourceByName

@Deprecated
OResource getOResourceByName(String resourceName)
Deprecated. 

This method checks in its cache to find out the OResource for the given resource name. However, It is also possible for two resources to have a same name but different name spaces. This method returns the first found OResource (without guaranteeing the order) from its list. If user wants to retrieve a list of resources, he/she must use the getOResourcesByName(String resourceName).


getOResourcesByName

List<OResource> getOResourcesByName(String resourceName)
This method checks in its cache to find out the OResources for the given resource name. It is possible for two resources to have a same name but different name spaces. This method returns a list of resources with the common name. Please note that deleting an instance from this list (e.g. list.remove(int/Object)) does not delete the resource from an ontology. One must use appropriate method from the Ontology interface to delete such resources.


getAllResources

@Deprecated
List<OResource> getAllResources()
Deprecated. 

This method returns a list of OResources from the ontology. Please note that deleting an instance from this list (e.g. list.remove(int/Object)) does not delete the resource from an ontology. One must use appropriate method from the Ontology interface to delete such resources.


getOResourcesWith

List<OResource> getOResourcesWith(RDFProperty aProperty,
                                  Literal aValue)
This method given a property (either an annotation or datatype), retrieves a list of resources which have the provided literal set as a value.


getOResourcesWith

List<OResource> getOResourcesWith(RDFProperty aProperty,
                                  OResource aValue)
This method given a property (either object, transitive, symmetric or rdf), retrieves a list of resources which have the provided resource set as a value.


executeQuery

@Deprecated
String executeQuery(String serqlQuery)
Deprecated. 

The method executes the query on repository and returns the toString() result of the QueryResultTable.


createTupleQuery

OntologyTupleQuery createTupleQuery(String theQuery,
                                    OConstants.QueryLanguage queryLanguage)
This method creates a OntologyTupleQuery object and passes on the specified query string in the specified query language.

Parameters:
theQuery - a String representing the tuple query.
queryLanguage - the query language, either SERQL or SPARQL
Returns:
the OntologyTurpleQuery object that can be used to retrieve the matching tuples in several formats. The query object can be re-used with different variable bindings.

createBooleanQuery

OntologyBooleanQuery createBooleanQuery(String theQuery,
                                        OConstants.QueryLanguage queryLanguage)
This method creates a OntologyBooleanQuery object and passes on the specified query string and the specified query language.

Parameters:
theQuery - a String representing the tuple query.
queryLanguage - the query language, either SERQL or SPARQL
Returns:
the OntologyBooleanQuery object that can be used to retrieve the boolean answer for the query. The query object can be re-used with different variable bindings.

getOntologyTripleStore

OntologyTripleStore getOntologyTripleStore()
Return an object representing the triple store which backs the ontology.

Returns:
The OntologyTripleStore object for this ontology or null if modifying the ontology via triples is not supported by the implementation.

createOURI

OURI createOURI(String theURI)
Create an ORUI object from the given URI string.

Parameters:
theURI - an URI or IRI string
Returns:
the OURI object representing the URI/IRI

createOURIForName

OURI createOURIForName(String resourceName)
Create an OURI from the given resource name, using the ontology base URI (default name space). This method will throw an exception if no default name space is set (i.e. if the method getDefaultNameSpace would return null).

Parameters:
resourceName - the resource name i.e. the part of the final URI/IRI that is attached to the base URI (aftaer a trailing "#" or "/").
Returns:
the OURI

generateOURI

OURI generateOURI(String resourceNamePrefix)
Generate a new unique OURI for this ontology. This generates a new OURI that is guaranteed to be unique in the ontology, using the specified resource name string as a prefix for the URI's fragement identifier and the current defaultNameSpace of the ontology as a base URI. The resource name can be null or the empty string if no prefix is wanted.

The URI fragment part that is appended to the given resourceName (if any) consists of 7 ASCII characters representing the system time in radix 36 followed by 3 ASCII characters representing a random number.

Note that this method will return an OURI that is guaranteed not to be contained in the ontology, but if called repeatedly without actually adding a resource with the newly generated OURI to the ontology, the method might, although extremely unlikely, still return the same OURI more than once. Generated OURIs should hence been used for adding resources before more OURIs are generated.

Parameters:
resourceNamePrefix - the prefix to use for the generated resource name
Returns:
a OURI object for an URI that is new and unique in the ontology

generateOURI

OURI generateOURI(String resourceNamePrefix,
                  String baseURI)
Generate a new unique OURI for this ontology. This works in the same way as generateOURI(java.lang.String) but also allows the specification of the base URI part of the final URI.

Parameters:
resourceNamePrefix - the prefix to use for the generated resource name
baseURI - the base URI to use for the final URI
Returns:
a OURI object for an URI that is new and unique in the ontology