org.universAAL.middleware.owl
Class OntologyManagement

Package class diagram package OntologyManagement
java.lang.Object
  extended by org.universAAL.middleware.owl.OntologyManagement

public final class OntologyManagement
extends Object

The Ontology Management mainly serves two purposes:

  1. Management of ontologies
  2. Providing a global view on all ontological information

The management of ontologies is achieved by providing methods to register and unregister an ontology as well as to query information about ontologies, i.e. to get a list of URIs of all registered ontologies with getOntoloyURIs() and to get a specific ontology with getOntology(String).

To add a new ontology, the method Ontology.create() has to be overwritten and the ontology needs to be registered by calling register(org.universAAL.middleware.container.ModuleContext, Ontology) . The ontology is then added to the internal list of pending ontologies. That means, that the information of the ontology is available for some special methods (e.g. isRegisteredClass(String, boolean)) to provide the possibility to create instances of the classes of that ontology. Then, the create() method is called to actually create all this information. If create() returns without errors, the ontology is removed from the list of pending ontologies and is then available in the system.

Ontological information can be distributed in different ontologies, e.g. one ontology can define a class and a different ontology can extend this class by adding some properties. The second purpose of the OntologyManagement is to provide a combined view on all this information as if all was defined in only one ontology.

OntologyManagement implements the Singleton design pattern. To get an instance of this class and be able to call the methods, call getInstance().

Author:
Carsten Stockloew

Method Summary
 void addOntologyListener(ModuleContext owner, OntologyListener listener)
          Add a new ontology listener.
 boolean checkPermission(String uri)
          Internal method.
static OntologyManagement getInstance()
          Get the Singleton instance.
 String getMostSpecializedClass(String[] classURIs)
          For a given set of URIs get the class that is most specialized, i.e. all other classes are super classes of this class.
 Resource getNamedResource(String instanceURI)
          Get a named resource.
 Set<String> getNamedSubClasses(String superClassURI, boolean inherited, boolean includeAbstractClasses)
          Get the URIs of all sub classes of the given class.
 OntClassInfo getOntClassInfo(String classURI)
          Get the model information of an OWL class.
 Ontology getOntology(String uri)
          Get an ontology by its URI.
 String[] getOntoloyURIs()
          Get the set of URIs of all registered ontologies.
 RDFClassInfo getRDFClassInfo(String classURI, boolean includeOntClasses)
          Get the model information of an RDF class.
 Resource getResource(String classURI, String instanceURI)
          Get a Resource with the given class and instance URI.
 boolean isRegisteredClass(String classURI, boolean includePending)
          Determines whether an OWL class is registered.
 boolean register(ModuleContext mc, Ontology ont)
          Register a new ontology.
 void removeOntologyListener(ModuleContext owner, OntologyListener listener)
          Remove an existing ontology listener.
 void unregister(ModuleContext mc, Ontology ont)
          Unregister an ontology.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static OntologyManagement getInstance()
Get the Singleton instance.

Returns:
The Singleton instance.

register

public boolean register(ModuleContext mc,
                        Ontology ont)
Register a new ontology.

Parameters:
ont - the ontology.
Returns:
false, if the Ontology is already available.

getNamedResource

public Resource getNamedResource(String instanceURI)
Get a named resource. A named resource is a registered instance of an OWL or RDF class.

Parameters:
instanceURI - URI of the instance.
Returns:
The instance.

getResource

public Resource getResource(String classURI,
                            String instanceURI)
Get a Resource with the given class and instance URI.

Parameters:
classURI - The URI of the class.
instanceURI - The URI of the instance.
Returns:
The Resource object with the given 'instanceURI', or a new Resource, if it does not exist.
See Also:
getNamedResource(String)

getMostSpecializedClass

public String getMostSpecializedClass(String[] classURIs)
For a given set of URIs get the class that is most specialized, i.e. all other classes are super classes of this class. The method can be used for transformations to/from other representations, e.g. turtle, jena, and it considers both, RDF classes and OWL classes.

Parameters:
classURIs - The set of URIs of classes.
Returns:
The URI of the most specialized class.

getNamedSubClasses

public Set<String> getNamedSubClasses(String superClassURI,
                                      boolean inherited,
                                      boolean includeAbstractClasses)
Get the URIs of all sub classes of the given class.

Parameters:
superClassURI - URI of the super class.
inherited - false, iff only direct sub classes should be considered.
includeAbstractClasses - true, iff abstract classes should be included.
Returns:
The set of URIs of all sub classes.

unregister

public void unregister(ModuleContext mc,
                       Ontology ont)
Unregister an ontology.

Parameters:
ont - The ontology to unregister.

getOntology

public Ontology getOntology(String uri)
Get an ontology by its URI. The ontology must be registered by calling register(org.universAAL.middleware.container.ModuleContext, Ontology) .

Parameters:
uri - URI of the ontology.
Returns:
The ontology.

getRDFClassInfo

public RDFClassInfo getRDFClassInfo(String classURI,
                                    boolean includeOntClasses)
Get the model information of an RDF class.

Parameters:
classURI - URI of the class.
includeOntClasses - true, if OWL classes should be included.
Returns:
The model information.
See Also:
getOntClassInfo(String)

getOntClassInfo

public OntClassInfo getOntClassInfo(String classURI)
Get the model information of an OWL class.

Parameters:
classURI - URI of the class.
Returns:
The model information.
See Also:
getRDFClassInfo(String, boolean)

isRegisteredClass

public boolean isRegisteredClass(String classURI,
                                 boolean includePending)
Determines whether an OWL class is registered. It is registered if it is defined or extended in one of the registered ontologies.

Parameters:
classURI - URI of the class.
includePending - If true, classes from pending ontologies are also considered.
Returns:
true, iff the class is registered.

getOntoloyURIs

public String[] getOntoloyURIs()
Get the set of URIs of all registered ontologies.

Returns:
an array with the URIs of all registered ontologies.

checkPermission

public boolean checkPermission(String uri)
Internal method. Used to verify that an ontology is currently in the registration phase.

Parameters:
uri - URI of the ontology.
Returns:
true, iff the ontology is currently in the registration phase.

addOntologyListener

public void addOntologyListener(ModuleContext owner,
                                OntologyListener listener)
Add a new ontology listener. This listener is notified when a change in ontology management occurs.

Parameters:
owner - the ModuleContext of the caller of this method.
listener - the listener to add.

removeOntologyListener

public void removeOntologyListener(ModuleContext owner,
                                   OntologyListener listener)
Remove an existing ontology listener. This listener is notified when a change in ontology management occurs.

Parameters:
owner - the ModuleContext of the caller of this method.
listener - the listener to remove.


Copyright © 2014 universAAL Consortium. All Rights Reserved.