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

java.lang.Object
  extended by ch.uzh.ifi.attempto.preditor.text.TextElement
      extended by ch.uzh.ifi.attempto.acewiki.core.ontology.OntologyTextElement

public class OntologyTextElement
extends TextElement

This class represents a text element that links to an ontology element. The text of the text elements corresponds to one of the word forms of the ontology element.

Author:
Tobias Kuhn

Constructor Summary
OntologyTextElement(OntologyElement ontologyElement, int wordNumber, java.lang.String category)
          Creates a new ontology text element.
 
Method Summary
static OntologyTextElement createTextElement(OntologyElement el)
          Creates a new text element for the default word form of the given ontology element.
static OntologyTextElement createTextElement(OntologyElement el, int wordNumber)
          Creates a new text element for the given word form (by word form id) of the given ontology element.
 boolean equals(java.lang.Object obj)
          Two text elements are equals if they share the same text.
 Terminal[] getCategories()
          Returns the grammatical category of this text element.
 OntologyElement getOntologyElement()
          Returns the ontology element to which this text element is linked.
 java.lang.String getOriginalText()
          Returns the original text of this text element.
 java.lang.String getText()
          Returns the text of this text element.
 java.lang.String getUnderscoredText()
          Returns the text of this text element in its plain form where underscores are not replaces by blanks.
 int getWordNumber()
          Returns the id of the word form of the ontology element that is used for this text element.
 void include(TextElement textElement)
          Includes the categories of the given text element.
 
Methods inherited from class ch.uzh.ifi.attempto.preditor.text.TextElement
applyRestriction, setID, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OntologyTextElement

public OntologyTextElement(OntologyElement ontologyElement,
                           int wordNumber,
                           java.lang.String category)
Creates a new ontology text element.

Parameters:
ontologyElement - The ontology element.
wordNumber - The word number.
category - The category name.
Method Detail

createTextElement

public static OntologyTextElement createTextElement(OntologyElement el,
                                                    int wordNumber)
Creates a new text element for the given word form (by word form id) of the given ontology element.

Parameters:
el - The ontology element.
wordNumber - The word form id.
Returns:
The newly created text element.

createTextElement

public static OntologyTextElement createTextElement(OntologyElement el)
Creates a new text element for the default word form of the given ontology element.

Parameters:
el - The ontology element.
Returns:
The newly created text element.

getUnderscoredText

public java.lang.String getUnderscoredText()
Returns the text of this text element in its plain form where underscores are not replaces by blanks.

Returns:
The plain text.

getText

public java.lang.String getText()
Description copied from class: TextElement
Returns the text of this text element. The text might have been changed by the context checker.

Overrides:
getText in class TextElement
Returns:
The text (after the context checker).

getOriginalText

public java.lang.String getOriginalText()
Description copied from class: TextElement
Returns the original text of this text element. This is the unchanged text before it is given to the context checker.

Overrides:
getOriginalText in class TextElement
Returns:
The original text (before the context checker).

getWordNumber

public int getWordNumber()
Returns the id of the word form of the ontology element that is used for this text element.

Returns:
The word form id.

getCategories

public Terminal[] getCategories()
Description copied from class: TextElement
Returns the grammatical category of this text element.

Overrides:
getCategories in class TextElement
Returns:
The grammatical category.

getOntologyElement

public OntologyElement getOntologyElement()
Returns the ontology element to which this text element is linked.

Returns:
The ontology element.

include

public void include(TextElement textElement)
Description copied from class: TextElement
Includes the categories of the given text element. This is only allowed if the two text elements are equal (accoring to the equals-method).

Overrides:
include in class TextElement
Parameters:
textElement - The text element whose categories should be included.

equals

public boolean equals(java.lang.Object obj)
Description copied from class: TextElement
Two text elements are equals if they share the same text.

Overrides:
equals in class TextElement


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