it.polito.elite.ontology
Class OntologyAbstraction

java.lang.Object
  extended by it.polito.elite.ontology.OntologyAbstraction
Direct Known Subclasses:
OWLOntologyWrapper

public abstract class OntologyAbstraction
extends java.lang.Object


Field Summary
protected  java.util.logging.Logger log
           
 
Constructor Summary
protected OntologyAbstraction()
           
 
Method Summary
abstract  boolean addAnnotationProperty4URI(java.lang.String uri, java.lang.String property, java.lang.Object value)
          Adds an annotation property of type property, having object as value, referred to a given concept (OWL class)
abstract  boolean canQuery()
           
abstract  void confirmLogicViewSupport()
           
abstract  NodeTypeAbstraction createNodeTypeAbstraction(NodeTypesEnum t, java.lang.String expression)
          It is sufficient that it handles NamedClasses and NamedInstances
static OntologyAbstraction createOntologyAbstraction(edu.stanford.smi.protege.model.KnowledgeBase kb)
           
abstract  java.util.HashSet<java.lang.String> getAllClasses(boolean listImportedClasses)
          Returns all the classes (concepts) in a knowldge base
abstract  java.util.HashSet<java.lang.String> getAllInstances()
          A method for getting all the instances in the ontology (for a RDF/RDFS model)
abstract  java.util.Hashtable<java.lang.String,RelationType> getAllRelations(boolean listImported)
          Lists all the slots declared in a protege knowledge base, excluding the imported slots if listImported is true.
abstract  java.util.Hashtable<java.lang.String,java.lang.Object> getAnnotationProperties(java.lang.String resourceURI, boolean isNamedClass)
          A method that returns an hashtable containing all the annotations relative to the input class
abstract  java.util.Hashtable<java.lang.String,java.util.HashSet<RelationData>> getDatatypeProperties(java.lang.String concept)
          A method that, given the name of a concept, provides as result a Hastable containing the couples datatype property, xsd type for each datatype property which has the given concept as domain.
abstract  java.util.Hashtable<java.lang.String,java.util.HashSet<NodeTypeAbstraction>> getInstancesDatatypeProperties(java.lang.String instance)
          A method that, given the name of a concept, provides as result a Hastable containing the couples datatype property, value for each datatype property which has the given concept as domain.
abstract  java.util.Hashtable<java.lang.String,java.util.HashSet<NodeTypeAbstraction>> getInstancesObjectProperties(java.lang.String instance)
          Returns an Hashtable containing for each instance "linked" to the instance i, a Set of objectProperties that start from i and reach the "linked" instance (usually such set is composed by only one objectProperty).
abstract  java.util.HashSet<java.lang.String> getInstancesOfConcept(java.lang.String concept)
          A method for getting all the instances of a concept in the ontology (for a RDF/RDFS model)
abstract  int getNumberOfSubClasses(java.lang.String clsName)
          A method that provides the number of direct subclasses for a given class (identified by its name)
abstract  java.util.Hashtable<java.lang.String,java.util.HashSet<RelationData>> getObjectProperties(java.lang.String uri, boolean direct, boolean listImportedClass)
          Give the uri of a class, returns an hashtable of relations starting from the class together with an Hashset of endnodes for each relations (relationUri, EndNodes)
abstract  NodeTypeAbstraction getPropertyRange(java.lang.String uri)
           
abstract  RelationType getRelationType(java.lang.String relURI)
          A method that tells if a relation is towards a literal
abstract  java.util.Hashtable<java.lang.String,java.util.HashSet<NodeTypeAbstraction>> getRestrictions(java.lang.String clsURI)
          Retrieves restrictions specified for the concept identified by a given URI
abstract  java.util.HashSet<java.lang.String> getRoots(boolean listImportedClasses)
          Lists all the root classes of the ontology (leaved here for backward compatibility)
abstract  java.util.HashSet<java.lang.String> getSubClasses(java.lang.String clsName)
          A method for retrieving all the subclasses of a given class given its name
abstract  java.util.HashSet<java.lang.String> getSuperClasses(java.lang.String clsName)
          A method for retrieving all the superclasses of a given class given its name
abstract  boolean hasInstances(java.lang.String concept)
          A method for checking if a given concept c has some instances or not
abstract  boolean removeAnnotationProperty4URI(java.lang.String clsURI, java.lang.String property, java.lang.Object value)
          Remove an annotation property of type property, having object as value, referred to a given concept (OWL class)
 void setLoggingLevel(java.lang.String lv)
          Sets the logging level for the OntologyAbstraction class, allowed levels include: INFO (default)OFFFINE FINESTWARNINGSEVERE
abstract  void setLogicalConstraints(java.lang.String clsURI, ConceptData data)
           
abstract  void setLogicalConstraints(java.lang.String instanceURI, InstanceData data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected java.util.logging.Logger log
Constructor Detail

OntologyAbstraction

protected OntologyAbstraction()
Method Detail

addAnnotationProperty4URI

public abstract boolean addAnnotationProperty4URI(java.lang.String uri,
                                                  java.lang.String property,
                                                  java.lang.Object value)
Adds an annotation property of type property, having object as value, referred to a given concept (OWL class)

Parameters:
uri - the URI of the concept
property - The name of the annotation property we want to add
value - The value of the annotation
Returns:
true on success, false if the operation fails

canQuery

public abstract boolean canQuery()

confirmLogicViewSupport

public abstract void confirmLogicViewSupport()

createNodeTypeAbstraction

public abstract NodeTypeAbstraction createNodeTypeAbstraction(NodeTypesEnum t,
                                                              java.lang.String expression)
It is sufficient that it handles NamedClasses and NamedInstances

Parameters:
t - type
expression - the expression (at now the URI of concept/individual)
Returns:
NodeTypeAbstraction

createOntologyAbstraction

public static OntologyAbstraction createOntologyAbstraction(edu.stanford.smi.protege.model.KnowledgeBase kb)

getAllClasses

public abstract java.util.HashSet<java.lang.String> getAllClasses(boolean listImportedClasses)
Returns all the classes (concepts) in a knowldge base

Parameters:
listImportedClasses - true if also imported classes should be shown
Returns:
a HashSet containing the names of all the classes in the knowledge base

getAllInstances

public abstract java.util.HashSet<java.lang.String> getAllInstances()
A method for getting all the instances in the ontology (for a RDF/RDFS model)

Returns:
the HashSet containing all the instances of a given ontology

getAllRelations

public abstract java.util.Hashtable<java.lang.String,RelationType> getAllRelations(boolean listImported)
Lists all the slots declared in a protege knowledge base, excluding the imported slots if listImported is true. (In this version, listImported is actually ignored)

Parameters:
listImported - true if slots coming from imported classes shall be shown
Returns:
an Hastable containing the name of the slots together with information about the relation type (as if the relation if functional or transitive or symmetric...)

getAnnotationProperties

public abstract java.util.Hashtable<java.lang.String,java.lang.Object> getAnnotationProperties(java.lang.String resourceURI,
                                                                                               boolean isNamedClass)
A method that returns an hashtable containing all the annotations relative to the input class

Parameters:
resourceURI - the class or the property we want to extract annotation properties from
Returns:
an Hashtable containing property name and value

getDatatypeProperties

public abstract java.util.Hashtable<java.lang.String,java.util.HashSet<RelationData>> getDatatypeProperties(java.lang.String concept)
A method that, given the name of a concept, provides as result a Hastable containing the couples datatype property, xsd type for each datatype property which has the given concept as domain.

Parameters:
concept -
Returns:
the hashtable of datatype properties for concept together with their xsd type

getInstancesDatatypeProperties

public abstract java.util.Hashtable<java.lang.String,java.util.HashSet<NodeTypeAbstraction>> getInstancesDatatypeProperties(java.lang.String instance)
A method that, given the name of a concept, provides as result a Hastable containing the couples datatype property, value for each datatype property which has the given concept as domain.

Parameters:
instance - A String representing the instance URI
Returns:
the hashtable of datatype properties for concept together with their xsd type

getInstancesObjectProperties

public abstract java.util.Hashtable<java.lang.String,java.util.HashSet<NodeTypeAbstraction>> getInstancesObjectProperties(java.lang.String instance)
Returns an Hashtable containing for each instance "linked" to the instance i, a Set of objectProperties that start from i and reach the "linked" instance (usually such set is composed by only one objectProperty).

Parameters:
instance - the instance i
Returns:
the hashtable of linked instances

getInstancesOfConcept

public abstract java.util.HashSet<java.lang.String> getInstancesOfConcept(java.lang.String concept)
A method for getting all the instances of a concept in the ontology (for a RDF/RDFS model)

Parameters:
concept - The concept URI
Returns:
the HashSet containing all the instances of a given concept

getNumberOfSubClasses

public abstract int getNumberOfSubClasses(java.lang.String clsName)
A method that provides the number of direct subclasses for a given class (identified by its name)

Parameters:
clsName - the name of the class
Returns:
the number of subclasses as an int

getObjectProperties

public abstract java.util.Hashtable<java.lang.String,java.util.HashSet<RelationData>> getObjectProperties(java.lang.String uri,
                                                                                                          boolean direct,
                                                                                                          boolean listImportedClass)
Give the uri of a class, returns an hashtable of relations starting from the class together with an Hashset of endnodes for each relations (relationUri, EndNodes)

Parameters:
uri - the uri of the starting class
direct - --direct relations only (currently ignored)
listImportedClass - -- show system classes or not (to be deprecated)
Returns:
(relationUri <Uri>, EndNodes <HashSet>)

getPropertyRange

public abstract NodeTypeAbstraction getPropertyRange(java.lang.String uri)

getRelationType

public abstract RelationType getRelationType(java.lang.String relURI)
A method that tells if a relation is towards a literal

Returns:
a RelationType

getRestrictions

public abstract java.util.Hashtable<java.lang.String,java.util.HashSet<NodeTypeAbstraction>> getRestrictions(java.lang.String clsURI)
Retrieves restrictions specified for the concept identified by a given URI

Parameters:
clsURI - The URI of the concept
Returns:
an HashSet of NodeTypeAbstraction Objects

getRoots

public abstract java.util.HashSet<java.lang.String> getRoots(boolean listImportedClasses)
Lists all the root classes of the ontology (leaved here for backward compatibility)

Parameters:
listImportedClasses - true if also imported classes should be shown
Returns:
an Iterator over the names of all the root classes in the knowledge base

getSubClasses

public abstract java.util.HashSet<java.lang.String> getSubClasses(java.lang.String clsName)
A method for retrieving all the subclasses of a given class given its name

Parameters:
clsName - the class name
Returns:
an Iterator <String> over the subclasses names

getSuperClasses

public abstract java.util.HashSet<java.lang.String> getSuperClasses(java.lang.String clsName)
A method for retrieving all the superclasses of a given class given its name

Parameters:
clsName - the class name
Returns:
an Iterator <String> over the superclasses names

hasInstances

public abstract boolean hasInstances(java.lang.String concept)
A method for checking if a given concept c has some instances or not

Parameters:
concept - the concept for which instances might exist
Returns:
true if it has some instances, false otherwise

removeAnnotationProperty4URI

public abstract boolean removeAnnotationProperty4URI(java.lang.String clsURI,
                                                     java.lang.String property,
                                                     java.lang.Object value)
Remove an annotation property of type property, having object as value, referred to a given concept (OWL class)

Parameters:
clsURI - the URI of the concept
property - The name of the annotation property we want to remove
value - The value of the annotation
Returns:
true on success, false if the removal fails

setLoggingLevel

public void setLoggingLevel(java.lang.String lv)
Sets the logging level for the OntologyAbstraction class, allowed levels include:
  • INFO (default)
  • OFF
  • FINE
  • FINEST
  • WARNING
  • SEVERE

Parameters:
lv - - The logging level

setLogicalConstraints

public abstract void setLogicalConstraints(java.lang.String clsURI,
                                           ConceptData data)

setLogicalConstraints

public abstract void setLogicalConstraints(java.lang.String instanceURI,
                                           InstanceData data)