|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.rdf.model.BigdataStatementImpl
public class BigdataStatementImpl
Implementation reveals whether a statement is explicit, inferred, or an axiom
and the internal term identifiers for the subject, predicate, object, the
context bound on that statement (when present). When statement identifiers
are enabled, the context position (if bound) will be a blank node that
represents the statement having that subject, predicate, and object and its
term identifier, when assigned, will report true for
AbstractTripleStore.isStatement(long). When used to model a quad, the
4th position will be a BigdataValue but its term identifier will
report false for AbstractTripleStore.isStatement(long).
Note: The ctors are intentionally protected. Use the
BigdataValueFactory to create instances of this class - it will
ensure that term identifiers are propagated iff the backing lexicon is the
same.
| Field Summary |
|---|
| Fields inherited from interface com.bigdata.rdf.spo.ISPO |
|---|
NULL |
| Constructor Summary | |
|---|---|
protected |
BigdataStatementImpl(BigdataResource subject,
BigdataURI predicate,
BigdataValue object,
BigdataResource context,
StatementEnum type)
Used by BigdataValueFactory |
| Method Summary | |
|---|---|
long |
c()
The term identifier for the SID/context position (slot 3) -or- ISPO.NULL. |
boolean |
equals(Object o)
|
boolean |
equals(Statement stmt)
Note: implementation per Statement interface, which specifies
that only the (s,p,o) positions are to be considered. |
long |
get(int index)
Return the s,p,o, or c value corresponding to the given index. |
BigdataResource |
getContext()
Specialized return type. |
BigdataValue |
getObject()
Specialized return type. |
BigdataURI |
getPredicate()
Specialized return type. |
long |
getStatementIdentifier()
The statement identifier (optional). |
StatementEnum |
getStatementType()
Whether the statement is StatementEnum.Explicit,
StatementEnum.Inferred or an StatementEnum.Axiom. |
BigdataResource |
getSubject()
Specialized return type. |
int |
hashCode()
Note: implementation per Statement interface, which does not consider the context position. |
boolean |
hasStatementIdentifier()
true IFF AbstractTripleStore.isStatement(long)
returns true for ISPO.c(). |
boolean |
hasStatementType()
Return true iff the statement type is known. |
boolean |
isAxiom()
true if the statement is an axiom that is not present as
an explicit assertion. |
boolean |
isExplicit()
true if the statement is an explicit assertion. |
boolean |
isFullyBound()
Return true iff all position (s,p,o) are non- ISPO.NULL. |
boolean |
isInferred()
true if the statement is an inference that is not present
as an explicit assertion or an axiom. |
boolean |
isOverride()
When true the statement will be written onto the database
with exactly its current ISPO.getStatementType() (default
false). |
long |
o()
The term identifier for the object position (slot 2) -or- ISPO.NULL. |
long |
p()
The term identifier for the predicate position (slot 1) -or- ISPO.NULL. |
long |
s()
The term identifier for the subject position (slot 0) -or- ISPO.NULL. |
byte[] |
serializeValue(ByteArrayBuffer buf)
Return the byte[] that would be written into a statement index for this ISPO, including the optional StatementEnum.MASK_OVERRIDE
bit. |
void |
setOverride(boolean override)
Set the override flag. |
void |
setStatementIdentifier(long sid)
Set the statement identifier. |
void |
setStatementType(StatementEnum type)
Set the statement type for this statement. |
String |
toString()
|
String |
toString(IRawTripleStore storeIsIgnored)
Note: this implementation is equivalent to toString() since the
Values are already resolved. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected BigdataStatementImpl(BigdataResource subject,
BigdataURI predicate,
BigdataValue object,
BigdataResource context,
StatementEnum type)
BigdataValueFactory
| Method Detail |
|---|
public final BigdataResource getSubject()
BigdataStatement
getSubject in interface BigdataStatementgetSubject in interface Statementpublic final BigdataURI getPredicate()
BigdataStatement
getPredicate in interface BigdataStatementgetPredicate in interface Statementpublic final BigdataValue getObject()
BigdataStatement
getObject in interface BigdataStatementgetObject in interface Statementpublic final BigdataResource getContext()
BigdataStatement
getContext in interface BigdataStatementgetContext in interface Statementpublic final boolean hasStatementType()
ISPOtrue iff the statement type is known.
true iff the statement type is known for this statement.
hasStatementType in interface ISPOpublic final StatementEnum getStatementType()
ISPOStatementEnum.Explicit,
StatementEnum.Inferred or an StatementEnum.Axiom.
getStatementType in interface ISPOStatementEnum type -or- null if the
statement type has not been specified.public final void setStatementType(StatementEnum type)
ISPO
setStatementType in interface ISPOtype - The statement type.public final boolean isAxiom()
BigdataStatementtrue if the statement is an axiom that is not present as
an explicit assertion.
isAxiom in interface BigdataStatementisAxiom in interface ISPOpublic final boolean isInferred()
BigdataStatementtrue if the statement is an inference that is not present
as an explicit assertion or an axiom.
isInferred in interface BigdataStatementisInferred in interface ISPOpublic final boolean isExplicit()
BigdataStatementtrue if the statement is an explicit assertion.
isExplicit in interface BigdataStatementisExplicit in interface ISPOpublic boolean equals(Object o)
equals in interface Statementequals in class Objectpublic final boolean equals(Statement stmt)
Statement interface, which specifies
that only the (s,p,o) positions are to be considered.
public final int hashCode()
hashCode in interface StatementhashCode in class Objectpublic String toString()
toString in class Objectpublic final long s()
ISPOISPO.NULL.
s in interface ISPOpublic final long p()
ISPOISPO.NULL.
p in interface ISPOpublic final long o()
ISPOISPO.NULL.
o in interface ISPOpublic final long c()
ISPOISPO.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 ISPO.NULL iff the context was not bound.
c in interface ISPOAbstractTripleStore.Options#STATEMENT_IDENTIFIERS,
AbstractTripleStore.Options#QUADSpublic long get(int index)
ISPO
get in interface ISPOindex - The legal values are: s=0, p=1, o=2, c=3.public final boolean isFullyBound()
ISPOISPO.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.
FIXME quads : this method might need to be aware of the database mode,
e.g., pass in [boolean quads]. if its semantics are restricted to whether
the triple pattern is fully bound, then clarify that here.
isFullyBound in interface ISPOpublic final void setStatementIdentifier(long sid)
ISPO
setStatementIdentifier in interface ISPOsid - The statement identifier.public final long 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()
ISPOtrue IFF AbstractTripleStore.isStatement(long)
returns true for ISPO.c().
hasStatementIdentifier in interface ISPOpublic final 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 void setOverride(boolean override)
ISPO
setOverride in interface ISPOoverride - the new value.public byte[] serializeValue(ByteArrayBuffer buf)
ISPOISPO, including the optional StatementEnum.MASK_OVERRIDE
bit. If the ISPO.hasStatementIdentifier() would return
true, then the SID will be included in the returned byte[].
Note that ISPO.hasStatementIdentifier() is defined in terms of the
bit pattern of the SID identifiers and therefore will be
true ONLY for a statement identifier and NOT for an RDF
Value identifier.
serializeValue in interface ISPObuf - A buffer supplied by the caller. The buffer will be reset
before the value is written on the buffer.
ISPO.public String toString(IRawTripleStore storeIsIgnored)
toString() since the
Values are already resolved.
toString in interface ISPOstoreIsIgnored - The database whose lexicon will be used.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||