public class SidIV<V extends BigdataBNode> extends AbstractInlineIV<V,ISPO> implements Serializable, org.openrdf.model.BNode
ISPO
supplied in the ctor as the inline value. The
#asValue(BigdataValueFactory, ILexiconConfiguration)
method returns a
BigdataBNode
that is used to represent the sid in serialization
formats (such as the custom RDF/XML extension for sids). The bnode is
guaranteed to always have the same bnode id for a given inlined SPO. This is
accomplished using the byte[] key encoding for the spo along with the
BigInteger class.
This internal value has a VTE
of VTE.STATEMENT
. It is encoded
into the statement indices by directly encoding the spo using
SPOKeyOrder.encodeKey(IKeyBuilder, ISPO)
via the
SPOKeyOrder.SPO
key order. Thus when decoded from the statement
indices, the spo associated with this sid is materialized directly from the
sid itself. See IVUtility.decode(byte[])
. The spo decoded from the
sid IV will be marked as explicit (only explicit statements have sids) and
this SidIV will be attached to it. This completely eliminates the need for a
reverse index from sid->spo, as the spo is encoded inline into the SidIV
itself. This replaces the TermId model for representing sids.
flags
Constructor and Description |
---|
SidIV(ISPO spo)
Ctor with internal value spo specified.
|
Modifier and Type | Method and Description |
---|---|
int |
_compareTo(IV o)
Compare two
IV s having the same intrinsic datatype. |
V |
asValue(LexiconRelation lex)
Returns the bnode representation of this IV, useful for serialization
formats such as RDF/XML.
|
int |
byteLength()
Return the byte length for the byte[] encoded representation of this
internal value.
|
IV<V,ISPO> |
clone(boolean clearCache)
Return a copy of this
IV . |
IKeyBuilder |
encode(IKeyBuilder keyBuilder)
Encode this internal value into the supplied key builder.
|
boolean |
equals(Object o)
Two
SidIV are equal if their (s,p,o) IVs are equal. |
String |
getID()
Implements
BNode.getID() . |
ISPO |
getInlineValue()
Returns the inline spo.
|
int |
hashCode()
Return a hash code based on the value of the point in the value space.
|
boolean |
needsMaterialization()
Does not need materialization to answer BNode interface methods.
|
String |
stringValue()
Implements
Value.stringValue() . |
static byte |
toFlags()
Return the
flags byte for a SidIV . |
String |
toString() |
isInline
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 SidIV(ISPO spo)
public IV<V,ISPO> 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.
clone
in interface IVCache<V extends BigdataBNode,ISPO>
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 static final byte toFlags()
flags
byte for a SidIV
.public ISPO getInlineValue() throws UnsupportedOperationException
getInlineValue
in interface IV<V extends BigdataBNode,ISPO>
Object
.UnsupportedOperationException
- unless the RDF value is inline.public V asValue(LexiconRelation lex)
#bnodeId()
.asValue
in interface IVCache<V extends BigdataBNode,ISPO>
lex
- The lexicon relation (this is required in order to access the
BigdataValueFactory
for the namespace associated with
lexicon when we materialize an inline IV
).BigdataValue
.public int byteLength()
byteLength
in interface IV<V extends BigdataBNode,ISPO>
public int hashCode()
AbstractIV
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 class AbstractIV<V extends BigdataBNode,ISPO>
public String getID()
BNode.getID()
.
This implementation uses the BigInteger
class to create a unique
blank node ID based on the unsigned byte[]
key of the inline
SPO
.
getID
in interface org.openrdf.model.BNode
public boolean equals(Object o)
SidIV
are equal if their (s,p,o) IVs are equal.equals
in interface org.openrdf.model.BNode
equals
in class AbstractIV<V extends BigdataBNode,ISPO>
public int _compareTo(IV o)
AbstractIV
IV
s having the same intrinsic datatype._compareTo
in class AbstractIV<V extends BigdataBNode,ISPO>
public IKeyBuilder encode(IKeyBuilder keyBuilder)
Encode the IV
as an unsigned byte[].
encode
in interface IV<V extends BigdataBNode,ISPO>
encode
in class AbstractIV<V extends BigdataBNode,ISPO>
keyBuilder
- The object used to encode the IV
.public String stringValue()
Value.stringValue()
.stringValue
in interface org.openrdf.model.Value
public boolean needsMaterialization()
needsMaterialization
in interface IV<V extends BigdataBNode,ISPO>
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.