ch.uzh.ifi.attempto.acewiki.core.ontology
Class Ontology

java.lang.Object
  extended by ch.uzh.ifi.attempto.acewiki.core.ontology.Ontology

public class Ontology
extends java.lang.Object

This class represents an AceWiki ontology which consists of ontology element definitions and of ontological statements. Each ontology element has its own article that consists of ontological statements.

Author:
Tobias Kuhn

Method Summary
 boolean contains(OntologyElement ontologyElement)
          Returns true if the given ontology element is contained by the ontology (identity check).
 OntologyElement get(java.lang.String name)
          Returns the ontology element with the given name, or null if there is no such element.
 java.util.List<Individual> getAnswer(Sentence questionSentence)
          Returns all individuals that answer the given question.
 java.util.List<Concept> getConcepts(Individual ind)
          Returns all concepts the given individual belongs to.
 java.util.List<Individual> getIndividuals(Concept concept)
          Returns all individuals that belong to the given concept.
 java.lang.String getName()
          Returns the name of the ontology.
 java.util.Collection<OntologyElement> getOntologyElements()
          Returns all ontology elements.
 org.semanticweb.owl.model.OWLOntology getOWLOntology()
          Returns an OWL ontology object that contains the complete ontology.
 java.lang.String getOWLOntologyAsXML()
          Returns the complete ontology as an OWL/XML formatted string.
 java.util.List<Sentence> getReferences(OntologyElement element)
          Returns all the sentences that use the given ontology element (no matter which word form is used).
 java.util.List<Sentence> getReferences(OntologyElement element, int wordNumber)
          Returns all the sentences that use the given word form (by word number) of the given ontology element.
 java.util.List<Concept> getSubConcepts(Concept concept)
          Returns all the sub-concepts of the given concept.
 java.util.List<Concept> getSuperConcepts(Concept concept)
          Returns all super-concepts of the given concept.
 java.lang.String getURI()
          Returns the URI of the ontology (baseURI + name).
 boolean isConsistent()
          Returns true if the ontology is consistent.
 boolean isSatisfiable(Concept concept)
          Checks if the given concept is satisfiable.
static Ontology loadOntology(java.lang.String name, java.lang.String baseURI)
          Loads an ontology (or creates an empty ontology if the ontology cannot be found).
 org.semanticweb.owl.model.OWLOntology readOWLOntology(java.lang.String owlxml)
          Uses the ontology manager to read an OWL ontology from a string (that contains an ontology in OWL-XML format).
 void remove(OntologyElement element)
          Removes the given ontology element from the ontology.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadOntology

public static Ontology loadOntology(java.lang.String name,
                                    java.lang.String baseURI)
Loads an ontology (or creates an empty ontology if the ontology cannot be found). The complete URI of the ontology is baseURI + name.

Parameters:
name - The name of the ontology.
baseURI - The base URI that is used to identify the ontology elements.
Returns:
The loaded ontology.

remove

public void remove(OntologyElement element)
Removes the given ontology element from the ontology.

Parameters:
element - The ontology element to be removed.

getReferences

public java.util.List<Sentence> getReferences(OntologyElement element,
                                              int wordNumber)
Returns all the sentences that use the given word form (by word number) of the given ontology element.

Parameters:
element - The ontology element.
wordNumber - The word number.
Returns:
A list of all sentence that contain the word.

getReferences

public java.util.List<Sentence> getReferences(OntologyElement element)
Returns all the sentences that use the given ontology element (no matter which word form is used).

Parameters:
element - The ontology element.
Returns:
A list of all sentence that contain the ontology element.

get

public OntologyElement get(java.lang.String name)
Returns the ontology element with the given name, or null if there is no such element.

Parameters:
name - The name of the ontology element.
Returns:
The ontology element.

getOntologyElements

public java.util.Collection<OntologyElement> getOntologyElements()
Returns all ontology elements.

Returns:
A collection of all ontology elements.

contains

public boolean contains(OntologyElement ontologyElement)
Returns true if the given ontology element is contained by the ontology (identity check).

Parameters:
ontologyElement - The ontology element.
Returns:
true if the ontology element is contained by the ontology.

getName

public java.lang.String getName()
Returns the name of the ontology.

Returns:
The name of the ontology.

getURI

public java.lang.String getURI()
Returns the URI of the ontology (baseURI + name).

Returns:
The URI of the ontology.

getOWLOntologyAsXML

public java.lang.String getOWLOntologyAsXML()
Returns the complete ontology as an OWL/XML formatted string. All sentences that participate in reasoning are included.

Returns:
A string that contains the complete ontology in OWL/XML format.

getOWLOntology

public org.semanticweb.owl.model.OWLOntology getOWLOntology()
Returns an OWL ontology object that contains the complete ontology. More precisely, all sentences that participate in reasoning are included.

Returns:
An OWL ontology object containing the complete ontology.

readOWLOntology

public org.semanticweb.owl.model.OWLOntology readOWLOntology(java.lang.String owlxml)
                                                      throws org.semanticweb.owl.model.OWLOntologyCreationException
Uses the ontology manager to read an OWL ontology from a string (that contains an ontology in OWL-XML format).

Parameters:
owlxml - The serialized OWL-XML ontology.
Returns:
The OWL ontology object.
Throws:
org.semanticweb.owl.model.OWLOntologyCreationException - If the string cannot be parsed.

getConcepts

public java.util.List<Concept> getConcepts(Individual ind)
Returns all concepts the given individual belongs to. The reasoner is used for this.

Parameters:
ind - The individual.
Returns:
A list of all concepts of the individual.
See Also:
Individual.getConcepts()

getIndividuals

public java.util.List<Individual> getIndividuals(Concept concept)
Returns all individuals that belong to the given concept. The reasoner is used for this.

Parameters:
concept - The concept.
Returns:
A list of all individuals of the concept.
See Also:
Concept.getIndividuals()

getSuperConcepts

public java.util.List<Concept> getSuperConcepts(Concept concept)
Returns all super-concepts of the given concept. The reasoner is used for this.

Parameters:
concept - The concept for which all super-concepts should be returned.
Returns:
A list of all super-concepts.
See Also:
Concept.getSuperConcepts()

getSubConcepts

public java.util.List<Concept> getSubConcepts(Concept concept)
Returns all the sub-concepts of the given concept. The reasoner is used for this.

Parameters:
concept - The concept for which all sub-concepts should be returned.
Returns:
A list of all sub-concepts.
See Also:
Concept.getSubConcepts()

getAnswer

public java.util.List<Individual> getAnswer(Sentence questionSentence)
Returns all individuals that answer the given question. The reasoner is used for this. Questions in AceWiki are "DL Queries". They describe a concept and the answer consists of all individuals that belong to this concept. The null value is returned if the sentence is not a question.

Parameters:
questionSentence - The question sentence that should be answered.
Returns:
A list of individuals that are the answer for the question.
See Also:
Sentence.getAnswer()

isConsistent

public boolean isConsistent()
Returns true if the ontology is consistent. If nothing goes wrong, this should always return true. The reasoner is used for this.

Returns:
true if the ontology is consistent.

isSatisfiable

public boolean isSatisfiable(Concept concept)
Checks if the given concept is satisfiable. The reasoner is used for this.

Parameters:
concept - The concept.
Returns:
true if the concept is satisfiable.


Copyright 2008, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch)