| java.lang.Object com.hp.hpl.jena.graph.Node
All known Subclasses: com.hp.hpl.jena.graph.Node_Concrete, com.hp.hpl.jena.graph.Node_Fluid,
Node | abstract public class Node (Code) | | 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.
author: Jeremy Carroll and Chris Dollin |
Inner Class :public static class NotLiteral extends JenaException | |
Inner Class :abstract static class NodeMaker | |
Constructor Summary | |
| Node(Object label) keep the distinguishing label value. |
Method Summary | |
public static void | cache(boolean wantCache) provided only for testing purposes. | public static Node | create(String x) Returns a Node described by the string, primarily for testing purposes.
The string represents a URI, a numeric literal, a string literal, a bnode label,
or a variable. | public static Node | create(PrefixMapping pm, String x) As for create(String), but the PrefixMapping used to translate URI strings
is an additional argument. | public static synchronized Node | create(NodeMaker maker, Object label) We object strongly to null labels: for example, they make .equals flaky. | public static Node | createAnon() | public static Node | createAnon(AnonId id) | public static Node | createLiteral(LiteralLabel lit) | public static Node | createLiteral(String value) | public static Node | createLiteral(String lit, String lang, boolean isXml) make a literal with specified language and XMLishness. | public static Node | createLiteral(String lex, String lang, RDFDatatype dtype) Build a typed literal node from its lexical form. | public static Node | createURI(String uri) | public static Node | createUncachedLiteral(Object value, String lang, RDFDatatype dtype) | public static Node | createVariable(String name) | abstract public boolean | equals(Object o) Nodes only equal other Nodes that have equal labels. | public AnonId | getBlankNodeId() | public String | getBlankNodeLabel() Answer the label of this blank node or throw an UnsupportedOperationException
if it's not blank. | public Object | getIndexingValue() Answer the object which is the index value for this Node. | public LiteralLabel | getLiteral() | public RDFDatatype | getLiteralDatatype() Answer the RDF datatype object of this node's literal value, if it is
a literal; otherwise die horribly. | public String | getLiteralDatatypeURI() Answer the data-type URI of this node's literal value, if it is a
literal; otherwise die horribly. | public boolean | getLiteralIsXML() | public String | getLiteralLanguage() Answer the language of this node's literal value, if it is a literal;
otherwise die horribly. | public String | getLiteralLexicalForm() Answer the lexical form of this node's literal value, if it is a literal;
otherwise die horribly. | public Object | getLiteralValue() Answer the value of this node's literal value, if it is a literal;
otherwise die horribly. | public String | getLocalName() | public String | getName() | public String | getNameSpace() | public static RDFDatatype | getType(String s) | public String | getURI() | public boolean | hasURI(String uri) | public int | hashCode() | public boolean | isBlank() | abstract public boolean | isConcrete() Answer true iff this node is concrete, ie not variable, ie URI, blank, or literal. | public boolean | isLiteral() | public boolean | isURI() | public boolean | isVariable() | public boolean | matches(Node other) Answer true iff this node accepts the other one as a match. | public boolean | sameValueAs(Object o) Test that two nodes are semantically equivalent.
In some cases this may be the same as equals, in others
equals is stricter. | public String | toString() Answer a human-readable representation of this Node. | public String | toString(boolean quoting) Answer a human-readable representation of this Node where literals are
quoted according to quoting but URIs are not compressed. | public String | toString(PrefixMapping pm) Answer a human-readable representation of the Node, quoting literals and
compressing URIs. | public 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 public Object | visitWith(NodeVisitor v) Visit a Node and dispatch on it to the appropriate method from the
NodeVisitor v . |
ANY | final public static Node ANY(Code) | | The canonical instance of Node_ANY. No other instances are required.
|
NULL | final public static Node NULL(Code) | | The canonical NULL. It appears here so that revised definitions [eg as a bnode]
that require the cache-and-maker system will work; the NodeMaker constants
should be non-null at this point.
|
THRESHOLD | final static int THRESHOLD(Code) | | |
makeAnon | final static NodeMaker makeAnon(Code) | | |
makeLiteral | final static NodeMaker makeLiteral(Code) | | |
makeURI | final static NodeMaker makeURI(Code) | | |
makeVariable | final static NodeMaker makeVariable(Code) | | |
Node | Node(Object label)(Code) | | keep the distinguishing label value.
|
cache | public static void cache(boolean wantCache)(Code) | | provided only for testing purposes. _cache(false)_ switches off caching and
clears the cache. _cache(true)_ switches caching [back] on. This allows
structural equality to be tested.
|
create | public static Node create(String x)(Code) | | Returns a Node described by the string, primarily for testing purposes.
The string represents a URI, a numeric literal, a string literal, a bnode label,
or a variable.
- 'some text' :: a string literal with that text
- 'some text'someLanguage:: a string literal with that text and language
- 'some text'someURI:: a typed literal with that text and datatype
- digits :: a literal [OF WHAT TYPE] with that [numeric] value
- _XXX :: a bnode with an AnonId built from _XXX
- ?VVV :: a variable with name VVV
- &PPP :: to be done
- name:stuff :: the URI; name may be expanded using the Extended map
Parameters: x - the string describing the node a node of the appropriate type with the appropriate labelNodeCreateUtils.create(String) |
create | public static Node create(PrefixMapping pm, String x)(Code) | | As for create(String), but the PrefixMapping used to translate URI strings
is an additional argument.
Parameters: pm - the PrefixMapping for translating pre:X strings Parameters: x - the string encoding the node to create a node with the appropriate type and labelNodeCreateUtils.create(PrefixMappingString) |
create | public static synchronized Node create(NodeMaker maker, Object label)(Code) | | We object strongly to null labels: for example, they make .equals flaky. We reuse nodes
from the recent cache if we can. Otherwise, the maker knows how to construct a new
node of the correct class, and we add that node to the cache. create is
synchronised to avoid threading problems - a separate thread might zap the
cache entry that get is currently looking at.
|
createAnon | public static Node createAnon()(Code) | | make a blank node with a fresh anon id
|
createAnon | public static Node createAnon(AnonId id)(Code) | | make a blank node with the specified label
|
createLiteral | public static Node createLiteral(LiteralLabel lit)(Code) | | make a literal node with the specified literal value
|
createLiteral | public static Node createLiteral(String lit, String lang, boolean isXml)(Code) | | make a literal with specified language and XMLishness.
_lit_ must *not* be null.
Parameters: isXml - If true then lit is exclusive canonical XML of type rdf:XMLLiteral, and no checking will be invoked. |
createLiteral | public static Node createLiteral(String lex, String lang, RDFDatatype dtype) throws DatatypeFormatException(Code) | | Build a typed literal node from its lexical form. The
lexical form will be parsed now and the value stored. If
the form is not legal this will throw an exception.
Parameters: lex - the lexical form of the literal Parameters: lang - the optional language tag Parameters: dtype - the type of the literal, null for old style "plain" literals throws: DatatypeFormatException - if lex is not a legal form of dtype |
createURI | public static Node createURI(String uri)(Code) | | make a URI node with the specified URIref string
|
createVariable | public static Node createVariable(String name)(Code) | | make a variable node with a given name
|
equals | abstract public boolean equals(Object o)(Code) | | Nodes only equal other Nodes that have equal labels.
|
getBlankNodeId | public AnonId getBlankNodeId()(Code) | | get the blank node id if the node is blank, otherwise die horribly
|
getBlankNodeLabel | public String getBlankNodeLabel()(Code) | | Answer the label of this blank node or throw an UnsupportedOperationException
if it's not blank.
|
getIndexingValue | public Object getIndexingValue()(Code) | | 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.
|
getLiteral | public LiteralLabel getLiteral()(Code) | | Answer the literal value of a literal node, or throw an UnsupportedOperationException
if it's not a literal node
|
getLiteralDatatype | public RDFDatatype getLiteralDatatype()(Code) | | Answer the RDF datatype object of this node's literal value, if it is
a literal; otherwise die horribly.
|
getLiteralDatatypeURI | public String getLiteralDatatypeURI()(Code) | | Answer the data-type URI of this node's literal value, if it is a
literal; otherwise die horribly.
|
getLiteralIsXML | public boolean getLiteralIsXML()(Code) | | |
getLiteralLanguage | public String getLiteralLanguage()(Code) | | Answer the language of this node's literal value, if it is a literal;
otherwise die horribly.
|
getLiteralLexicalForm | public String getLiteralLexicalForm()(Code) | | Answer the lexical form of this node's literal value, if it is a literal;
otherwise die horribly.
|
getLiteralValue | public Object getLiteralValue()(Code) | | Answer the value of this node's literal value, if it is a literal;
otherwise die horribly.
|
getLocalName | public String getLocalName()(Code) | | get the localname part of this node if it's a URI node, else die horribly
|
getName | public String getName()(Code) | | get a variable nodes name, otherwise die horribly
|
getNameSpace | public String getNameSpace()(Code) | | get the namespace part of this node if it's a URI node, else die horribly
|
getURI | public String getURI()(Code) | | get the URI of this node if it has one, else die horribly
|
hasURI | public boolean hasURI(String uri)(Code) | | answer true iff this node is a URI node with the given URI
|
hashCode | public int hashCode()(Code) | | |
isBlank | public boolean isBlank()(Code) | | Answer true iff this node is a blank node [subclasses override]
|
isConcrete | abstract public boolean isConcrete()(Code) | | Answer true iff this node is concrete, ie not variable, ie URI, blank, or literal.
|
isLiteral | public boolean isLiteral()(Code) | | Answer true iff this node is a literal node [subclasses override]
|
isURI | public boolean isURI()(Code) | | Answer true iff this node is a URI node [subclasses override]
|
isVariable | public boolean isVariable()(Code) | | Answer true iff this node is a variable node - subclasses override
|
matches | public boolean matches(Node other)(Code) | | 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 true iff this node accepts the other as a match |
sameValueAs | public boolean sameValueAs(Object o)(Code) | | 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 language tag are semantically
equivalent but distinguished by the java equality function
in order to support round-tripping.
Default implementation is to use equals, subclasses should
override this.
|
toString | public String toString()(Code) | | Answer a human-readable representation of this Node. It will not compress URIs,
nor quote literals (because at the moment too many places use toString() for
something machine-oriented).
|
toString | public String toString(boolean quoting)(Code) | | Answer a human-readable representation of this Node where literals are
quoted according to quoting but URIs are not compressed.
|
toString | public String toString(PrefixMapping pm)(Code) | | Answer a human-readable representation of the Node, quoting literals and
compressing URIs.
|
toString | public String toString(PrefixMapping pm, boolean quoting)(Code) | | Answer a human readable representation of this Node, quoting literals if specified,
and compressing URIs using the prefix mapping supplied.
|
visitWith | abstract public Object visitWith(NodeVisitor v)(Code) | | Visit a Node and dispatch on it to the appropriate method from the
NodeVisitor v .
Parameters: v - the visitor to apply to the node the value returned by the applied method |
|
|