public interface Getter
Interface for retrieving statements from a Stardog database.
Usage:
// find a specific statement
c.get().subject(s).predicate(p).object(o).statement();
// get all statements w/ a specific subject
c.get().subject(s).iterator();
// get all statements w/ a specific predicate as a graph
c.get().predicate(p).graph();
Modifier and Type | Method and Description |
---|---|
boolean |
ask()
Returns whether or not
statements() returns any results, that is, whether or not there are any statements
which match the current state of this Getter . |
boolean |
ask(Statement theStatement)
Check to see if the statement exists in the database.
|
Getter |
context(Resource theContext)
Set the context to get from the database
|
Getter |
object(Value theObj)
Set the object to get from the database
|
Getter |
predicate(IRI theURI)
Set the predicate to get from the database.
|
Getter |
reasoning(boolean theReasoningType)
Sets the reasoning flag for this getter.
|
void |
reset()
Reset the state of this Getter
|
Stream<Statement> |
statements()
Return the
Stream of results resulting from the get operation. |
Stream<Statement> |
statements(Resource theSubj,
IRI thePredicate,
Value theObj,
Resource theContext)
Shortcut function for using
statements() . |
Getter |
subject(Resource theRes)
Set the subject to get from the database
|
Getter subject(Resource theRes) throws StardogException
theRes
- the subjectStardogException
- if the subject is invalidGetter predicate(IRI theURI) throws StardogException
theURI
- the predicateStardogException
- if the predicate is invalidGetter object(Value theObj) throws StardogException
theObj
- the objectStardogException
- if the object is invalidGetter context(Resource theContext) throws StardogException
theContext
- the contextStardogException
- if the subject is invalidStream<Statement> statements(Resource theSubj, IRI thePredicate, Value theObj, Resource theContext) throws StardogException
statements()
. Instead of having to set the subject, predicate,
and/or object separately and then call iterator, you can get the statements
directly.
*NOTE* The `Stream` corresponds to a result set from the server and *MUST* be closed when no longer in use.theSubj
- the subject to get, or null for anythePredicate
- the predicate to get, or null for anytheObj
- the object to get, or null for anytheContext
- the context to get, or null for anyStardogException
- if there is an error while retrieving the statementsboolean ask() throws StardogException
statements()
returns any results, that is, whether or not there are any statements
which match the current state of this Getter
.true
if there is at least one result or false
if there are no resultsStardogException
- if there is an error while retrieving the statementboolean ask(Statement theStatement) throws StardogException
Getter.subject(theStatement.getSubject())
.predicate(theStatement.getPredicate())
.object(theStatement.getObject())
.context(theStatement.getContext())
.ask()
theStatement
- the statement to checktrue
if the statement is in the database, false
otherwiseStardogException
Stream<Statement> statements() throws StardogException
Stream
of results resulting from the get operation.
The caller should ensure that the BaseStream.close()
method is called on the result to close any resources
used to retrieve the statements.StardogException
- if there is an error while retrieving the statementsGetter reasoning(boolean theReasoningType)
theReasoningType
- the reasoning flag to use for the Gettervoid reset() throws StardogException
StardogException
- if there is an error while resetting the state of the getter,
such as the connection is no longer openCopyright © 2010-2016 Stardog Union. All Rights Reserved.