java.lang.Object
org.apache.jena.graph.Node
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Node_ANY
,Node_Blank
,Node_Ext
,Node_Graph
,Node_Literal
,Node_Triple
,Node_URI
,Node_Variable
A Node has subtypes:
Node_Blank
,Node_URI
,Node_Literal
,Node_Triple
for RDF terms.Node_Variable
,Node_ANY
, for variables and wildcard. ARQsVar
extends Node_Variable.Node_Ext
(ension), andNode_Graph
outside RDF.
Nodes should be constructed by the NodeFactory
methods.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Exception thrown if a literal-access operation is attempted on a non-literal node. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Node
The canonical instance of Node_ANY.static final String
The string used when a literal does not have a language tag.static final TextDirection
The TextDirection used when a literal does not have an initial text direction setting. -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Java rules for equals.Answer the label of this blank node or throw an UnsupportedOperationException if it's not blank.getGraph()
Get the graph for a graph term (N3 formula), otherwise die horriblyAnswer the object which is the index value for this Node.Answer the literal value of a literal node, or throw an UnsupportedOperationException if it's not a literal nodeAnswer the RDF datatype object of this node's literal value, if it is a literal; otherwise die horribly.Answer the data-type URI of this node's literal value, if it is a literal; otherwise die horribly.Answer the language of this node's literal value, if it is a literal; otherwise die horribly.Answer the lexical form of this node's literal value, if it is a literal; otherwise die horribly.Return the initial text direction for an rdf:dirLangString literal.Answer the value of this node's literal value, if it is a literal; otherwise die horribly.get the localname part of this node if it's a URI node, else die horriblygetName()
get a variable nodes name, otherwise die horriblyget the namespace part of this node if it's a URI node, else die horriblyGet the triple for a triple term (embedded triple), otherwise die horriblygetURI()
get the URI of this node if it has one, else die horriblyabstract int
hashCode()
boolean
answer true iff this node is a URI node with the given URIboolean
isBlank()
Answer true iff this node is a blank node [subclasses override]abstract boolean
Answer true iff this node is concrete, meaning a node that is data in an RDF Graph.boolean
isExt()
Extension node.boolean
Answer true iff this node is a literal node [subclasses override]boolean
Answer true iff this node is an "graph node" (N3 formula).boolean
Answer true iff this node is an "triple node" (RDF-star)boolean
isURI()
Answer true iff this node is a URI node [subclasses override]boolean
Answer true iff this node is a variable node - subclasses overrideboolean
Answer true iff this node accepts the other one as a match.boolean
sameTermAs
(Object o) boolean
Test that two nodes are semantically equivalent.abstract String
toString()
Answer a human-readable representation of this Node.abstract String
toString
(PrefixMapping pmap) Answer a human-readable representation of the Node.abstract Object
Visit a Node and dispatch on it to the appropriate method from the NodeVisitorv
.
-
Field Details
-
ANY
The canonical instance of Node_ANY. No other instances are required. -
noLangTag
The string used when a literal does not have a language tag. Accessing the language of a non-literal will throw an exception.- See Also:
-
noTextDirection
The TextDirection used when a literal does not have an initial text direction setting. Accessing the initial text direction of a non-literal will throw an exception.- See Also:
-
-
Method Details
-
visitWith
Visit a Node and dispatch on it to the appropriate method from the NodeVisitorv
.- Parameters:
v
- the visitor to apply to the node- Returns:
- the value returned by the applied method
-
isConcrete
public abstract boolean isConcrete()Answer true iff this node is concrete, meaning a node that is data in an RDF Graph. -
isLiteral
public boolean isLiteral()Answer true iff this node is a literal node [subclasses override] -
isBlank
public boolean isBlank()Answer true iff this node is a blank node [subclasses override] -
isURI
public boolean isURI()Answer true iff this node is a URI node [subclasses override] -
isVariable
public boolean isVariable()Answer true iff this node is a variable node - subclasses override -
isNodeTriple
public boolean isNodeTriple()Answer true iff this node is an "triple node" (RDF-star) -
isNodeGraph
public boolean isNodeGraph()Answer true iff this node is an "graph node" (N3 formula). This is not related to named graphs. -
isExt
public boolean isExt()Extension node. Typically used in data structures based on triples. -
getBlankNodeLabel
Answer the label of this blank node or throw an UnsupportedOperationException if it's not blank. -
getLiteral
Answer the literal value of a literal node, or throw an UnsupportedOperationException if it's not a literal node -
getLiteralValue
Answer the value of this node's literal value, if it is a literal; otherwise die horribly. -
getLiteralLexicalForm
Answer the lexical form of this node's literal value, if it is a literal; otherwise die horribly. -
getLiteralLanguage
Answer the language of this node's literal value, if it is a literal; otherwise die horribly. -
getLiteralTextDirection
Return the initial text direction for an rdf:dirLangString literal. Does not return null if the literal is a rdf:dirLangString literal. Returns null if the text direction is not set (and the datatype won't be rdf:dirLangString). Otherwise die horribly. -
getLiteralDatatypeURI
Answer the data-type URI of this node's literal value, if it is a literal; otherwise die horribly. -
getLiteralDatatype
Answer the RDF datatype object of this node's literal value, if it is a literal; otherwise die horribly. -
getIndexingValue
Answer the object which is the index value for this Node. The default is this Node itself; overridden in Node_Literal for literal indexing purposes. Only concrete nodes should use this method. -
getURI
get the URI of this node if it has one, else die horribly -
getNameSpace
get the namespace part of this node if it's a URI node, else die horribly -
getLocalName
get the localname part of this node if it's a URI node, else die horribly -
getName
get a variable nodes name, otherwise die horribly -
getTriple
Get the triple for a triple term (embedded triple), otherwise die horribly -
getGraph
Get the graph for a graph term (N3 formula), otherwise die horribly -
hasURI
answer true iff this node is a URI node with the given URI -
equals
Java rules for equals. See also {#sameTermAs} and {#sameValueAs} Nodes only equal other Nodes that have equal labels. -
sameTermAs
-
sameValueAs
Test that two nodes are semantically equivalent. In some cases this may be the same as equals, in others equals is stricter. For example, two xsd:int literals with the same value but different lexical form are semantically equivalent but distinguished by the java equals function.Default implementation is to use equals, subclasses should override this.
-
toString
Answer a human-readable representation of this Node. -
hashCode
public abstract int hashCode() -
matches
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
-