public class SesameModelConnection extends Object implements ModelConnection
| Modifier and Type | Field and Description |
|---|---|
protected RDFDiffSink |
listenerSink |
protected SesameModel |
model |
protected org.openrdf.sail.SailConnection |
sailConnection |
protected org.openrdf.model.ValueFactory |
valueFactory |
| Modifier | Constructor and Description |
|---|---|
protected |
SesameModelConnection(SesameModel model,
RDFDiffSink listenerSink) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(RippleValue subj,
RippleValue pred,
RippleValue obj,
RippleValue... contexts)
Adds one or more RDF statements to the model.
|
RDFValue |
booleanValue(boolean b)
Constructs a boolean value.
|
RippleValue |
canonicalValue(RDFValue v)
Finds the "canonical" value, in Ripple space, for a given RDF value.
|
void |
close()
Closes this connection, releasing its resources and rolling back any uncommitted changes.
|
void |
commit()
Commits the current transaction.
|
long |
countStatements(org.openrdf.model.Resource... contexts) |
info.aduna.iteration.CloseableIteration<? extends org.openrdf.query.BindingSet,org.openrdf.query.QueryEvaluationException> |
evaluate(String query)
Evaluates a SPARQL query against the model.
|
void |
finish()
Complete any still-executing tasks.
|
Comparator<RippleValue> |
getComparator() |
Source<RippleValue> |
getContexts() |
Model |
getModel() |
Source<org.openrdf.model.Namespace> |
getNamespaces()
Retrieves all namespaces defined in this model.
|
org.openrdf.sail.SailConnection |
getSailConnection() |
void |
getStatements(RDFValue subj,
RDFValue pred,
RDFValue obj,
Sink<org.openrdf.model.Statement> sink)
Retrieves all statements in the model matching a given triple pattern.
|
boolean |
internalize(RippleList list)
Adds an RDF description of the given list to the model.
|
RDFValue |
languageTaggedValue(String s,
String language)
Constructs a language-tagged literal value in Ripple space.
|
RippleList |
list() |
NumericValue |
numericValue(BigDecimal b)
Constructs a big-decimal-typed numeric value.
|
NumericValue |
numericValue(double d)
Constructs a double-precision numeric value.
|
NumericValue |
numericValue(int i)
Constructs an integer-typed numeric value.
|
NumericValue |
numericValue(long l)
Constructs a long-integer-typed numeric value.
|
RDFValue |
plainValue(String s)
Constructs a plain literal value in Ripple space.
|
void |
query(StatementPatternQuery query,
Sink<RippleValue> sink,
boolean asynchronous)
Issues a triple pattern query over the model.
|
void |
remove(RippleValue subj,
RippleValue pred,
RippleValue obj,
RippleValue... contexts)
Removes matching RDF statements from the model.
|
void |
reset(boolean rollback)
Returns the ModelConnection to a normal state after an Exception has
been thrown.
|
void |
setNamespace(String prefix,
String ns,
boolean override)
Define a namespace prefix.
|
boolean |
toBoolean(RippleValue rv)
Attempts to convert a Ripple value to a boolean value.
|
Date |
toDateValue(RippleValue v)
Attempts to convert a Ripple value to a date value.
|
void |
toList(RippleValue v,
Sink<RippleList> sink)
Attempts to convert a Ripple value to a Ripple List.
|
NumericValue |
toNumericValue(RippleValue rv)
Attempts to convert a Ripple value to a numeric value.
|
String |
toString(RippleValue v)
Attempts to convert a Ripple value to a string value.
|
RDFValue |
typedValue(String s,
org.openrdf.model.URI dataType)
Constructs a typed RDF literal value.
|
RDFValue |
uriValue(String s)
Construct an RDF URI reference.
|
protected final SesameModel model
protected org.openrdf.sail.SailConnection sailConnection
protected final RDFDiffSink listenerSink
protected final org.openrdf.model.ValueFactory valueFactory
protected SesameModelConnection(SesameModel model, RDFDiffSink listenerSink) throws RippleException
RippleExceptionpublic Model getModel()
getModel in interface ModelConnectionModel of this connectionpublic void toList(RippleValue v, Sink<RippleList> sink) throws RippleException
ModelConnectiontoList in interface ModelConnectionv - the value to convert. It must be of a type which is convertible to a list,
or be the head of an RDF list in the model's RDF knowledge base.sink - a handler for successfully converted listsRippleException - if conversion failspublic RippleList list()
list in interface ModelConnectionpublic void finish()
throws RippleException
ModelConnectionfinish in interface ModelConnectionRippleExceptionpublic void close()
throws RippleException
ModelConnectionclose in interface ModelConnectionRippleException - if anything goes wrongpublic void reset(boolean rollback)
throws RippleException
reset in interface ModelConnectionrollback - whether to roll back the current transactionRippleException - if anything goes wrongpublic void commit()
throws RippleException
ModelConnectioncommit in interface ModelConnectionRippleException - if the transaction cannot be committedpublic org.openrdf.sail.SailConnection getSailConnection()
public boolean toBoolean(RippleValue rv) throws RippleException
ModelConnectiontoBoolean in interface ModelConnectionrv - the value to convert. It must be of a type which is convertible to boolean.RippleException - if the value cannot be convertedpublic NumericValue toNumericValue(RippleValue rv) throws RippleException
ModelConnectiontoNumericValue in interface ModelConnectionrv - the value to convert. It must be of a type which is convertible to a number.RippleException - if the value cannot be convertedpublic Date toDateValue(RippleValue v) throws RippleException
ModelConnectiontoDateValue in interface ModelConnectionv - the value to convert. It must be of a type which is convertible to a date.RippleException - if the value cannot be convertedpublic String toString(RippleValue v) throws RippleException
ModelConnectiontoString in interface ModelConnectionv - the value to convert.RippleException - if conversion failspublic void add(RippleValue subj, RippleValue pred, RippleValue obj, RippleValue... contexts) throws RippleException
ModelConnectionadd in interface ModelConnectionsubj - the subject of each statementpred - the predicate of each statementobj - the object of each statementcontexts - the graph contexts of the statements, if any.
For each non-null context supplied, a statement will be created and placed in the corresponding graph.
If a null context is supplied, a statement will be added to the default graph.
If no contexts are supplied, a single statement will be added to the default graph.RippleException - if the statement(s) cannot be addedpublic void remove(RippleValue subj, RippleValue pred, RippleValue obj, RippleValue... contexts) throws RippleException
ModelConnectionremove in interface ModelConnectionsubj - the subject of each matching statement, or null as a wildcardpred - the predicate of each matching statement, or null as a wildcardobj - the object of each matching statement, or null as a wildcardcontexts - zero or more graph contexts for matching statements.
For each non-null context supplied, matching statements from the corresponding graph will be removed.
If a null context is supplied, matching statements from the default context will be removed.
If no contexts are supplied, matching statements from all contexts will be removed.RippleException - if matching statements cannot be removedpublic long countStatements(org.openrdf.model.Resource... contexts)
throws RippleException
RippleExceptionpublic Comparator<RippleValue> getComparator()
getComparator in interface ModelConnectionpublic RDFValue uriValue(String s) throws RippleException
ModelConnectionuriValue in interface ModelConnections - the URI to convertRippleException - if the argument is not a valid URIpublic RippleValue canonicalValue(RDFValue v)
ModelConnectionSpecialValueMap.canonicalValue in interface ModelConnectionv - the RDF value to look uppublic RDFValue plainValue(String s) throws RippleException
ModelConnectionplainValue in interface ModelConnections - the lexical form of the stringRippleException - if the literal cannot be constructedpublic RDFValue languageTaggedValue(String s, String language) throws RippleException
ModelConnectionlanguageTaggedValue in interface ModelConnections - the label of the literallanguage - the language tag of the literal (e.g. "en" or "de")RippleException - if the literal cannot be constructedpublic RDFValue typedValue(String s, org.openrdf.model.URI dataType) throws RippleException
ModelConnectiontypedValue in interface ModelConnections - the label of the literaldataType - the data type of the valueRippleException - if the arguments do not define a valid literalpublic RDFValue booleanValue(boolean b) throws RippleException
ModelConnectionbooleanValue in interface ModelConnectionb - the primitive value to wrapRippleException - if the value cannot be constructedpublic NumericValue numericValue(int i) throws RippleException
ModelConnectionnumericValue in interface ModelConnectioni - the primitive value to wrapRippleException - if the value cannot be constructedpublic NumericValue numericValue(long l) throws RippleException
ModelConnectionnumericValue in interface ModelConnectionl - the primitive value to wrapRippleException - if the value cannot be constructedpublic NumericValue numericValue(double d) throws RippleException
ModelConnectionnumericValue in interface ModelConnectiond - the primitive value to wrapRippleException - if the value cannot be constructedpublic NumericValue numericValue(BigDecimal b) throws RippleException
ModelConnectionnumericValue in interface ModelConnectionb - the primitive value to wrapRippleException - if the value cannot be constructedpublic void setNamespace(String prefix, String ns, boolean override) throws RippleException
ModelConnectionsetNamespace in interface ModelConnectionprefix - the namespace prefixns - the namespace URI, or null to undefine a prefixoverride - whether to override an existing namespace with this prefix, if there is oneRippleException - if the namespace cannot be setpublic void query(StatementPatternQuery query, Sink<RippleValue> sink, boolean asynchronous) throws RippleException
ModelConnectionquery in interface ModelConnectionquery - the query to evaluatesink - a handler for query resultsasynchronous - whether the query should be evaluated in an asynchronous fashion,
allowing new threads to be spawned in order to compute results in parallelRippleException - if the query cannot be evaluatedpublic Source<org.openrdf.model.Namespace> getNamespaces() throws RippleException
ModelConnectiongetNamespaces in interface ModelConnectionRippleException - if namespaces cannot be retrievedpublic void getStatements(RDFValue subj, RDFValue pred, RDFValue obj, Sink<org.openrdf.model.Statement> sink) throws RippleException
ModelConnectiongetStatements in interface ModelConnectionsubj - the subject of matching statementspred - the predicate of matching statementsobj - the object of matching statementssink - a handler for matched statementsRippleException - if statements cannot be retrievedpublic info.aduna.iteration.CloseableIteration<? extends org.openrdf.query.BindingSet,org.openrdf.query.QueryEvaluationException> evaluate(String query) throws RippleException
ModelConnectionevaluate in interface ModelConnectionquery - the query to evaluateRippleException - if query evaluation failspublic Source<RippleValue> getContexts() throws RippleException
getContexts in interface ModelConnectionRippleException - if contexts cannot be retrievedpublic boolean internalize(RippleList list) throws RippleException
ModelConnectionrdf:type, rdf:first, and rdf:rest
statements for the list itself,
as well as those of any lists it contains, recursively.internalize in interface ModelConnectionlist - the list to internalizeRippleException - if internalization failsCopyright © 2007-2012 fortytwo.net. All Rights Reserved.