|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hp.hpl.jena.graph.Node
A Node has five subtypes: Node_Blank, Node_Anon, Node_URI, Node_Variable, and Node_ANY. Nodes are only constructed by the node factory methods, and they will attempt to re-use existing nodes with the same label if they are recent enough.
Field Summary | |
static Node |
ANY
The canonical instance of Node_ANY; no-one else need use the constructor. |
static Node |
NULL
The canonical NULL. |
Method Summary | |
static void |
cache(boolean wantCache)
provided only for testing purposes. |
static Node |
create(com.hp.hpl.jena.graph.Node.NodeMaker maker,
java.lang.Object label)
We object strongly to null labels: for example, they make .equals flaky. |
static Node |
create(PrefixMapping pm,
java.lang.String x)
As for create(String), but the PrefixMapping used to translate URI strings is an additional argument. |
static Node |
create(java.lang.String x)
Returns a Node described by the string, primarily for testing purposes. |
static Node |
createAnon()
make a blank node with a fresh anon id |
static Node |
createAnon(AnonId id)
make a blank node with the specified label |
static Node |
createLiteral(com.hp.hpl.jena.graph.impl.LiteralLabel lit)
make a literal node with the specified literal value |
static Node |
createLiteral(java.lang.String lit,
java.lang.String lang,
boolean isXml)
make a literal with specified language and XMLishness. |
static Node |
createLiteral(java.lang.String lex,
java.lang.String lang,
RDFDatatype dtype)
Build a typed literal node from its lexical form. |
static Node |
createURI(java.lang.String uri)
make a URI node with the specified URIref string |
static Node |
createVariable(java.lang.String name)
make a variable node with a given name |
abstract boolean |
equals(java.lang.Object o)
Nodes only equal other Nodes that have equal labels. |
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 |
getName()
get a variable nodes name, otherwise die horribly |
java.lang.String |
getURI()
get the URI of this node if it has one, else die horribly |
int |
hashCode()
|
boolean |
isBlank()
is this a blank node - overridden in Node_Blank |
abstract boolean |
isConcrete()
Answer true iff this node is concrete, ie not variable, ie URI, blank, or literal. |
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(Node other)
Answer true iff this node accepts the other one as a match. |
static void |
nullLiteralsGenerateWarnings()
|
boolean |
sameValueAs(java.lang.Object o)
Test that two nodes are semantically equivalent. |
java.lang.String |
toString()
Answer a human-readable representation of this Node. |
java.lang.String |
toString(PrefixMapping pm)
Answer a human-readable representation of the Node, leaving literals unquoted but compressing URIs. |
java.lang.String |
toString(PrefixMapping pm,
boolean quoting)
Answer a human readable representation of this Node, quoting literals if specified, and compressing URIs using the prefix mapping supplied. |
abstract java.lang.Object |
visitWith(NodeVisitor v)
Visit a Node and dispatch on it to the appropriate method from the NodeVisitor v . |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final Node ANY
public static final Node NULL
Method Detail |
public static Node create(java.lang.String x)
x
- the string describing the node
public static Node create(PrefixMapping pm, java.lang.String x)
pm
- the PrefixMapping for translating pre:X stringsx
- the string encoding the node to create
public static Node createAnon(AnonId id)
public static Node createLiteral(com.hp.hpl.jena.graph.impl.LiteralLabel lit)
public static Node createURI(java.lang.String uri)
public static Node createAnon()
public static Node createVariable(java.lang.String name)
public static Node createLiteral(java.lang.String lit, java.lang.String lang, boolean isXml)
isXml
- If true then lit is exclusive canonical XML of type rdf:XMLLiteral, and no checking will be invoked.public static void nullLiteralsGenerateWarnings()
public static Node createLiteral(java.lang.String lex, java.lang.String lang, RDFDatatype dtype) throws DatatypeFormatException
lex
- the lexical form of the literallang
- the optional language tagdtype
- the type of the literal, null for old style "plain" literals
DatatypeFormatException
- if lex is not a legal form of dtypepublic abstract java.lang.Object visitWith(NodeVisitor v)
v
.
v
- the visitor to apply to the node
public abstract boolean isConcrete()
public boolean isLiteral()
public boolean isBlank()
public boolean isURI()
public boolean isVariable()
public AnonId getBlankNodeId()
public com.hp.hpl.jena.graph.impl.LiteralLabel getLiteral()
public java.lang.String getURI()
public java.lang.String getName()
public static void cache(boolean wantCache)
public static Node create(com.hp.hpl.jena.graph.Node.NodeMaker maker, java.lang.Object label)
public abstract boolean equals(java.lang.Object o)
public boolean sameValueAs(java.lang.Object o)
Default implementation is to use equals, subclasses should override this.
public int hashCode()
public boolean matches(Node other)
other
- a node to test for matching
public java.lang.String toString()
public java.lang.String toString(PrefixMapping pm)
public java.lang.String toString(PrefixMapping pm, boolean quoting)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |