public final class OntologyManagement extends Object
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()
.
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
String |
getRegisteringModuleID(String ontURI) |
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 |
isRegisteredOntology(String ontURI)
Test if an ontology URI is already 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.
|
public static OntologyManagement getInstance()
public boolean register(ModuleContext mc, Ontology ont)
ont
- the ontology.public Resource getNamedResource(String instanceURI)
instanceURI
- URI of the instance.public Resource getResource(String classURI, String instanceURI)
classURI
- The URI of the class.instanceURI
- The URI of the instance.getNamedResource(String)
public String getMostSpecializedClass(String[] classURIs)
classURIs
- The set of URIs of classes.public Set<String> getNamedSubClasses(String superClassURI, boolean inherited, boolean includeAbstractClasses)
superClassURI
- URI of the super class.inherited
- false, iff only direct sub classes should be
considered.includeAbstractClasses
- true, iff abstract classes should be included.public void unregister(ModuleContext mc, Ontology ont)
ont
- The ontology to unregister.public Ontology getOntology(String uri)
register(org.universAAL.middleware.container.ModuleContext, Ontology)
.uri
- URI of the ontology.public RDFClassInfo getRDFClassInfo(String classURI, boolean includeOntClasses)
classURI
- URI of the class.includeOntClasses
- true, if OWL classes should be included.getOntClassInfo(String)
public OntClassInfo getOntClassInfo(String classURI)
classURI
- URI of the class.getRDFClassInfo(String, boolean)
public boolean isRegisteredClass(String classURI, boolean includePending)
classURI
- URI of the class.includePending
- If true, classes from pending ontologies are also
considered.public String[] getOntoloyURIs()
public boolean isRegisteredOntology(String ontURI)
ontURI
- The URI of the ontology to check if it is already registeredpublic boolean checkPermission(String uri)
uri
- URI of the ontology.public void addOntologyListener(ModuleContext owner, OntologyListener listener)
owner
- the ModuleContext
of the caller of this method.listener
- the listener to add.public void removeOntologyListener(ModuleContext owner, OntologyListener listener)
owner
- the ModuleContext
of the caller of this method.listener
- the listener to remove.Copyright © 2018 universAAL Consortium. All rights reserved.