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_Triplefor RDF terms.Node_Variable,Node_ANY, for variables and wildcard. ARQsVarextends Node_Variable.Node_Ext(ension), andNode_Graphoutside RDF.
Nodes should be constructed by the NodeFactory methods.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException thrown if a literal-access operation is attempted on a non-literal node. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NodeThe canonical instance of Node_ANY.static final StringThe string used when a literal does not have a language tag.static final TextDirectionThe TextDirection used when a literal does not have an base direction setting. -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanJava 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 nodeReturn the base direction for a literal.Answer 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.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, otherwise die horriblygetURI()get the URI of this node if it has one, else die horriblyabstract inthashCode()booleananswer true iff this node is a URI node with the given URIbooleanisBlank()Answer true iff this node is a blank node [subclasses override]abstract booleanAnswer true iff this node is concrete, meaning a node that is data in an RDF Graph.booleanisExt()Extension node.booleanAnswer true iff this node is a literal node [subclasses override]booleanAnswer true iff this node is an "graph node" (N3 formula).booleanAnswer true iff this node is a triple termbooleanisURI()Answer true iff this node is a URI node [subclasses override]booleanAnswer true iff this node is a variable node - subclasses overridebooleansameTermAs(Node node) RDF term equality.booleansameValueAs(Node node) Test that two nodes represent the same value.abstract StringtoString()Answer a human-readable representation of this Node.abstract StringtoString(PrefixMapping pmap) Answer a human-readable representation of the Node.abstract ObjectVisit 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 base direction setting. Accessing the base 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 -
isTripleTerm
public boolean isTripleTerm()Answer true iff this node is a triple term -
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. -
getLiteralBaseDirection
Return the base direction for a literal. Returns null if the node is a literal and does not have a base direction. 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, 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}..equalsis "same RDF Term" with all the rules of Java equality such as "null" handling. -
sameTermAs
RDF term equality.The
Nodeargument must not be null. -
sameValueAs
Test that two nodes represent the same value.In some cases this may be the same as
sameTermAs(org.apache.jena.graph.Node). For example, two xsd:int literals with the same value but different lexical form are semantically equivalent but distinguished by the java equals function.The default implementation is to use
Theequals(java.lang.Object); subclasses should override this.Nodeargument must not be null. -
toString
Answer a human-readable representation of this Node. -
hashCode
public abstract int hashCode()
-