Hi Milorad,
The SPARQL UPDATE doesn't use the same API calls as other SPARQL queries.
Try the following
model.enterCriticalSection(Lock.WRITE);
ry {
UpdateRequest updateRequest = UpdateFactory.create(querystr);
UpdateAction.execute(updateRequest, m_triplestore);
} finally {
m_triplestore.commit();
TDB.sync(m_triplestore);
model.leaveCriticalSection();
}
Some examples of ARQ's SPARQL Update support are to be found in the download in
src-examples/arq/examples/update.
Regards,
Emilio
On 7 Feb 2012, at 10:58, Milorad Tosic wrote:
> Hi,
>
> Does TDB support SPARQL UPDATE?
>
>
> I have a simple Java code that instantiates TDB like:
> ...
> Query query = QueryFactory.create(querystr);
> QueryExecution qe = QueryExecutionFactory.create(query,
> m_triplestore);
>
> ResultSet results = qe.execSelect();
> ResultSetFormatter.out(out, results, query);
>
> ...
>
> Initially, TDB is empty.
>
>
> For querystr =
>
> SELECT * WHERE { ?x ?p ?o },
>
> I got expected result i.e. an empty set of triplets.
>
> However, for querystr =
> PREFIX eg: <http://example.org/ontology#>
> INSERT DATA
> {
> eg:dummySubject1 eg:dummyPredicate2 eg:dummyObject2.
> }
> TDB didn't recognize the "INSERT DATA" keyword, and reported:
> com.hp.hpl.jena.query.QueryParseException: Encountered " <INSERT_DATA>
> "INSERT DATA "" at line 2, column 1.
> Was expecting one of:
> "prefix" ...
> "select" ...
> "describe" ...
> "construct" ...
> "ask" ...
>
>
> My configuration is like follows:
>
> arq-2.8.7.jar
> jena-2.6.4.jar
> tdb.0.8.10.jar
>
> Thanks,
> Milorad
---
Emilio Migueláñez Martín
[email protected]