public class BlobIV<V extends BigdataValue> extends AbstractNonInlineExtensionIV<V,Void>
Value
when the value is not being
inlined, but primarily used with large RDF Value
s. 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). The representation of the BlobIV
is simply the key in
the TERMS index for the tuple for a given RDF Value
. While flexible,
Value
s models as BlobIV
s require indirection through the
TERMS index in order to materialize the Value
. We are often able to
inline Value
s compactly and efficiently into the statement indices,
in which case those values simply do not appear in the TERMS index. The
BlobIV
remains useful when the RDF Value
is large and not
otherwise amenable to inlining.
Note: The BlobIV
uses a hash code based on the hash code of the RDF
Value
. This gives us a fixed length key for the TERMS index, even
when the RDF Value
is very large. This makes the BlobIV
suitable for use with very large RDF Value
s. However, the hash code
results in widely dispersed updates which cause a lot of IO scatter. This
makes the TERMS index slower on write than the TERM2ID and ID2TERM indices.
Therefore shorter RDF Value
s should be inserted by preference into
the TERM2ID / ID2TERM indices while larger values should be inserted as
BlobIV
s into the TERMS index.
flags
Constructor and Description |
---|
BlobIV(byte flags,
int hash,
short counter) |
BlobIV(VTE vte,
int hash,
short counter) |
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 . |
int |
counter()
The collision counter component of the key in the TERMS index.
|
IKeyBuilder |
encode(IKeyBuilder keyBuilder)
Encode the
IV as an unsigned byte[]. |
boolean |
equals(Object o)
Return true iff the two
IV s are the same point in the same value
space. |
static BlobIV<?> |
fromString(String s)
Decodes the output of
toString() , returning a new BlobIV
. |
byte |
getExtensionByte()
Return the extension byte for this type of non-inline IV.
|
IV |
getExtensionIV() |
String |
getID()
Implements
BNode.getID() . |
int |
hashCode()
Return a hash code based on the value of the point in the value space.
|
static byte |
toFlags(VTE vte)
Return the
flags byte for a BlobIV . |
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, isNullIV, isNumeric, isResource, isSignedNumeric, isStatement, isUnsignedNumeric, isURI, isVocabulary, setValue, toFlags
public BlobIV(VTE vte, int hash, short counter)
vte
- The VTE
.hash
- The hash code.counter
- The counter.public BlobIV(byte flags, int hash, short counter)
flags
- The flags byte.hash
- The hash code.counter
- The counter.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()
TermId(hashCode:counter:[U|L|B])
public static BlobIV<?> fromString(String s)
toString()
, returning a new BlobIV
.s
- The string representation.BlobIV
.public boolean equals(Object o)
AbstractIV
IV
s are the same point in the same value
space. Points in different value spaces (as identified by different
datatype URIs) are NOT equal even if they have the same value in the
corresponding primitive data type.
Note: The IV
implementations typically DO NOT compare equals()
with BigdataValue
s. Therefore you MUST NOT mix IV
s and
BigdataValue
s in the keys of a map or the values of a set.
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 final int hashCode()
Note: The IV
implementations typically DO NOT return hash codes
that are consistent with BigdataValue#hashCode()
. Therefore you
MUST NOT mix IV
s and BigdataValue
s in the keys of a map
or the values of a set.
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>
public final int counter()
public final 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 final IKeyBuilder encode(IKeyBuilder keyBuilder)
IV
as an unsigned byte[].
Overridden to entirely take over the encoding of the key from the
BlobIV
. Note that this simply copies the private unsigned byte[]
into the IKeyBuilder
since it is already the exact key for the
BlobIV
.
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 BlobIV
's internal
data.
getID
in interface org.openrdf.model.BNode
getID
in class AbstractNonInlineIV<V extends BigdataValue,Void>
public final byte getExtensionByte()
AbstractNonInlineExtensionIV
getExtensionByte
in class AbstractNonInlineExtensionIV<V extends BigdataValue,Void>
INonInlineExtensionCodes
public IV getExtensionIV()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.