public class TermId<V extends BigdataValue> extends AbstractNonInlineIV<V,Void>
Value
when the values is not being
inlined. Instances of this class can represent URI
s, BNode
s
(if they are not being inlined), or Literal
s (including datatype
literals if they are not being inlined). Larger RDF Value
s should be
represented with BlobIV
instead of this class.Modifier and Type | Field and Description |
---|---|
static long |
NULL
Value used for a "NULL" term identifier.
|
static TermId<?> |
NullIV
Singleton for a "null"
IV . |
flags
Constructor and Description |
---|
TermId(byte flags,
long termId)
Constructor for a term identifier when you are decoding and already have
the flags.
|
TermId(VTE vte,
long termId)
Constructor for a term identifier.
|
Modifier and Type | Method and Description |
---|---|
int |
_compareTo(IV o)
Compare two
IV s having the same intrinsic datatype. |
int |
byteLength()
The byte length of the encoded
IV . |
IV<V,Void> |
clone(boolean clearCache)
Return a copy of this
IV . |
IKeyBuilder |
encode(IKeyBuilder keyBuilder)
Encode the
IV as an unsigned byte[]. |
boolean |
equals(Object o)
Note: only the termId matters for equality, unless either is #NULL, in
which case this will compare the cached {@link BigdataValue}s if they
exist.
|
static TermId<?> |
fromString(String s)
Decodes the output of
toString() , returning a new TermId
. |
String |
getID()
Overrides
BNode.getID() . |
long |
getTermId()
Return the termId.
|
int |
hashCode()
Return the hash code of the long term identifier.
|
boolean |
isNullIV()
|
boolean |
isNumeric()
true for any of the numeric data types (xsd:byte,
xsd:unsignedByte, xsd:short, xsd:unsignedShort, xsd:int, xsd:unsignedInt,
xsd:long, xsd:unsignedLong, xsd:float, xsd:double, xsd:integer, and
xsd:decimal). |
static TermId<?> |
mockIV(VTE vte)
|
String |
toString()
Human readable representation includes the term identifier, whether this
is a URI, Literal, Blank node, or Statement identifier and the datatype
URI if one is assigned.
|
asValue, booleanValue, byteValue, calendarValue, decimalValue, doubleValue, floatValue, getDatatype, getInlineValue, getLabel, getLanguage, getLocalName, getNamespace, integerValue, intValue, isInline, longValue, needsMaterialization, shortValue, stringValue
compareTo, flags, getDTE, getDTE, getDTEX, getInternalValueTypeEnum, getValue, getValueCache, getVTE, getVTE, hasValue, isBigNumeric, isBNode, isExtension, isExtension, isFixedNumeric, isFloatingPointNumeric, isInline, isLiteral, isResource, isSignedNumeric, isStatement, isUnsignedNumeric, isURI, isVocabulary, setValue, toFlags
public static final transient long NULL
public TermId(byte flags, long termId)
flags
- The flagstermId
- public TermId(VTE vte, long termId)
vte
- termId
- public final boolean isNullIV()
AbstractIV
true
iff the IV
represents a null
IV
reference. null
IV
s are somewhat special.
They get used as wild cards for the keys in the justifications index and
perhaps (?) in a few other locations.
This implementation returns false
. It is overridden by
TermId
.
isNullIV
in interface IV<V extends BigdataValue,Void>
isNullIV
in class AbstractIV<V extends BigdataValue,Void>
public static TermId<?> mockIV(VTE vte)
IV
having the indicated VTE
which will
report true
for isNullIV()
. This is used by some
code patterns where we need to associate a BigdataValue
not in
the database with an IV
on a temporary basis.public IV<V,Void> clone(boolean clearCache)
IVCache
IV
.
Note: This method exists to defeat the hard reference from the IV
to the cached BigdataValue
in order to avoid a memory leak when
the IV
is used as the key in a weak value cache whose value is
the BigdataValue
. Therefore, certain IV
implementations
MAY return this when they are used for limited collections. The
vocabulary IVs are the primary example. For the same reason, we do not
need to recursively break the link from the IV
to the
BigdataValue
for IV
s which embed other IV
s.
clearCache
- When true
the cached reference (if any) will NOT
be set on the copy.(Thread-local
cache combined with unbounded thread pools causes effective memory
leak)
public String toString()
The cached BigdataValue
, if any, is also rendered. This is done
using Value.stringValue()
in order to avoid possible
infinite recursion through BigdataValue#toString()
if the latter
were to display the IV
.
public static TermId<?> fromString(String s)
toString()
, returning a new TermId
.s
- The string representation.TermIV
.public final long getTermId()
public boolean equals(Object o)
equals
in interface org.openrdf.model.BNode
equals
in interface org.openrdf.model.Literal
equals
in interface org.openrdf.model.URI
equals
in class AbstractIV<V extends BigdataValue,Void>
public int hashCode()
hashCode
in interface org.openrdf.model.BNode
hashCode
in interface org.openrdf.model.Literal
hashCode
in interface org.openrdf.model.URI
hashCode
in class AbstractIV<V extends BigdataValue,Void>
Long.hashCode()
public int byteLength()
IV
IV
.public int _compareTo(IV o)
AbstractIV
IV
s having the same intrinsic datatype._compareTo
in class AbstractIV<V extends BigdataValue,Void>
public IKeyBuilder encode(IKeyBuilder keyBuilder)
IV
IV
as an unsigned byte[].encode
in interface IV<V extends BigdataValue,Void>
encode
in class AbstractIV<V extends BigdataValue,Void>
keyBuilder
- The object used to encode the IV
.public String getID()
BNode.getID()
.
Creates a unique blank node ID based on the TermId
's internal
data.
getID
in interface org.openrdf.model.BNode
getID
in class AbstractNonInlineIV<V extends BigdataValue,Void>
public boolean isNumeric()
IV
true
for any of the numeric data types (xsd:byte,
xsd:unsignedByte, xsd:short, xsd:unsignedShort, xsd:int, xsd:unsignedInt,
xsd:long, xsd:unsignedLong, xsd:float, xsd:double, xsd:integer, and
xsd:decimal).isNumeric
in interface IV<V extends BigdataValue,Void>
isNumeric
in class AbstractIV<V extends BigdataValue,Void>
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.