com.hp.hpl.jena.graph
Class PlaceholderNode

java.lang.Object
  extended bycom.hp.hpl.jena.graph.Node
      extended bycom.hp.hpl.jena.graph.PlaceholderNode

public class PlaceholderNode
extends com.hp.hpl.jena.graph.Node

A PlaceholderNode gives information about a node, mich may not be fully instanciated. In contrast to standard nodes a PlaceholderNode is mutable. It can be used to replace nodes within a larger structure. By inheriting from Node, it can be used in all Node-typed places.

Author:
jgarbers

Nested Class Summary
 
Nested classes inherited from class com.hp.hpl.jena.graph.Node
com.hp.hpl.jena.graph.Node.NodeMaker
 
Field Summary
static int BlankNodeType
           
static int LiteralNodeType
           
protected  com.hp.hpl.jena.graph.Node node
          if not null, we allready know the value of the variable, but still have to check for other occourences.
protected  int nodeType
          What is the type, an URI, a blank node or a literal?
static int NotFixedNodeType
           
static int UriNodeType
           
static int VariableNodeType
           
 
Fields inherited from class com.hp.hpl.jena.graph.Node
ANY, label, log, makeAnon, makeLiteral, makeURI, makeVariable, NULL, present, RDFprefix, THRESHOLD
 
Constructor Summary
PlaceholderNode(java.lang.Object label)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 com.hp.hpl.jena.rdf.model.AnonId getBlankNodeId()
          get the blank node id if the node is blank, otherwise die horribly
 com.hp.hpl.jena.graph.impl.LiteralLabel getLiteral()
          get the literal value of a literal node, otherwise die horribly
 java.lang.String getLocalName()
          get the localname part of this node if it's a URI node, else die horribly
 java.lang.String getName()
          get a variable nodes name, otherwise die horribly
 java.lang.String getNameSpace()
          get the namespace part of this node if it's a URI node, else die horribly
 java.lang.String getURI()
          get the URI of this node if it has one, else die horribly
 com.hp.hpl.jena.graph.Node givenNode()
           
 int givenNodeType()
           
 int hashCode()
           
 boolean hasURI(java.lang.String uri)
          answer true iff this node is a URI node with the given URI
 boolean isBlank()
          is this a blank node - overridden in Node_Blank
 boolean isConcrete()
           
 boolean isLiteral()
          is this a literal node - overridden in Node_Literal
 boolean isURI()
          is this a URI node - overridden in Node_URI
 boolean isVariable()
          is this a variable node - overridden in Node_Variable
 boolean matches(com.hp.hpl.jena.graph.Node other)
          Answer true iff this node accepts the other one as a match.
static int nodeType(com.hp.hpl.jena.graph.Node n)
           
 boolean sameValueAs(java.lang.Object o)
          Test that two nodes are semantically equivalent.
 void setNode(com.hp.hpl.jena.graph.Node n)
           
 java.lang.String toString()
          Answer a human-readable representation of this Node.
 java.lang.String toString(boolean quoting)
          Answer a human-readable representation of this Node where literals are quoted according to quoting but URIs are not compressed.
 java.lang.String toString(com.hp.hpl.jena.shared.PrefixMapping pm)
          Answer a human-readable representation of the Node, quoting literals and compressing URIs.
 java.lang.String toString(com.hp.hpl.jena.shared.PrefixMapping pm, boolean quoting)
          Answer a human readable representation of this Node, quoting literals if specified, and compressing URIs using the prefix mapping supplied.
static com.hp.hpl.jena.graph.Node unwrapNode(com.hp.hpl.jena.graph.Node n)
           
static com.hp.hpl.jena.graph.Node unwrapNode(PlaceholderNode n)
           
 java.lang.Object visitWith(com.hp.hpl.jena.graph.NodeVisitor v)
           
 
Methods inherited from class com.hp.hpl.jena.graph.Node
, cache, create, create, create, createAnon, createAnon, createLiteral, createLiteral, createLiteral, createLiteral, createUncachedLiteral, createURI, createVariable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

node

protected com.hp.hpl.jena.graph.Node node
if not null, we allready know the value of the variable, but still have to check for other occourences.


nodeType

protected int nodeType
What is the type, an URI, a blank node or a literal?


NotFixedNodeType

public static final int NotFixedNodeType
See Also:
Constant Field Values

BlankNodeType

public static final int BlankNodeType
See Also:
Constant Field Values

UriNodeType

public static final int UriNodeType
See Also:
Constant Field Values

LiteralNodeType

public static final int LiteralNodeType
See Also:
Constant Field Values

VariableNodeType

public static final int VariableNodeType
See Also:
Constant Field Values
Constructor Detail

PlaceholderNode

public PlaceholderNode(java.lang.Object label)
Method Detail

unwrapNode

public static com.hp.hpl.jena.graph.Node unwrapNode(com.hp.hpl.jena.graph.Node n)

unwrapNode

public static com.hp.hpl.jena.graph.Node unwrapNode(PlaceholderNode n)

nodeType

public static int nodeType(com.hp.hpl.jena.graph.Node n)

givenNode

public com.hp.hpl.jena.graph.Node givenNode()

givenNodeType

public int givenNodeType()

setNode

public void setNode(com.hp.hpl.jena.graph.Node n)

visitWith

public java.lang.Object visitWith(com.hp.hpl.jena.graph.NodeVisitor v)

isConcrete

public boolean isConcrete()

equals

public boolean equals(java.lang.Object o)

isLiteral

public boolean isLiteral()
is this a literal node - overridden in Node_Literal


isBlank

public boolean isBlank()
is this a blank node - overridden in Node_Blank


isURI

public boolean isURI()
is this a URI node - overridden in Node_URI


isVariable

public boolean isVariable()
is this a variable node - overridden in Node_Variable


getBlankNodeId

public com.hp.hpl.jena.rdf.model.AnonId getBlankNodeId()
get the blank node id if the node is blank, otherwise die horribly


getLiteral

public com.hp.hpl.jena.graph.impl.LiteralLabel getLiteral()
get the literal value of a literal node, otherwise die horribly


getURI

public java.lang.String getURI()
get the URI of this node if it has one, else die horribly


getNameSpace

public java.lang.String getNameSpace()
get the namespace part of this node if it's a URI node, else die horribly


getLocalName

public java.lang.String getLocalName()
get the localname part of this node if it's a URI node, else die horribly


getName

public java.lang.String getName()
get a variable nodes name, otherwise die horribly


hasURI

public boolean hasURI(java.lang.String uri)
answer true iff this node is a URI node with the given URI


sameValueAs

public boolean sameValueAs(java.lang.Object o)
Test that two nodes are semantically equivalent. In some cases this may be the sames as equals, in others equals is stricter. For example, two xsd:int literals with the same value but different language tag are semantically equivalent but distinguished by the java equality function in order to support round tripping.

Default implementation is to use equals, subclasses should override this.


hashCode

public int hashCode()

matches

public boolean matches(com.hp.hpl.jena.graph.Node other)
Answer true iff this node accepts the other one as a match. The default is an equality test; it is over-ridden in subclasses to provide the appropriate semantics for literals, ANY, and variables.

Parameters:
other - a node to test for matching
Returns:
true iff this node accepts the other as a match

toString

public java.lang.String toString()
Answer a human-readable representation of this Node. It will not compress URIs, nor quote literals (because at the moment too many places use toString() for something machine-oriented).


toString

public java.lang.String toString(boolean quoting)
Answer a human-readable representation of this Node where literals are quoted according to quoting but URIs are not compressed.


toString

public java.lang.String toString(com.hp.hpl.jena.shared.PrefixMapping pm)
Answer a human-readable representation of the Node, quoting literals and compressing URIs.


toString

public java.lang.String toString(com.hp.hpl.jena.shared.PrefixMapping pm,
                                 boolean quoting)
Answer a human readable representation of this Node, quoting literals if specified, and compressing URIs using the prefix mapping supplied.