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 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()
Deprecated.
Use
NodeFactory.createAnon() instead |
static Node |
createAnon(AnonId id)
Deprecated.
Use
NodeFactory.createAnon(AnonId) instead |
static Node |
createLiteral(com.hp.hpl.jena.graph.impl.LiteralLabel lit)
Deprecated.
Use
NodeFactory.createLiteral(LiteralLabel) instead |
static Node |
createLiteral(String value)
Deprecated.
Use
NodeFactory.createLiteral(String) instead |
static Node |
createLiteral(String lex,
RDFDatatype dtype)
Deprecated.
Use
NodeFactory.createLiteral(String,RDFDatatype) instead |
static Node |
createLiteral(String lit,
String lang,
boolean isXml)
Deprecated.
Use
NodeFactory.createLiteral(String,String,boolean) instead |
static Node |
createLiteral(String lex,
String lang,
RDFDatatype dtype)
Deprecated.
|
static Node |
createUncachedLiteral(Object value,
RDFDatatype dtype)
Deprecated.
|
static Node |
createUncachedLiteral(Object value,
String lang,
RDFDatatype dtype)
Deprecated.
|
static Node |
createURI(String uri)
Deprecated.
Use
NodeFactory.createURI(String) instead |
static Node |
createVariable(String name)
Deprecated.
Use
NodeFactory.createVariable(String) instead |
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)
Deprecated.
Use
NodeFactory.getType(String) instead |
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
@Deprecated public static RDFDatatype getType(String s)
NodeFactory.getType(String)
instead@Deprecated public static Node createAnon()
NodeFactory.createAnon()
instead@Deprecated public static Node createAnon(AnonId id)
NodeFactory.createAnon(AnonId)
instead@Deprecated public static Node createLiteral(com.hp.hpl.jena.graph.impl.LiteralLabel lit)
NodeFactory.createLiteral(LiteralLabel)
instead@Deprecated public static Node createURI(String uri)
NodeFactory.createURI(String)
instead@Deprecated public static Node createVariable(String name)
NodeFactory.createVariable(String)
instead@Deprecated public static Node createLiteral(String value)
NodeFactory.createLiteral(String)
instead@Deprecated public static Node createLiteral(String lit, String lang, boolean isXml)
NodeFactory.createLiteral(String,String,boolean)
insteadisXml
- If true then lit is exclusive canonical XML of type
rdf:XMLLiteral, and no checking will be invoked.@Deprecated public static Node createLiteral(String lex, String lang, RDFDatatype dtype) throws DatatypeFormatException
NodeFactory.createLiteral(String,String,RDFDatatype)
insteadlex
- 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 dtype@Deprecated public static Node createLiteral(String lex, RDFDatatype dtype) throws DatatypeFormatException
NodeFactory.createLiteral(String,RDFDatatype)
insteadlex
- the lexical form of the literaldtype
- the type of the literal, null for old style "plain" literalsDatatypeFormatException
- if lex is not a legal form of dtype@Deprecated public static Node createUncachedLiteral(Object value, String lang, RDFDatatype dtype) throws DatatypeFormatException
NodeFactory.createUncachedLiteral(Object,String,RDFDatatype)
insteadDatatypeFormatException
@Deprecated public static Node createUncachedLiteral(Object value, RDFDatatype dtype) throws DatatypeFormatException
NodeFactory.createUncachedLiteral(Object,RDFDatatype)
insteadDatatypeFormatException
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 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)
Licenced under the Apache License, Version 2.0