nectec.semantic.web.knowledge.application.framework.ontologyprocessing
Class OntologyProcessing

java.lang.Object
  extended by nectec.semantic.web.knowledge.application.framework.ontologyprocessing.OntologyProcessing

public class OntologyProcessing
extends Object

Contains convenient methods for ontology processing. Make use of JENA to provide easy-to-use functions for the users.


Constructor Summary
OntologyProcessing(String filename, String defaultNamespace)
          Constructor method.
 
Method Summary
 ArrayList<String> getAllDatatypeProperties(String classname)
          Get list of all datatype properties of the given class.
 Map<String,String> getAllNamespacesMap()
          Get all the available namespace map(prefix and namespace).
 ArrayList<String> getAllObjecttypeProperties(String classname)
          Get list of all objecttype properties of the given class.
 ArrayList<String> getAllProperties(String classname)
          Get list of all properties of the given class.
 String getDefaultNamespace()
          Get the default namespace of the model.
 String getDifferentFrom(String classname)
          Get the class that is different from given class name (as described in the ontology).
 ArrayList<String> getDirectProperties(String classname)
          Get list of direct properties of the given class.
 String getDisjointWith(String classname)
          Get the class that is disjoint with given class name (as described in the ontology).
 ArrayList<String> getDomainOf(String propertyName)
          Get the domain of given property.
 String getLabelOf(String resourcename)
          Get label of the given resource.
 ArrayList<String> getListOfAllClasses()
          Get list of all classes which are available in the whole model.
 ArrayList<String> getListOfAllDatatypeProperties()
          Get list of all datatype properties which are available in the whole model.
 ArrayList<String> getListOfAllFirstLevelClasses()
          Get list of first-level classes (roots) in terms of class hierarchy.
 ArrayList<String> getListOfAllObjecttypeProperties()
          Get list of all objecttype properties which are available in the whole model.
 ArrayList<String> getListOfAllProperties()
          Get list of all properties which are available in the whole model.
 ArrayList<String> getListOfAllSubClasses(String classname)
          Get list of sub classes of the given class.
 ArrayList<String> getListOfAllSubProperties(String propertyName)
          Get list of all sub properties of the given property.
 ArrayList<String> getListOfAllSuperClasses(String classname)
          Get list of all super classes of the given class.
 ArrayList<String> getListOfAllSuperProperties(String propertyName)
          Get list of all super properties of the given property.
 ArrayList<String> getListOfDirectSubClasses(String classname)
          Get list of direct sub classes of the given class.
 ArrayList<String> getListOfDirectSubProperties(String propertyName)
          Get list of direct sub properties of the given property.
 ArrayList<String> getListOfDirectSuperClasses(String classname)
          Get list of direct super classes of the given class.
 ArrayList<String> getListOfDirectSuperProperties(String propertyName)
          Get list of direct super properties of the given property.
 ArrayList<String> getListOfSiblingClasses(String classname)
          Get list of sibling classes of the given class.
 com.hp.hpl.jena.ontology.OntModel getModel()
          Get the ontology model used.
 String getOntologyFilePath()
          Get the path containing the file from which current ontology comes from.
 String getRangeOf(String propertyName)
          Get the range of given property.
 String getSameAs(String classname)
          Get the class that is same as given class name (as described in the ontology).
 boolean isDataTypeProperty(String propertyName)
          Check whether given property is Data type property or not.
 boolean isDifferentFrom(String classname1, String classname2)
          Check the two given classes are described as different in ontology.
 boolean isDisjointWith(String classname1, String classname2)
          Check the two given classes are described as disjoint in ontology.
 boolean isObjectTypeProperty(String propertyName)
          Check whether given property is Object type property or not.
 boolean isResource(String resource)
          Check whether the given resource is a valid ontology resource in the model, or not.
 boolean isSameAs(String classname1, String classname2)
          Check the two given classes are described as same in ontology.
 void setModel(com.hp.hpl.jena.ontology.OntModel model)
          Set Internal model which represents the ontology data parsed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OntologyProcessing

public OntologyProcessing(String filename,
                          String defaultNamespace)
Constructor method.

Parameters:
filename - Location of the ontology file on system (or) URL that provides ontology file.
defaultNamespace - Default namespace of the ontology (If this is null, base namespace of the ontology is used).
Method Detail

isResource

public boolean isResource(String resource)
Check whether the given resource is a valid ontology resource in the model, or not.

Parameters:
resource - Resource to be checked.
Returns:
true (It is a valid resource) or false (It is not a valid resource).

getListOfAllClasses

public ArrayList<String> getListOfAllClasses()
Get list of all classes which are available in the whole model.

Returns:
Collection of classes.

getListOfAllDatatypeProperties

public ArrayList<String> getListOfAllDatatypeProperties()
Get list of all datatype properties which are available in the whole model.

Returns:
Collection of properties.

getListOfAllObjecttypeProperties

public ArrayList<String> getListOfAllObjecttypeProperties()
Get list of all objecttype properties which are available in the whole model.

Returns:
Collection of properties.

getListOfAllProperties

public ArrayList<String> getListOfAllProperties()
Get list of all properties which are available in the whole model.

Returns:
Collection of properties.

getAllDatatypeProperties

public ArrayList<String> getAllDatatypeProperties(String classname)
Get list of all datatype properties of the given class.

Parameters:
classname - Class of interest.
Returns:
Collection of properties that belong to the given class.

getAllObjecttypeProperties

public ArrayList<String> getAllObjecttypeProperties(String classname)
Get list of all objecttype properties of the given class.

Parameters:
classname - Class of interest.
Returns:
Collection of properties that belong to the given class.

getAllProperties

public ArrayList<String> getAllProperties(String classname)
Get list of all properties of the given class.

Parameters:
classname - Class of interest.
Returns:
Collection of properties that belong to the given class.

getDirectProperties

public ArrayList<String> getDirectProperties(String classname)
Get list of direct properties of the given class.

Parameters:
classname - Class of interest.
Returns:
Collection of properties that belong to the given class.

getListOfAllSubClasses

public ArrayList<String> getListOfAllSubClasses(String classname)
Get list of sub classes of the given class.

Parameters:
classname - Class of interest.
Returns:
Collection of sub classes of the given class.

getListOfAllFirstLevelClasses

public ArrayList<String> getListOfAllFirstLevelClasses()
Get list of first-level classes (roots) in terms of class hierarchy.

Returns:
Collection of first-level classes (roots).

getListOfDirectSubClasses

public ArrayList<String> getListOfDirectSubClasses(String classname)
Get list of direct sub classes of the given class.

Parameters:
classname - Class of interest.
Returns:
Collection of direct sub classes of the given class.

getListOfAllSuperClasses

public ArrayList<String> getListOfAllSuperClasses(String classname)
Get list of all super classes of the given class.

Parameters:
classname - Class of interest.
Returns:
Collection of super classes of the given class.

getListOfDirectSuperClasses

public ArrayList<String> getListOfDirectSuperClasses(String classname)
Get list of direct super classes of the given class.

Parameters:
classname - Class of interest.
Returns:
Collection of direct super classes of the given class.

getListOfSiblingClasses

public ArrayList<String> getListOfSiblingClasses(String classname)
Get list of sibling classes of the given class.

Parameters:
classname - Class of interest.
Returns:
Collection of sibling classes of the given class.

getListOfAllSubProperties

public ArrayList<String> getListOfAllSubProperties(String propertyName)
Get list of all sub properties of the given property.

Parameters:
propertyName - Property of interest.
Returns:
Collection of all sub properties of the given property.

getListOfDirectSubProperties

public ArrayList<String> getListOfDirectSubProperties(String propertyName)
Get list of direct sub properties of the given property.

Parameters:
propertyName - Property of interest.
Returns:
Collection of direct sub properties of the given property.

getListOfAllSuperProperties

public ArrayList<String> getListOfAllSuperProperties(String propertyName)
Get list of all super properties of the given property.

Parameters:
propertyName - Property of interest.
Returns:
Collection of all super properties the given property.

getListOfDirectSuperProperties

public ArrayList<String> getListOfDirectSuperProperties(String propertyName)
Get list of direct super properties of the given property.

Parameters:
property - Property of interest.
Returns:
COllection of direct super properties of the given property.

getLabelOf

public String getLabelOf(String resourcename)
Get label of the given resource.

Parameters:
resourcename - Resource of interest.
Returns:
Label of the resource.

getDomainOf

public ArrayList<String> getDomainOf(String propertyName)
Get the domain of given property. (e.g. given "has_status", it returns "Person" from the statement Person has_status HealthStatus)

Parameters:
propertyName - Property of interest.
Returns:
Collection of the domains of the given property.

getRangeOf

public String getRangeOf(String propertyName)
Get the range of given property. (e.g. given "has_status", it returns "HealthStatus" from the statement Person has_status HealthStatus)

Parameters:
propertyName - Property of interest.
Returns:
Range of the given property.

setModel

public void setModel(com.hp.hpl.jena.ontology.OntModel model)
Set Internal model which represents the ontology data parsed.

Parameters:
model - Model which contains ontology data.

getDefaultNamespace

public String getDefaultNamespace()
Get the default namespace of the model.

Returns:
Default namespace.

getOntologyFilePath

public String getOntologyFilePath()
Get the path containing the file from which current ontology comes from.

Returns:
Ontology file path on the system.

isObjectTypeProperty

public boolean isObjectTypeProperty(String propertyName)
Check whether given property is Object type property or not.

Parameters:
property - Property of interest.
Returns:
true (It is an object type property) or false (It is not an object type property)

isDataTypeProperty

public boolean isDataTypeProperty(String propertyName)
Check whether given property is Data type property or not.

Parameters:
propertyName - Property of interest.
Returns:
true (It is an data type property) or false (It is not an data type property)

getAllNamespacesMap

public Map<String,String> getAllNamespacesMap()
Get all the available namespace map(prefix and namespace).

Returns:
Map that contains pairs of prefix and namespace.

isSameAs

public boolean isSameAs(String classname1,
                        String classname2)
Check the two given classes are described as same in ontology.

Parameters:
classname1 - Class 1.
classname2 - Class 2.
Returns:
true (Two classes are same) or false (Two classes are not same).

isDifferentFrom

public boolean isDifferentFrom(String classname1,
                               String classname2)
Check the two given classes are described as different in ontology.

Parameters:
classname1 - Class 1.
classname2 - Class 2.
Returns:
true (Two classes are different) or false (Two classes are not different).

isDisjointWith

public boolean isDisjointWith(String classname1,
                              String classname2)
Check the two given classes are described as disjoint in ontology.

Parameters:
classname1 - Class 1.
classname2 - Class 2.
Returns:
true (Two classes are disjoint) or false (Two classes are not disjoint).

getSameAs

public String getSameAs(String classname)
Get the class that is same as given class name (as described in the ontology).

Parameters:
classname - Given class of interest.
Returns:
Class name that is described in ontology as same as given class.

getDifferentFrom

public String getDifferentFrom(String classname)
Get the class that is different from given class name (as described in the ontology).

Parameters:
classname - Given class of interest.
Returns:
Class name that is described in ontology as different from given class.

getDisjointWith

public String getDisjointWith(String classname)
Get the class that is disjoint with given class name (as described in the ontology).

Parameters:
classname - Given class of interest.
Returns:
Class name that is described in ontology as disjoint with given class.

getModel

public com.hp.hpl.jena.ontology.OntModel getModel()
Get the ontology model used.

Returns: