it.polito.elite.doseWS.wrappers
Class OntologyImpl

java.lang.Object
  extended byit.polito.elite.doseWS.wrappers.OntologyImpl
All Implemented Interfaces:
Ontology

public class OntologyImpl
extends java.lang.Object
implements Ontology

The Ontology wrapper.

Author:
Federico Pescarmona

Constructor Summary
OntologyImpl()
          Constructor.
OntologyImpl(java.lang.String resource, boolean isURI)
           
 
Method Summary
 java.util.Vector getAllClasses()
          Provides a Vector containing all ontology concepts as URIs.
 java.util.Hashtable getAllRelations()
          Returns all relations of the ontology with their weights.
 java.lang.String getDefinition(java.lang.String topicURI, java.lang.String language)
          Returns the language-dependent definition of a concept.
 java.lang.String getLabel(java.lang.String uri)
          Retrieved the label of an ontology concept, given the URI.
 int getNumberOfSubClasses(java.lang.String uri)
          Counts the number of sons for a given concept.
 com.hp.hpl.jena.ontology.OntClass getOntClass(java.lang.String uri)
          Returns the Ontology class.
 java.util.Vector getRelationEnds(java.lang.String nodeURI, java.lang.String relationURI)
          Given a concept and a relation, returns an Iterator over the classes the source concept is related to (through the given relation).
 java.util.Set getRoots()
           
 java.util.Iterator getSubClasses(java.lang.String uri)
          Retrieves all direct sub-classes of the given concept.
 java.util.Iterator getSuperClasses(java.lang.String uri)
          Retrieves all direct super-classes of the given concept.
 java.lang.String getTitle(java.lang.String topicURI, java.lang.String language)
          Returns the language-dependent title of a concept.
 void OntologyImplCommon(java.io.InputStreamReader in)
           
 void OntologyImplFile(java.lang.String inputOntoFilename)
          Constructor.
 void OntologyImplURL(java.lang.String url)
           
 void printTuples()
          Prints the ontology concepts on the output console, formatted as tuples.
 void printXML()
          Prints the ontology concepts on the output console formatted as valid XML.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OntologyImpl

public OntologyImpl()
Constructor. Loads the ontology from a default file.


OntologyImpl

public OntologyImpl(java.lang.String resource,
                    boolean isURI)
Method Detail

OntologyImplFile

public void OntologyImplFile(java.lang.String inputOntoFilename)
Constructor.


OntologyImplCommon

public void OntologyImplCommon(java.io.InputStreamReader in)

OntologyImplURL

public void OntologyImplURL(java.lang.String url)

printTuples

public void printTuples()
Prints the ontology concepts on the output console, formatted as tuples.


printXML

public void printXML()
Prints the ontology concepts on the output console formatted as valid XML.


getAllClasses

public java.util.Vector getAllClasses()
Provides a Vector containing all ontology concepts as URIs.

Specified by:
getAllClasses in interface Ontology
Returns:
The Vector containing all ontology concepts.

getRoots

public java.util.Set getRoots()
Specified by:
getRoots in interface Ontology

getLabel

public java.lang.String getLabel(java.lang.String uri)
Retrieved the label of an ontology concept, given the URI.

Parameters:
uri - The concept URI.
Returns:
The concept label.

getOntClass

public com.hp.hpl.jena.ontology.OntClass getOntClass(java.lang.String uri)
Returns the Ontology class.

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

getSubClasses

public java.util.Iterator getSubClasses(java.lang.String uri)
Retrieves all direct sub-classes of the given concept.

Specified by:
getSubClasses in interface Ontology
Parameters:
uri - The URI of the "father" concept.
Returns:
An Iterator containing all sub-classes expressed as URIs.

getSuperClasses

public java.util.Iterator getSuperClasses(java.lang.String uri)
Retrieves all direct super-classes of the given concept.

Specified by:
getSuperClasses in interface Ontology
Parameters:
uri - The URI of the concept.
Returns:
An Iterator containing all super-classes expressed as URIs.

getNumberOfSubClasses

public int getNumberOfSubClasses(java.lang.String uri)
Counts the number of sons for a given concept.

Parameters:
uri - The concept label.
Returns:
The number of sons.

getRelationEnds

public java.util.Vector getRelationEnds(java.lang.String nodeURI,
                                        java.lang.String relationURI)
Given a concept and a relation, returns an Iterator over the classes the source concept is related to (through the given relation).

Specified by:
getRelationEnds in interface Ontology
Parameters:
nodeURI - The source concept as URI.
relationURI - The relation as URI.
Returns:
An Iterator over the URIs of the related concepts.

getAllRelations

public java.util.Hashtable getAllRelations()
Returns all relations of the ontology with their weights.

Specified by:
getAllRelations in interface Ontology
Returns:
The relations mapped as URI, weight.

getTitle

public java.lang.String getTitle(java.lang.String topicURI,
                                 java.lang.String language)
Returns the language-dependent title of a concept.

Specified by:
getTitle in interface Ontology
Parameters:
topicURI - The URI of a concept.
language - The language code.
Returns:
The title.

getDefinition

public java.lang.String getDefinition(java.lang.String topicURI,
                                      java.lang.String language)
Returns the language-dependent definition of a concept.

Specified by:
getDefinition in interface Ontology
Parameters:
topicURI - The URI of a concept.
language - The language code.
Returns:
The definition.