com.bigdata.rdf.model
Class BigdataStatementImpl

java.lang.Object
  extended by com.bigdata.rdf.model.BigdataStatementImpl
All Implemented Interfaces:
IElement, BigdataStatement, ISPO, Serializable, Statement

public class BigdataStatementImpl
extends Object
implements BigdataStatement

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(IV). When used to model a quad, the 4th position will be a BigdataValue but its term identifier will report false for AbstractTripleStore#isStatement(IV).

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.

Version:
$Id: BigdataStatementImpl.java 5062 2011-08-20 23:37:29Z mrpersonick $
Author:
Bryan Thompson
See Also:
Serialized Form

Field Summary
protected  BigdataResource c
           
protected  BigdataValue o
           
protected  BigdataURI p
           
protected  BigdataResource s
           
 
Constructor Summary
BigdataStatementImpl(BigdataResource subject, BigdataURI predicate, BigdataValue object, BigdataResource context, StatementEnum type, boolean userFlag)
          Used by BigdataValueFactory
 
Method Summary
 IV c()
          The term identifier for the SID/context position (slot 3) -or- #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.
 IV get(int index)
          Return the s,p,o, or c value corresponding to the given index.
 BigdataResource getContext()
          Specialized return type.
 ModifiedEnum getModified()
          Return the state of the transient modified flag.
 BigdataValue getObject()
          Specialized return type.
 BigdataURI getPredicate()
          Specialized return type.
 IV getStatementIdentifier()
          The statement identifier (optional).
 StatementEnum getStatementType()
          Whether the statement is StatementEnum.Explicit, StatementEnum.Inferred or an StatementEnum.Axiom.
 BigdataResource getSubject()
          Specialized return type.
 boolean getUserFlag()
          Return true IFF the SPO user flag is set
 int hashCode()
          Note: implementation per Statement interface, which does not consider the context position.
 boolean hasStatementIdentifier()
          true IFF AbstractTripleStore#isStatement(IV) 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-#NULL.
 boolean isInferred()
          true if the statement is an inference that is not present as an explicit assertion or an axiom.
 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 setStatementIdentifier(boolean sidable)
          Mark whether or not the SPO will permit the statement identifier to be lazily materialized (default false).
 void setStatementType(StatementEnum type)
          Set the statement type for this statement.
 void setUserFlag(boolean userFlag)
          Set SPO user flag
 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
 

Field Detail

s

protected final BigdataResource s

p

protected final BigdataURI p

o

protected final BigdataValue o

c

protected final BigdataResource c
Constructor Detail

BigdataStatementImpl

public BigdataStatementImpl(BigdataResource subject,
                            BigdataURI predicate,
                            BigdataValue object,
                            BigdataResource context,
                            StatementEnum type,
                            boolean userFlag)
Used by BigdataValueFactory

Method Detail

getSubject

public final BigdataResource getSubject()
Description copied from interface: BigdataStatement
Specialized return type.

Specified by:
getSubject in interface BigdataStatement
Specified by:
getSubject in interface Statement

getPredicate

public final BigdataURI getPredicate()
Description copied from interface: BigdataStatement
Specialized return type.

Specified by:
getPredicate in interface BigdataStatement
Specified by:
getPredicate in interface Statement

getObject

public final BigdataValue getObject()
Description copied from interface: BigdataStatement
Specialized return type.

Specified by:
getObject in interface BigdataStatement
Specified by:
getObject in interface Statement

getContext

public final BigdataResource getContext()
Description copied from interface: BigdataStatement
Specialized return type.

Specified by:
getContext in interface BigdataStatement
Specified by:
getContext in interface Statement

hasStatementType

public final boolean hasStatementType()
Description copied from interface: ISPO
Return true iff the statement type is known. true iff the statement type is known for this statement.

Specified by:
hasStatementType in interface ISPO

getStatementType

public final StatementEnum getStatementType()
Description copied from interface: ISPO
Whether the statement is StatementEnum.Explicit, StatementEnum.Inferred or an StatementEnum.Axiom.

Specified by:
getStatementType in interface ISPO
Returns:
The StatementEnum type -or- null if the statement type has not been specified.

setStatementType

public final void setStatementType(StatementEnum type)
Description copied from interface: ISPO
Set the statement type for this statement.

Specified by:
setStatementType in interface ISPO
Parameters:
type - The statement type.

setUserFlag

public final void setUserFlag(boolean userFlag)
Description copied from interface: ISPO
Set SPO user flag

Specified by:
setUserFlag in interface ISPO

isAxiom

public final boolean isAxiom()
Description copied from interface: BigdataStatement
true if the statement is an axiom that is not present as an explicit assertion.

Specified by:
isAxiom in interface BigdataStatement
Specified by:
isAxiom in interface ISPO

isInferred

public final boolean isInferred()
Description copied from interface: BigdataStatement
true if the statement is an inference that is not present as an explicit assertion or an axiom.

Specified by:
isInferred in interface BigdataStatement
Specified by:
isInferred in interface ISPO

isExplicit

public final boolean isExplicit()
Description copied from interface: BigdataStatement
true if the statement is an explicit assertion.

Specified by:
isExplicit in interface BigdataStatement
Specified by:
isExplicit in interface ISPO

getUserFlag

public final boolean getUserFlag()
Description copied from interface: ISPO
Return true IFF the SPO user flag is set

Specified by:
getUserFlag in interface ISPO

equals

public boolean equals(Object o)
Specified by:
equals in interface Statement
Overrides:
equals in class Object

equals

public boolean equals(Statement stmt)
Note: implementation per Statement interface, which specifies that only the (s,p,o) positions are to be considered.


hashCode

public final int hashCode()
Note: implementation per Statement interface, which does not consider the context position.

Specified by:
hashCode in interface Statement
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

s

public final IV s()
Description copied from interface: ISPO
The term identifier for the subject position (slot 0) -or- #NULL.

Specified by:
s in interface ISPO

p

public final IV p()
Description copied from interface: ISPO
The term identifier for the predicate position (slot 1) -or- #NULL.

Specified by:
p in interface ISPO

o

public final IV o()
Description copied from interface: ISPO
The term identifier for the object position (slot 2) -or- #NULL.

Specified by:
o in interface ISPO

c

public final IV c()
Description copied from interface: ISPO
The term identifier for the SID/context position (slot 3) -or- #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.

Specified by:
c in interface ISPO
See Also:
AbstractTripleStore.Options#STATEMENT_IDENTIFIERS, AbstractTripleStore.Options#QUADS

get

public IV get(int index)
Description copied from interface: ISPO
Return the s,p,o, or c value corresponding to the given index.

Specified by:
get in interface IElement
Specified by:
get in interface ISPO
Parameters:
index - The legal values are: s=0, p=1, o=2, c=3.
Returns:
The value at the specified index.

isFullyBound

public final boolean isFullyBound()
Description copied from interface: ISPO
Return true iff all position (s,p,o) are non-#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.

Specified by:
isFullyBound in interface ISPO

setStatementIdentifier

public final void setStatementIdentifier(boolean sidable)
Description copied from interface: ISPO
Mark whether or not the SPO will permit the statement identifier to be lazily materialized (default false).

Specified by:
setStatementIdentifier in interface ISPO

getStatementIdentifier

public final IV getStatementIdentifier()
Description copied from interface: ISPO
The statement identifier (optional). This has nearly identical semantics to ISPO.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.

Specified by:
getStatementIdentifier in interface ISPO

hasStatementIdentifier

public final boolean hasStatementIdentifier()
Description copied from interface: ISPO
true IFF AbstractTripleStore#isStatement(IV) returns true for ISPO.c().

Specified by:
hasStatementIdentifier in interface ISPO

isOverride

public final boolean isOverride()
Description copied from interface: ISPO
When true 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).

Specified by:
isOverride in interface ISPO

setOverride

public final void setOverride(boolean override)
Description copied from interface: ISPO
Set the override flag.

Specified by:
setOverride in interface ISPO
Parameters:
override - the new value.

toString

public String toString(IRawTripleStore storeIsIgnored)
Note: this implementation is equivalent to toString() since the Values are already resolved.

Specified by:
toString in interface ISPO
Parameters:
storeIsIgnored - The database whose lexicon will be used.

isModified

public boolean isModified()
Specified by:
isModified in interface ISPO

setModified

public void setModified(ModifiedEnum modified)
Description copied from interface: ISPO
Set a transient flag indicating whether or not the persistent state of the statement was modified when it was last written onto the database. Modification can indicate that the statement was inserted, retracted, or had its associated StatementEnum in the database updated.

Specified by:
setModified in interface ISPO

getModified

public ModifiedEnum getModified()
Description copied from interface: ISPO
Return the state of the transient modified flag. This flag indicates whether or not the persistent state of the statement was modified when it was written onto the database. Modification can indicate that the statement was inserted, retracted, or had its associated StatementEnum in the database updated.

Specified by:
getModified in interface ISPO


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.