public abstract class Node extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Node.NotLiteral
Exception thrown if a literal-access operation is attemted on a
non-literal node.
|
Modifier and Type | Field and Description |
---|---|
static Node |
ANY
The canonical instance of Node_ANY.
|
static Node |
NULL
The canonical NULL.
|
Modifier and Type | Method and Description |
---|---|
static void |
cache(boolean wantCache)
provided only for testing purposes.
|
static Node |
create(com.hp.hpl.jena.graph.Node.NodeMaker maker,
Object label)
We object strongly to null labels: for example, they make .equals flaky.
|
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(String value) |
static Node |
createLiteral(String lit,
String lang,
boolean isXml)
make a literal with specified language and XMLishness.
|
static Node |
createLiteral(String lex,
String lang,
RDFDatatype dtype)
Build a typed literal node from its lexical form.
|
static Node |
createUncachedLiteral(Object value,
String lang,
RDFDatatype dtype) |
static Node |
createURI(String uri)
make a URI node with the specified URIref string
|
static Node |
createVariable(String name)
make a variable node with a given name
|
abstract boolean |
equals(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
|
String |
getBlankNodeLabel()
Answer the label of this blank node or throw an UnsupportedOperationException
if it's not blank.
|
Object |
getIndexingValue()
Answer the object which is the index value for this Node.
|
com.hp.hpl.jena.graph.impl.LiteralLabel |
getLiteral()
Answer the literal value of a literal node, or throw an UnsupportedOperationException
if it's not a literal node
|
RDFDatatype |
getLiteralDatatype()
Answer the RDF datatype object of this node's literal value, if it is
a literal; otherwise die horribly.
|
String |
getLiteralDatatypeURI()
Answer the data-type URI of this node's literal value, if it is a
literal; otherwise die horribly.
|
boolean |
getLiteralIsXML() |
String |
getLiteralLanguage()
Answer the language of this node's literal value, if it is a literal;
otherwise die horribly.
|
String |
getLiteralLexicalForm()
Answer the lexical form of this node's literal value, if it is a literal;
otherwise die horribly.
|
Object |
getLiteralValue()
Answer the value of this node's literal value, if it is a literal;
otherwise die horribly.
|
String |
getLocalName()
get the localname part of this node if it's a URI node, else die horribly
|
String |
getName()
get a variable nodes name, otherwise die horribly
|
String |
getNameSpace()
get the namespace part of this node if it's a URI node, else die horribly
|
static RDFDatatype |
getType(String s) |
String |
getURI()
get the URI of this node if it has one, else die horribly
|
int |
hashCode() |
boolean |
hasURI(String uri)
answer true iff this node is a URI node with the given URI
|
boolean |
isBlank()
Answer true iff this node is a blank node [subclasses override]
|
abstract boolean |
isConcrete()
Answer true iff this node is concrete, ie not variable, ie URI, blank, or literal.
|
boolean |
isLiteral()
Answer true iff this node is a literal node [subclasses override]
|
boolean |
isURI()
Answer true iff this node is a URI node [subclasses override]
|
boolean |
isVariable()
Answer true iff this node is a variable node - subclasses override
|
boolean |
matches(Node other)
Answer true iff this node accepts the other one as a match.
|
boolean |
sameValueAs(Object o)
Test that two nodes are semantically equivalent.
|
String |
toString()
Answer a human-readable representation of this Node.
|
String |
toString(boolean quoting)
Answer a human-readable representation of this Node where literals are
quoted according to
quoting but URIs are not compressed. |
String |
toString(PrefixMapping pm)
Answer a human-readable representation of the Node, quoting literals and
compressing URIs.
|
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 Object |
visitWith(NodeVisitor v)
Visit a Node and dispatch on it to the appropriate method from the
NodeVisitor
v . |
public static final Node ANY
public static final Node NULL
public static RDFDatatype getType(String s)
public static Node createAnon()
public static Node createLiteral(com.hp.hpl.jena.graph.impl.LiteralLabel lit)
public static Node createVariable(String name)
public static Node createLiteral(String lit, 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 Node createLiteral(String lex, 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" literalsDatatypeFormatException
- if lex is not a legal form of dtypepublic static Node createUncachedLiteral(Object value, String lang, RDFDatatype dtype) throws DatatypeFormatException
DatatypeFormatException
public abstract Object visitWith(NodeVisitor v)
v
.v
- the visitor to apply to the nodepublic abstract boolean isConcrete()
public boolean isLiteral()
public boolean isBlank()
public boolean isURI()
public boolean isVariable()
public AnonId getBlankNodeId()
public String getBlankNodeLabel()
public com.hp.hpl.jena.graph.impl.LiteralLabel getLiteral()
public Object getLiteralValue()
public String getLiteralLexicalForm()
public String getLiteralLanguage()
public String getLiteralDatatypeURI()
public RDFDatatype getLiteralDatatype()
public boolean getLiteralIsXML()
public Object getIndexingValue()
public String getURI()
public String getNameSpace()
public String getLocalName()
public String getName()
public boolean hasURI(String uri)
public static void cache(boolean wantCache)
public static Node create(com.hp.hpl.jena.graph.Node.NodeMaker maker, Object label)
public abstract boolean equals(Object o)
public boolean sameValueAs(Object o)
Default implementation is to use equals, subclasses should override this.
public boolean matches(Node other)
other
- a node to test for matchingpublic String toString()
public String toString(boolean quoting)
quoting
but URIs are not compressed.public String toString(PrefixMapping pm)
public String toString(PrefixMapping pm, boolean quoting)
Copyright ? 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP