Hi Milorad, Nothing else to add Andy's responses .. more info on concurrency on http://jena.sourceforge.net/how-to/concurrency.html
Emilio On 7 Feb 2012, at 11:33, Milorad Tosic wrote: > Hi Emillio, > > Two small follow-up questions: > > 1) Having two different APIs for query and update SPARQL means that in a > SPARQL endpoint we should first try the query and if it throws exception then > we try update API? Or there is something else to deal with the separation > between the two APIs in processing a general SPARQL request? > > 2) Speaking about synchronization, does it mean that query model is thread > safe and we do not have to concern concurrent query requests? We only need to > do that for update? > > Thanks, > Milorad > > > > >> ________________________________ >> From: Emilio Migueláñez Martín <[email protected]> >> To: [email protected]; Milorad Tosic <[email protected]> >> Sent: Tuesday, February 7, 2012 12:08 PM >> Subject: Re: is SPARQL UPDATE supported in TDB >> >> 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] >> >> >> >> --- Emilio Migueláñez Martín [email protected]
