Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ch.uzh.ifi.attempto.acewiki.core.ontology
Class Sentence

    java.lang.Object
      ch.uzh.ifi.attempto.acewiki.core.ontology.Sentence

    public class Sentence

extends java.lang.Object

This class represents an ACE sentence which is either a declarative statement or a question. Some declarative sentences can be translated into OWL and can participate in reasoning. Other sentences have no OWL representation and do not participate in reasoning.

Each sentence belongs to exactly one article of an ontology element (the owner).

Parsing of the sentence is done lasily, i.e. at the first time when a parsing result is required. Parsing fails silently. No exceptions are thrown if a sentence is not ACE compliant.

Author:
  Tobias Kuhn

Constructor Summary
`Sentence(java.lang.String text, Ontology ontology)` Creates a new inferred sentence.
`Sentence(java.lang.String text, OntologyElement owner)` Creates a new asserted sentence.

Method Summary
`boolean` | `contains(OntologyElement e)` Checks whether the sentence contains the given ontology element (no matter which word form).
`boolean` | `contains(OntologyElement e, int wordNumber)` Checks whether the sentence contains the given word form (by word number) of the given ontology element.
`static java.util.List<Sentence>` | `generateSentences(TextContainer textContainer, OntologyElement owner)` Generates sentence objects out of a text container.
`java.util.List<Individual>` | `getAnswer()` Returns all individuals that answer this question.
`org.semanticweb.owl.model.OWLOntology` | `getOWLOntology()` Returns the OWL ontology object that contains the OWL representation of this sentence.
`java.lang.String` | `getOWLXML()` Returns the OWL/XML representation of this sentence as a string.
`OntologyElement` | `getOwner()` Returns the owner ontology element of this sentence.
`ACEParserResult` | `getParserResult()` Returns the parser result object.
`java.lang.String` | `getPrettyText()` Returns the sentence text as a string with underscores displayed as blanks.
`java.lang.String` | `getText()` Returns the sentence text as a string.
`java.util.List<TextElement>` | `getTextElements()` Returns a list of text elements that represent the tokens of this sentence.
`boolean` | `isAnswerCached()` Returns true if the sentence is a question and the answer to the question is cached and does not have to be recalculated.
`boolean` | `isInferred()` Checks if the sentence is inferred or asserted.
`boolean` | `isIntegrated()` Returns true if the sentence is integrated into the ontology.
`boolean` | `isOWL()` Returns true if this sentence has an OWL representation.
`boolean` | `isOWLSWRL()` Returns true if this sentence has an OWL or SWRL representation.
`boolean` | `isQuestion()` Returns true if the sentence is a question.
`boolean` | `isReasonerParticipant()` Returns true if this sentence participates in reasoning.
`int` | `reassert()` This method tries to reassert a sentence that is not yet integrated.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Sentence

    public Sentence(java.lang.String text,
                    OntologyElement owner)

  Creates a new asserted sentence. Asserted sentences must have an owner.

  Parameters:
    `text` - The sentence text.
    `owner` - The owner ontology element.

### Sentence

    public Sentence(java.lang.String text,
                    Ontology ontology)

  Creates a new inferred sentence. Inferred sentence have no owner.

  Parameters:
    `text` - The sentence text.
    `ontology` - The ontology.

Method Detail

### generateSentences

    public static java.util.List<Sentence> generateSentences(TextContainer textContainer,
                                                             OntologyElement owner)

  Generates sentence objects out of a text container.

  Parameters:
    `textContainer` - The text container.
    `owner` - The owner ontology element of the sentences.
  Returns:
    A list of sentences.

### getTextElements

    public java.util.List<TextElement> getTextElements()

  Returns a list of text elements that represent the tokens of this sentence.

  Returns:
    A token list.

### getOwner

    public OntologyElement getOwner()

  Returns the owner ontology element of this sentence.

  Returns:
    The owner ontology element.

### getText

    public java.lang.String getText()

  Returns the sentence text as a string. Underscores are used for compound words, e.g. "credit_card".

  Returns:
    The sentence text as a string.

### getPrettyText

    public java.lang.String getPrettyText()

  Returns the sentence text as a string with underscores displayed as blanks. Compound words containing underscores like "credit_cards" are pretty-printed with blank characters: "credit card".

  Returns:
    The sentence text as a pretty-printed string.

### getParserResult

    public ACEParserResult getParserResult()

  Returns the parser result object.

  Returns:
    The parser result object.

### getOWLXML

    public java.lang.String getOWLXML()

  Returns the OWL/XML representation of this sentence as a string.

  Returns:
    The OWL/XML representation.

### isReasonerParticipant

    public boolean isReasonerParticipant()

  Returns true if this sentence participates in reasoning.

  Returns:
    true if this sentence participates in reasoning.

### isOWL

    public boolean isOWL()

  Returns true if this sentence has an OWL representation.

  Returns:
    true if this sentence has an OWL representation.

### isOWLSWRL

    public boolean isOWLSWRL()

  Returns true if this sentence has an OWL or SWRL representation.

  Returns:
    true if this sentence has an OWL or SWRL representation.

### getOWLOntology

    public org.semanticweb.owl.model.OWLOntology getOWLOntology()
                                                         throws org.semanticweb.owl.model.OWLOntologyCreationException

  Returns the OWL ontology object that contains the OWL representation of this sentence.

  Returns:
    The OWL ontology object.
  Throws:
    `org.semanticweb.owl.model.OWLOntologyCreationException` - If the OWL ontology object creation failed.

### reassert

    public int reassert()

  This method tries to reassert a sentence that is not yet integrated. This is used for sentences that have an OWL representation but the integration failed because it introduced an inconsistency. Later, when the ontology has changed, the integration might succeed.

  Returns:
    An integer value denoting the success/failure of the operation.
  See Also:
    `Ontology.commitSentence(Sentence)`

### isIntegrated

    public boolean isIntegrated()

  Returns true if the sentence is integrated into the ontology.

  Returns:
    true if the sentence is integrated into the ontology.

### isQuestion

    public boolean isQuestion()

  Returns true if the sentence is a question.

  Returns:
    true if the sentence is a question.

### isInferred

    public boolean isInferred()

  Checks if the sentence is inferred or asserted.

  Returns:
    true if the sentence is inferred, false if it is asserted.

### contains

    public boolean contains(OntologyElement e,
                            int wordNumber)

  Checks whether the sentence contains the given word form (by word number) of the given ontology element.

  Parameters:
    `e` - The ontology element.
    `wordNumber` - The word number.
  Returns:
    true if the word form occurs in this sentence.

### contains

    public boolean contains(OntologyElement e)

  Checks whether the sentence contains the given ontology element (no matter which word form).

  Parameters:
    `e` - The ontology element.
  Returns:
    true if the ontology element occurs in this sentence.

### getAnswer

    public java.util.List<Individual> getAnswer()

  Returns all individuals that answer this question. 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.

  Returns:
    A list of individuals that are the answer for the question.
  See Also:
    `Ontology.getAnswer(Sentence)`

### isAnswerCached

    public boolean isAnswerCached()

  Returns true if the sentence is a question and the answer to the question is cached and does not have to be recalculated.

  Returns:
    true if the answer is cached.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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