de.fuberlin.wiwiss.wiqa
Class ExplanationPart

java.lang.Object
  extended byde.fuberlin.wiwiss.wiqa.ExplanationPart
All Implemented Interfaces:
ExplanationNode

public class ExplanationPart
extends Object
implements ExplanationNode

A node in an Explanation tree. A node has a text fragment which is a list of RDF nodes (literals or URIs which should be rendered as links). A node also has zero or more children which are also ExplanationParts, and are unordered.

An ExplanationPart may have a more detailed alternative version, accessible through getDetails(). Which version is shown should be determined based on user preferences.

Version:
$Id: ExplanationPart.java,v 1.4 2006/06/27 13:04:16 cyganiak Exp $
Author:
Richard Cyganiak (richard@cyganiak.de), Oliver Maresch (oliver-maresch@gmx.de)

Constructor Summary
ExplanationPart()
          Creates a new explanation part without children and with an empty text representation.
ExplanationPart(List explanation)
          Creates a new explanation part without children and with a text representation.
 
Method Summary
 void addPart(ExplanationPart childPart)
          Adds a child to this explanation part.
static ExplanationPart create(Object[] parts)
          Creates a new explanation part with a text fragment built from an array of Objects.
 boolean equals(Object other)
           
 List explanationNodes()
           
 ExplanationPart getDetails()
           
 int hashCode()
           
 Collection parts()
           
 void setDetails(ExplanationPart details)
          Sets the alternative detailed version of this explanation part.
 String toString()
           
 Node writeAsRDF(Graph target)
          Writes this explanation part and all of its children into a Jena RDF Graph.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExplanationPart

public ExplanationPart()
Creates a new explanation part without children and with an empty text representation.


ExplanationPart

public ExplanationPart(List explanation)
Creates a new explanation part without children and with a text representation.

Parameters:
explanation - The text representation, a list of RDF Nodes
Method Detail

create

public static ExplanationPart create(Object[] parts)
Creates a new explanation part with a text fragment built from an array of Objects. Nodes in the array are used as is, other objects are converted to string literals using their toString() function.

Parameters:
parts - An array of Nodes and other objects
Returns:
A new explanation part with a corresponding text fragment

addPart

public void addPart(ExplanationPart childPart)
Adds a child to this explanation part.

Specified by:
addPart in interface ExplanationNode
Parameters:
childPart - The new child

parts

public Collection parts()
Returns:
The children of this explanation part

explanationNodes

public List explanationNodes()
Returns:
The text representation of this explanation part; a list of RDF Nodes.

setDetails

public void setDetails(ExplanationPart details)
Sets the alternative detailed version of this explanation part.

Parameters:
details - The alternative version

getDetails

public ExplanationPart getDetails()
Returns:
The alternative detailed version of this explanation part, or null if none exists

writeAsRDF

public Node writeAsRDF(Graph target)
Writes this explanation part and all of its children into a Jena RDF Graph.

Parameters:
target - Statements will be added to this graph
Returns:
The RDF node representing this part

equals

public boolean equals(Object other)

hashCode

public int hashCode()

toString

public String toString()