org.dllearner.core.owl
Class Description

java.lang.Object
  extended by org.dllearner.core.owl.Description
All Implemented Interfaces:
Cloneable, KBElement, PropertyRange
Direct Known Subclasses:
ADC, Intersection, NamedClass, Negation, Nothing, Restriction, Thing, Union

public abstract class Description
extends Object
implements Cloneable, PropertyRange, KBElement

A class description is sometimes also called "complex class" or "concept".

Author:
Jens Lehmann

Constructor Summary
Description()
           
 
Method Summary
abstract  void accept(DescriptionVisitor visitor)
           
 void addChild(Description child)
          Adds a description as child of this one.
 void addChild(int index, Description child)
          Adds a child description at the specified index.
 Description clone()
          Returns a clone of this description.
abstract  int getArity()
           
 Description getChild(int i)
           
 List<Description> getChildren()
           
 int getDepth()
          Calculates the description tree depth.
 int getNumberOfNodes()
          Calculate the number of nodes for this description tree (each description can be seen as a tree).
 Description getParent()
           
 Description getSubtree(int i)
          Selects a sub tree.
 boolean isRoot()
          Tests whether this description is at the root, i.e.
 void removeChild(Description child)
          Remove the specified child description (its parent link is set to null).
 void replaceChild(int index, Description newChild)
           
 void setParent(Description parent)
           
 String toKBSyntaxString()
           
abstract  String toManchesterSyntaxString(String baseURI, Map<String,String> prefixes)
          Returns a manchester syntax string of this description.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.dllearner.core.owl.KBElement
accept, getLength, toKBSyntaxString, toString
 

Constructor Detail

Description

public Description()
Method Detail

getArity

public abstract int getArity()

getNumberOfNodes

public int getNumberOfNodes()
Calculate the number of nodes for this description tree (each description can be seen as a tree).

Returns:
The number of nodes.

getSubtree

public Description getSubtree(int i)
Selects a sub tree.

Parameters:
i - A position in the tree. Positions are iteratively given to nodes by leftmost depth-first search. This allows efficient selection of subtrees. (TODO: Implementation does not work if any node has more than two children like conjunction and disjunction.)
Returns:
The selected subtree.

getDepth

public int getDepth()
Calculates the description tree depth.

Returns:
The depth of this description.

clone

public Description clone()
Returns a clone of this description.

Overrides:
clone in class Object

addChild

public void addChild(Description child)
Adds a description as child of this one. The parent link of the description will point to this one. For instance, if the description is an intersection, then this method adds an element to the intersection, e.g. A AND B becomes A AND B AND C.

Parameters:
child - The child description.

addChild

public void addChild(int index,
                     Description child)
Adds a child description at the specified index.

Parameters:
index -
child -
See Also:
addChild(Description)

removeChild

public void removeChild(Description child)
Remove the specified child description (its parent link is set to null).

Parameters:
child - The child to remove.

replaceChild

public void replaceChild(int index,
                         Description newChild)

isRoot

public boolean isRoot()
Tests whether this description is at the root, i.e. does not have a parent.

Returns:
True if this node is the root of a description, false otherwise.

getParent

public Description getParent()

setParent

public void setParent(Description parent)

getChildren

public List<Description> getChildren()

getChild

public Description getChild(int i)

toString

public String toString()
Overrides:
toString in class Object

toKBSyntaxString

public String toKBSyntaxString()

toManchesterSyntaxString

public abstract String toManchesterSyntaxString(String baseURI,
                                                Map<String,String> prefixes)
Returns a manchester syntax string of this description. For a reference, see here and here (PDF).

Specified by:
toManchesterSyntaxString in interface KBElement
Returns:
The manchester syntax string for this description.

accept

public abstract void accept(DescriptionVisitor visitor)


SourceForge.net Logo DL-Learner is licenced under the terms of the GNU General Public License.
Copyright © 2007-2008 Jens Lehmann