|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object es.ucm.fdi.gaia.ontobridge.OntoBridge
public class OntoBridge
Main OntoBridge Class
This class provides a simple wrapper for JENA.
It allows connecting to PELLET reasoner or any other that supports the DIG protocol.
Instead of using JENA classes this class returns strings containing the URIs
of the elements in the ontology.
Input parameters of the methods use URIs (or the qualified short representation) for
pointing to the ontology elements.
Conversion between URIs and JENA objects is managed automatically
Constructor Summary | |
---|---|
OntoBridge()
Creates an OntoBridge object. |
Method Summary | |
---|---|
void |
createClass(java.lang.String className)
Create a new class in the ontology. |
void |
createDataTypeProperty(java.lang.String sourceInstance,
java.lang.String propertyName,
java.lang.Object value)
Creates an dataType property between two instances. |
void |
createDataTypeProperty(java.lang.String sourceInstance,
java.lang.String propertyName,
java.lang.String value,
java.lang.String valueDataType)
Creates an dataType property between two instances. |
void |
createInstance(java.lang.String className,
java.lang.String instanceName)
Creates a new instance of a class. |
void |
createOntProperty(java.lang.String sourceInstance,
java.lang.String propertyName,
java.lang.String destInstance)
Creates an ontology property between two instances. |
boolean |
existsClass(java.lang.String name)
Returns if a class exists |
boolean |
existsInstance(java.lang.String name)
Returns if an instance exists |
boolean |
existsProperty(java.lang.String name)
Returns if a property exists |
java.lang.String |
getShortName(java.lang.String URI)
Returns the short form of an URI. |
java.lang.String |
getURI(java.lang.String shortName)
Returns the long URI form of a short name |
void |
initWithDIGReasoner(java.lang.String reasonerHost,
int reasonerPort)
Inits the OntoBridge with a DIG reasoner. |
void |
initWithOutReasoner()
Inits the OntoBridge without reasoner. |
void |
initWithPelletReasoner()
Inits the OntoBridge with the PELLET Reasoner |
boolean |
isInstanceOf(java.lang.String instance,
java.lang.String ontclass)
Checks if an instance belongs to a class |
boolean |
isOntoProperty(java.lang.String property)
Checks if a proporty is an OntologyProperty instead of a DataTypeProperty |
boolean |
isSubClassOf(java.lang.String subclass,
java.lang.String superclass)
Checks if a class is subclass of other |
java.util.Iterator<java.lang.String> |
listAllandAnonClasses()
Lists all the classes of the ontology including anonymous classes |
java.util.Iterator<java.lang.String> |
listAllClasses()
Lists all the no anonymous classes of the ontology |
java.util.Iterator<java.lang.String> |
listBelongingClasses(java.lang.String instance)
Lists the classes that an instance belongs to |
java.util.Iterator<java.lang.String> |
listComplementClasses()
Lists the complement classes of the ontology |
java.util.Iterator<java.lang.String> |
listDeclaredInstances(java.lang.String ontClass)
List the declared (not inferred) instances of a class |
java.util.Iterator<java.lang.String> |
listEnumeratedClasses()
Lists the enumerated classes of the ontology |
java.util.Iterator<java.lang.String> |
listInstanceProperties(java.lang.String instance)
Lists the properties of an instance |
void |
listInstancePropertiesValues(java.lang.String instance,
java.util.List<java.lang.String> properties,
java.util.List<java.lang.String> values)
Returns the properties with their corresponding values of an instance. |
java.util.Iterator<java.lang.String> |
listInstances(java.lang.String ontClass)
List the instances of a class |
java.util.Iterator<java.lang.String> |
listIntersectionClasses()
Lists the intersection classes of the ontology |
java.util.Iterator<java.lang.String> |
listProperties(java.lang.String ontClass)
Lists the properties applicable to a class |
java.util.Iterator<java.lang.String> |
listPropertyRange(java.lang.String property)
Lists the classes on the range of a property |
java.util.Iterator<java.lang.String> |
listPropertyValue(java.lang.String instance,
java.lang.String property)
Lists the instances that are the values of a property of an instance. |
java.util.Iterator<java.lang.String> |
listRestrictions()
Lists the restrictions of the ontology |
java.util.Iterator<java.lang.String> |
listRootClasses()
Lists the hierarchy root classes of the ontology |
java.util.Iterator<java.lang.String> |
listSpecificProperties(java.lang.String ontClass)
Lists the specific properties of class. |
java.util.Iterator<java.lang.String> |
listSubClasses(java.lang.String ontClass,
boolean direct)
Lists the subclasses of a class. |
java.util.Iterator<java.lang.String> |
listSuperClasses(java.lang.String ontClass,
boolean direct)
Lists the superclasses (parents) of a class. |
java.util.Iterator<java.lang.String> |
listUnionClasses()
Lists the union classes of the ontology |
void |
loadOntology(OntologyDocument mainOntology,
java.util.Collection<OntologyDocument> subOntologies,
boolean loadSubOntologies)
Loads an ontology using the initialized reasoner |
void |
save(java.lang.String fileName)
Saves the ontology (without imported ontologies data) into a file. |
void |
setSubClass(java.lang.String subClass,
java.lang.String superClass)
Sets a class as subclass of other. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OntoBridge()
Method Detail |
---|
public void initWithPelletReasoner()
public void initWithDIGReasoner(java.lang.String reasonerHost, int reasonerPort)
reasonerHost
- Host where the reasoner is running.reasonerPort
- Port that the reasoner listens to.public void initWithOutReasoner()
public void loadOntology(OntologyDocument mainOntology, java.util.Collection<OntologyDocument> subOntologies, boolean loadSubOntologies)
mainOntology
- Main ontology documentsubOntologies
- Collection of ontology documents used by the main ontologyloadSubOntologies
- Indicates if the reasoner must load the subOntologies.
If loaded, their content is included in the reasoning graph of the main ontology graph.public java.util.Iterator<java.lang.String> listAllClasses()
public java.util.Iterator<java.lang.String> listAllandAnonClasses()
public java.util.Iterator<java.lang.String> listEnumeratedClasses()
public java.util.Iterator<java.lang.String> listUnionClasses()
public java.util.Iterator<java.lang.String> listComplementClasses()
public java.util.Iterator<java.lang.String> listIntersectionClasses()
public java.util.Iterator<java.lang.String> listRestrictions()
public java.util.Iterator<java.lang.String> listRootClasses()
public java.util.Iterator<java.lang.String> listSubClasses(java.lang.String ontClass, boolean direct)
ontClass
- class parent of the classes user is asking fordirect
- return only direct subclassespublic java.util.Iterator<java.lang.String> listSuperClasses(java.lang.String ontClass, boolean direct)
ontClass
- subclass of the classes user is asking fordirect
- return only direct subclassespublic java.util.Iterator<java.lang.String> listInstances(java.lang.String ontClass)
ontClass
- class that instances belong topublic java.util.Iterator<java.lang.String> listDeclaredInstances(java.lang.String ontClass)
ontClass
- class that instances belong topublic java.util.Iterator<java.lang.String> listBelongingClasses(java.lang.String instance)
instance
- instance asked for belonging classespublic boolean isSubClassOf(java.lang.String subclass, java.lang.String superclass)
subclass
- subclassssuperclass
- superclasspublic boolean isInstanceOf(java.lang.String instance, java.lang.String ontclass)
instance
- instanceontclass
- classpublic boolean isOntoProperty(java.lang.String property)
property
-
public java.util.Iterator<java.lang.String> listProperties(java.lang.String ontClass)
ontClass
- class in the domain of the listed propertiespublic java.util.Iterator<java.lang.String> listSpecificProperties(java.lang.String ontClass)
ontClass
- class in the domain of the listed propertiespublic java.util.Iterator<java.lang.String> listPropertyRange(java.lang.String property)
property
- property user is asking for its rangepublic java.util.Iterator<java.lang.String> listPropertyValue(java.lang.String instance, java.lang.String property)
instance
- instance origin of the propertyproperty
- propertypublic java.util.Iterator<java.lang.String> listInstanceProperties(java.lang.String instance)
instance
- source of the propertiespublic void listInstancePropertiesValues(java.lang.String instance, java.util.List<java.lang.String> properties, java.util.List<java.lang.String> values)
instance
- source of the propertiesproperties
- Array containing the name of the propertiesvalues
- Array containing the value of the propertypublic java.lang.String getShortName(java.lang.String URI)
public java.lang.String getURI(java.lang.String shortName)
public boolean existsClass(java.lang.String name)
public boolean existsProperty(java.lang.String name)
public boolean existsInstance(java.lang.String name)
public void createClass(java.lang.String className)
className
- Class to createpublic void setSubClass(java.lang.String subClass, java.lang.String superClass)
subClass
- superClass
- public void createInstance(java.lang.String className, java.lang.String instanceName)
className
- instanceName
- public void createOntProperty(java.lang.String sourceInstance, java.lang.String propertyName, java.lang.String destInstance)
sourceInstance
- propertyName
- destInstance
- public void createDataTypeProperty(java.lang.String sourceInstance, java.lang.String propertyName, java.lang.Object value)
sourceInstance
- propertyName
- value
- The value of the property. The method tries to find the proper datatype for this object.public void createDataTypeProperty(java.lang.String sourceInstance, java.lang.String propertyName, java.lang.String value, java.lang.String valueDataType)
sourceInstance
- propertyName
- value
- The value of the property.valueDataType
- DataType of the valuepublic void save(java.lang.String fileName)
fileName
- file path for saving the ontology
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |