public class SPOKeyOrder extends AbstractKeyOrder<ISPO> implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
_CSPO |
static int |
_OCSP |
static int |
_OSP |
static int |
_PCSO |
static int |
_POCS |
static int |
_POS |
static int |
_SOPC |
static int |
_SPO |
static int |
_SPOC |
static int |
C |
static SPOKeyOrder |
CSPO |
static int |
FIRST_QUAD_INDEX |
static int |
FIRST_TRIPLE_INDEX |
static int |
LAST_QUAD_INDEX |
static int |
LAST_TRIPLE_INDEX |
static int |
MAX_INDEX_COUNT |
static int |
O |
static SPOKeyOrder |
OCSP |
static SPOKeyOrder |
OSP |
static int |
P |
static SPOKeyOrder |
PCSO |
static SPOKeyOrder |
POCS |
static SPOKeyOrder |
POS |
static int |
S |
static SPOKeyOrder |
SOPC |
static SPOKeyOrder |
SPO |
static SPOKeyOrder |
SPOC |
Modifier and Type | Method and Description |
---|---|
IKeyBuilder |
appendKey(IKeyBuilder keyBuilder,
ISPO spo)
Appends the key for a given index order into the
IKeyBuilder . |
protected void |
appendKeyComponent(IKeyBuilder keyBuilder,
int index,
Object keyComponent)
Encodes an value into the key.
|
SPO |
decodeKey(byte[] key)
Decode the key into an
SPO . |
SPO |
decodeKey(byte[] key,
int offset)
Decode the key into an
SPO . |
byte[] |
encodeKey(IKeyBuilder keyBuilder,
ISPO spo)
Forms the key for a given index order (the
SPOTupleSerializer
delegates its behavior to this method). |
static SPOKeyOrder |
fromString(String name)
Covert a name of an
SPOKeyOrder into an SPOKeyOrder . |
Comparator<ISPO> |
getComparator()
Return the comparator that places
ISPO s into the natural order
for the associated index. |
byte[] |
getFromKey(IKeyBuilder keyBuilder,
IPredicate<ISPO> predicate)
Return the inclusive lower bound which would be used for a query against
this
IKeyOrder for the given IPredicate . |
String |
getIndexName()
The base name for the index.
|
int |
getKeyArity()
Return either 3 or 4 depending on the #of components in the key for
this natural key ordering.
|
int |
getKeyOrder(int keyPos)
Return the index of the slot in the
ISPO tuple which appears at
the specified position in the key. |
static SPOKeyOrder |
getKeyOrder(IPredicate<ISPO> predicate,
int keyArity)
Return the
SPOKeyOrder for the given predicate. |
int |
getPositionInIndex(int spoIdentifier)
Returns the position of the given spoIdentifier in the index.
|
byte[] |
getToKey(IKeyBuilder keyBuilder,
IPredicate<ISPO> predicate)
Return the exclusive upper bound which would be used for a query against
this
IKeyOrder for the given IPredicate . |
int |
index()
The integer used to represent the
SPOKeyOrder . |
boolean |
isPrimaryIndex()
Return
true if this is the primary index for the relation. |
static Iterator<SPOKeyOrder> |
quadStoreKeyOrderIterator()
|
static Iterator<SPOKeyOrder> |
spocOnlyKeyOrderIterator()
Return an iterator which visits only
SPOC . |
static Iterator<SPOKeyOrder> |
spoOnlyKeyOrderIterator()
Return an iterator which visits only
SPO . |
String |
toString()
Return
getIndexName() 's value. |
static Iterator<SPOKeyOrder> |
tripleStoreKeyOrderIterator()
|
static SPOKeyOrder |
valueOf(int index)
Returns the singleton corresponding to the index.
|
getKey
public static final transient int _SPO
public static final transient int _OSP
public static final transient int _POS
public static final transient int _SPOC
public static final transient int _POCS
public static final transient int _OCSP
public static final transient int _CSPO
public static final transient int _PCSO
public static final transient int _SOPC
public static final transient int FIRST_TRIPLE_INDEX
public static final transient int LAST_TRIPLE_INDEX
public static final transient int FIRST_QUAD_INDEX
public static final transient int LAST_QUAD_INDEX
public static final transient int MAX_INDEX_COUNT
public static final transient SPOKeyOrder SPO
public static final transient SPOKeyOrder POS
public static final transient SPOKeyOrder OSP
public static final transient SPOKeyOrder SPOC
public static final transient SPOKeyOrder POCS
public static final transient SPOKeyOrder OCSP
public static final transient SPOKeyOrder CSPO
public static final transient SPOKeyOrder PCSO
public static final transient SPOKeyOrder SOPC
public static final transient int S
public static final transient int P
public static final transient int O
public static final transient int C
public final boolean isPrimaryIndex()
true
if this is the primary index for the relation.public static SPOKeyOrder valueOf(int index)
index
- The index.SPOKeyOrder
having that index.IllegalArgumentException
- if the index is not valid.public static SPOKeyOrder fromString(String name)
SPOKeyOrder
into an SPOKeyOrder
.name
- The name.SPOKeyOrder
.IllegalArgumentException
- if name is not a known SPOKeyOrder
.public final String getIndexName()
getIndexName
in interface IKeyOrder<ISPO>
public String toString()
getIndexName()
's value.public final int getKeyArity()
getKeyArity
in interface IKeyOrder<ISPO>
public final int getKeyOrder(int keyPos)
ISPO
tuple which appears at
the specified position in the key.getKeyOrder
in interface IKeyOrder<ISPO>
keyPos
- The index into the key that is being generated.ISPO
.public final int getPositionInIndex(int spoIdentifier)
spoIdentifier
- identifier, either being 0=subject, 1=predicate,
2=object, or 3=contextpublic final int index()
public final Comparator<ISPO> getComparator()
ISPO
s into the natural order
for the associated index.getComparator
in interface IKeyOrder<ISPO>
public byte[] getFromKey(IKeyBuilder keyBuilder, IPredicate<ISPO> predicate)
IKeyOrder
for the given IPredicate
.
TODO I think that we should just rely on the correct attachment of the
range constraint filters to the SPs (and the propagation of the
constraints to the IPredicates) rather than doing dynamic attachment
here. Static analysis can determine when the variable will become bound,
whether in the scope of a required join group or an optional join group.
(In the case of the optional join group, the joins in the group are still
required joins, it is just that the solutions outside of the group will
not have a binding for the variable unless it became bound within the
optional group. However, this does not change how we attach the range
constraints to the SPs since a range constraint which is lifted onto the
AP can only be applied when the variable would become bound by that AP.
If the variable is already bound, it is of no consequence. The only
wrinkle would be when one optional group MIGHT have already bound a
variable and then another optional group which could also bind the same
variable could observe either a bound variable or an unbound variable.
The FILTER would have to be in place in both optional groups and the
range constraint would be lifted onto the access path in both groups.)getFromKey
in interface IKeyOrder<ISPO>
getFromKey
in class AbstractKeyOrder<ISPO>
keyBuilder
- The object which will be used to construct the key.predicate
- A predicate describing bound and unbound fields for the key.IPredicate
.(lift range
constraints onto AP).
public byte[] getToKey(IKeyBuilder keyBuilder, IPredicate<ISPO> predicate)
IKeyOrder
for the given IPredicate
.
TODO See my notes on getFromKey(). The issue is exactly the same for the
toKey and fromKey.
TODO Each GT(E)/LT(E) constraint should be broken down into a separate
filter so we can apply one even when the other might depend on a variable
which is not yet bound.getToKey
in interface IKeyOrder<ISPO>
getToKey
in class AbstractKeyOrder<ISPO>
keyBuilder
- The object which will be used to construct the key.predicate
- A predicate describing bound and unbound fields for the key.IPredicate
.(lift range
constraints onto AP).
protected void appendKeyComponent(IKeyBuilder keyBuilder, int index, Object keyComponent)
AbstractKeyOrder
IKeyBuilder
. If you need to specialize how a value
gets encoded into the key then you can override this method.appendKeyComponent
in class AbstractKeyOrder<ISPO>
public final byte[] encodeKey(IKeyBuilder keyBuilder, ISPO spo)
SPOTupleSerializer
delegates its behavior to this method).
Note: The IKeyBuilder
is IKeyBuilder.reset()
by this
method.
keyBuilder
- The key builder.spo
- The ISPO
.appendKey(IKeyBuilder, ISPO)
public final IKeyBuilder appendKey(IKeyBuilder keyBuilder, ISPO spo)
IKeyBuilder
.
Note: The IKeyBuilder
is NOT IKeyBuilder.reset()
by this
method.
keyBuilder
- The key builder - this is NOT reset().spo
- The ISPO
.IKeyBuilder
.appendKey(IKeyBuilder, ISPO)
public final SPO decodeKey(byte[] key)
SPO
. The StatementEnum
and the
optional SID will not be decoded, since it is carried in the B+Tree
value. However, if the SPOKeyOrder
is a quad order then the
SPO.c()
will be bound.key
- The key.public final SPO decodeKey(byte[] key, int offset)
SPO
. The StatementEnum
and the
optional SID will not be decoded, since it is carried in the B+Tree
value. However, if the SPOKeyOrder
is a quad order then the
SPO.c()
will be bound.key
- The key.offset
- The offset into the key.public static SPOKeyOrder getKeyOrder(IPredicate<ISPO> predicate, int keyArity)
SPOKeyOrder
for the given predicate.predicate
- The predicate.SPOKeyOrder
public static Iterator<SPOKeyOrder> tripleStoreKeyOrderIterator()
public static Iterator<SPOKeyOrder> quadStoreKeyOrderIterator()
public static Iterator<SPOKeyOrder> spoOnlyKeyOrderIterator()
SPO
.public static Iterator<SPOKeyOrder> spocOnlyKeyOrderIterator()
SPOC
.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.