public class SPO extends Object implements ISPO, Serializable
#setStatementIdentifier(IV) will reject
arguments if they can not be validated as statement identifiers (based on
their bit pattern).| Modifier and Type | Field and Description |
|---|---|
byte |
flags
Bit flags used to represent statement type, user flag, override,
modified enum, and sidable flag.
|
IV |
o
The internal value for the object position.
|
IV |
p
The internal value for the predicate position.
|
IV |
s
The internal value for the subject position.
|
| Constructor and Description |
|---|
SPO(BigdataResource s,
BigdataURI p,
BigdataValue o,
StatementEnum type)
Construct a triple from
BigdataValues and the specified statement
type. |
SPO(BigdataStatement stmt)
Construct a triple/quad from a
BigdataStatement. |
SPO(IConstant<IV> s,
IConstant<IV> p,
IConstant<IV> o,
StatementEnum type)
Variant to create an
SPO from constants (used by the unit tests). |
SPO(IPredicate<ISPO> predicate)
Variant to create an SPO from a predicate - the
StatementEnum and
statement identifier are not specified. |
SPO(IV s,
IV p,
IV o)
Triple constructor for a statement whose type is NOT known.
|
SPO(IV s,
IV p,
IV o,
IV c)
Quads constructor.
|
SPO(IV s,
IV p,
IV o,
IV c,
StatementEnum type)
Quads constructor with
StatementEnum. |
SPO(IV s,
IV p,
IV o,
StatementEnum type)
Construct a triple.
|
| Modifier and Type | Method and Description |
|---|---|
IV |
c()
The term identifier for the SID/context position (slot 3) -or-
#NULL. |
boolean |
equals(ISPO stmt2)
True iff the
ISPOs are the same object or if the same term
identifiers are assigned for the subject, predicate and object positions,
and the same StatementEnum are the same. |
boolean |
equals(Object o) |
IV |
get(int index)
Return the s,p,o, or c value corresponding to the given index.
|
org.openrdf.model.Resource |
getContext() |
ModifiedEnum |
getModified()
Return the state of the transient modified flag.
|
org.openrdf.model.Value |
getObject() |
org.openrdf.model.URI |
getPredicate() |
IV |
getStatementIdentifier()
The statement identifier (optional).
|
StatementEnum |
getStatementType()
|
org.openrdf.model.Resource |
getSubject() |
boolean |
getUserFlag()
Return
true IFF the SPO has the user flag bit set. |
int |
hashCode()
Hash code for the (s,p,o) per Sesame's
Statement.hashCode(). |
boolean |
hasStatementIdentifier()
|
boolean |
hasStatementType()
Return
true iff the statement type is known. |
boolean |
isAxiom()
|
boolean |
isExplicit()
|
boolean |
isFullyBound()
Return true iff all position (s,p,o) are non-
#NULL. |
boolean |
isInferred()
|
boolean |
isModified() |
boolean |
isOverride()
When
true the statement will be written onto the database
with exactly its current ISPO.getStatementType() (default
false). |
IV |
o()
The term identifier for the object position (slot 2) -or-
#NULL. |
IV |
p()
The term identifier for the predicate position (slot 1) -or-
#NULL. |
IV |
s()
The term identifier for the subject position (slot 0) -or-
#NULL. |
void |
setModified(ModifiedEnum modified)
Set a transient flag indicating whether or not the persistent state of
the statement was modified when it was last written onto the database.
|
void |
setOverride(boolean override)
Set the override flag.
|
void |
setStatementType(StatementEnum type)
Set the statement type for this statement.
|
void |
setUserFlag(boolean userFlag)
Set the user flag bit on this SPO.
|
String |
toString()
Return a representation of the statement using the term identifiers (the
identifiers are NOT resolved to terms).
|
String |
toString(IRawTripleStore store)
Resolves the term identifiers to terms against the store and returns a
representation of the statement using
IRawTripleStore.toString(IV, IV, IV). |
static String |
toString(IV iv)
Represents the term identifier together with its type (literal, bnode,
uri, or statement identifier).
|
public final IV s
public final IV p
public final IV o
public byte flags
public SPO(IV s, IV p, IV o)
Note: This is primarily used when you want to discover the type of the statement.
AbstractTripleStore#bulkCompleteStatements(ISPOIterator)public SPO(IV s, IV p, IV o, StatementEnum type)
Note: When the statement is StatementEnum.Inferred you MUST also
construct the appropriate Justification.
s - p - o - type - The statement type.public SPO(IV s, IV p, IV o, IV c, StatementEnum type)
StatementEnum.s - p - o - c - type - public SPO(IConstant<IV> s, IConstant<IV> p, IConstant<IV> o, StatementEnum type)
SPO from constants (used by the unit tests).s - p - o - type - public SPO(IPredicate<ISPO> predicate)
StatementEnum and
statement identifier are not specified. This may be used as a convenience
to extract the {s, p, o, c} from an IPredicate or from an
IAccessPath when the predicate is not known to be an
SPOPredicate.predicate - The predicate.public SPO(BigdataResource s, BigdataURI p, BigdataValue o, StatementEnum type)
BigdataValues and the specified statement
type.s - p - o - type - public SPO(BigdataStatement stmt)
BigdataStatement. The term
identifiers and statement type information available on the
BigdataStatement will be used to initialize the SPO.stmt - The statement.public final IV get(int index)
ISPOpublic final IV s()
ISPO#NULL.public final IV p()
ISPO#NULL.public final IV o()
ISPO#NULL.public final IV c()
ISPO#NULL. The semantics of the returned value depend on the database
mode. For triples, it is unused. For triples+SIDs, it is the statement
identifier as assigned by the lexicon. For quads, it is the context (aka
named graph) and #NULL iff the context was not bound.public final IV getStatementIdentifier()
ISPOISPO.c(), but will throw an exception if the 4th position is not
bound.
Statement identifiers are a unique per-triple identifier assigned when a
statement is first asserted against the database and are are defined iff
AbstractTripleStore.Options#STATEMENT_IDENTIFIERS was specified.
getStatementIdentifier in interface ISPOpublic final boolean hasStatementIdentifier()
ISPOhasStatementIdentifier in interface ISPOpublic void setOverride(boolean override)
ISPOsetOverride in interface ISPOoverride - the new value.public boolean isOverride()
ISPOtrue the statement will be written onto the database
with exactly its current ISPO.getStatementType() (default
false).
Note: This feature is used by TruthMaintenance when we need to
downgrade an ISPO from "Explicit" to "Inferred". Normally, a
statement is automatically upgraded from "Inferred" to "Explicit" so
without ISPO.setOverride(boolean) you could not downgrade the
StatementEnum in the database without first deleting the
statement (which would also delete its justifications).
isOverride in interface ISPOpublic final boolean isExplicit()
isExplicit in interface ISPOpublic final boolean isInferred()
isInferred in interface ISPOpublic final boolean getUserFlag()
true IFF the SPO has the user flag bit set.getUserFlag in interface ISPOpublic final void setUserFlag(boolean userFlag)
setUserFlag in interface ISPOpublic int hashCode()
Statement.hashCode(). It
DOES NOT consider the context position.public boolean equals(Object o)
public boolean equals(ISPO stmt2)
ISPOs are the same object or if the same term
identifiers are assigned for the subject, predicate and object positions,
and the same StatementEnum are the same.
Note: This is NOT the same test as
BigdataStatementImpl.equals(Object) since the latter is
implemented per the Statement interface.
public String toString()
public static String toString(IV iv)
iv - The term identifier.public String toString(IRawTripleStore store)
IRawTripleStore.toString(IV, IV, IV).public final boolean isFullyBound()
ISPO#NULL.
Note: SPOs are sometimes used to represent triple patterns, e.g.,
in the tail of a Justification. This method will return
true if the "triple pattern" is fully bound and
false if there are any unbound positions.
Note: BigdataStatements are not fully bound when they are
instantiated during parsing until their term identifiers have been
resolved against a database's lexicon.
isFullyBound in interface ISPOpublic final StatementEnum getStatementType()
ISPOgetStatementType in interface ISPOStatementEnum type -or- null if the
statement type has not been specified.public final void setStatementType(StatementEnum type)
ISPOsetStatementType in interface ISPOtype - The statement type.public final boolean hasStatementType()
ISPOtrue iff the statement type is known.
true iff the statement type is known for this statement.hasStatementType in interface ISPOpublic boolean isModified()
isModified in interface ISPOpublic void setModified(ModifiedEnum modified)
ISPOStatementEnum in the database updated.setModified in interface ISPOpublic ModifiedEnum getModified()
ISPOStatementEnum in the database updated.getModified in interface ISPOpublic org.openrdf.model.Resource getContext()
Note: This methods rely on the fact that IV implements Value. The
returned IV will act like a Value if it is inline or if it has been
materialized. If the IV is not-inline and its value has not been
materialized from the appropriate index or explicitly set through
IVCache.setValue(BigdataValue), then an attempt to access the
state of the Value through its Value interface will throw
a NotMaterializedException.
getContext in interface org.openrdf.model.Statementpublic org.openrdf.model.Value getObject()
Note: This methods rely on the fact that IV implements Value. The
returned IV will act like a Value if it is inline or if it has been
materialized. If the IV is not-inline and its value has not been
materialized from the appropriate index or explicitly set through
IVCache.setValue(BigdataValue), then an attempt to access the
state of the Value through its Value interface will throw
a NotMaterializedException.
getObject in interface org.openrdf.model.Statementpublic org.openrdf.model.URI getPredicate()
Note: This methods rely on the fact that IV implements Value. The
returned IV will act like a Value if it is inline or if it has been
materialized. If the IV is not-inline and its value has not been
materialized from the appropriate index or explicitly set through
IVCache.setValue(BigdataValue), then an attempt to access the
state of the Value through its Value interface will throw
a NotMaterializedException.
getPredicate in interface org.openrdf.model.Statementpublic org.openrdf.model.Resource getSubject()
Note: This methods rely on the fact that IV implements Value. The
returned IV will act like a Value if it is inline or if it has been
materialized. If the IV is not-inline and its value has not been
materialized from the appropriate index or explicitly set through
IVCache.setValue(BigdataValue), then an attempt to access the
state of the Value through its Value interface will throw
a NotMaterializedException.
getSubject in interface org.openrdf.model.StatementCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.