You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Charles Abela <ch...@gmail.com> on 2015/04/07 17:50:32 UTC
consecutive queries
Hi,
I'm loading data from an existing file into a model using the following
code:
dataset.begin(ReadWrite.WRITE) ;
try {
m = dataset.getDefaultModel() ;
RDFDataMgr.read(m, file) ;
dataset.commit() ;
} finally { dataset.end() ; }
and I'm querying using the text:query as follows:
ds.begin(ReadWrite.WRITE) ;
.....
try{
String qs = StrUtils.strjoinNL(
"SELECT ?s ?info"
" { ?s text:query (myspace:info \'"+query+"\') ;"
, " myspace:info ?info . "
," }") ;
Query q = QueryFactory.create(pre+"\n"+qs) ;
QueryExecution qexec = QueryExecutionFactory.create(q , ds) ;
QueryExecUtils.executeQuery(q, qexec) ;
...
finally { ds.end() ; }
when I pass the first query string results are returned fine, however when
I pass another query string I'm getting the following exception:
Exception in thread "AWT-EventQueue-0"
org.apache.jena.query.text.TextIndexException:
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out:
org.apache.lucene.store.SingleInstanceLock@142847f2: write.lock
at
org.apache.jena.query.text.TextIndexLucene.exception(TextIndexLucene.java:294)
at
org.apache.jena.query.text.TextIndexLucene.startIndexing(TextIndexLucene.java:115)
at
org.apache.jena.query.text.TextDocProducerTriples.start(TextDocProducerTriples.java:40)
at
org.apache.jena.query.text.DatasetGraphText.begin(DatasetGraphText.java:104)
at com.hp.hpl.jena.sparql.core.DatasetImpl.begin(DatasetImpl.java:125)
.....................
any ideas as to why?
thanks
Re: consecutive queries
Posted by Charles Abela <ch...@gmail.com>.
Solved..my mistake..should have used ds.begin(ReadWrite.READ) ;
On Tue, Apr 7, 2015 at 5:50 PM, Charles Abela <ch...@gmail.com>
wrote:
> Hi,
> I'm loading data from an existing file into a model using the following
> code:
> dataset.begin(ReadWrite.WRITE) ;
> try {
> m = dataset.getDefaultModel() ;
> RDFDataMgr.read(m, file) ;
> dataset.commit() ;
> } finally { dataset.end() ; }
>
> and I'm querying using the text:query as follows:
> ds.begin(ReadWrite.WRITE) ;
> .....
> try{
> String qs = StrUtils.strjoinNL(
> "SELECT ?s ?info"
> " { ?s text:query (myspace:info \'"+query+"\') ;"
> , " myspace:info ?info . "
> ," }") ;
> Query q = QueryFactory.create(pre+"\n"+qs) ;
> QueryExecution qexec = QueryExecutionFactory.create(q , ds) ;
> QueryExecUtils.executeQuery(q, qexec) ;
> ...
> finally { ds.end() ; }
>
> when I pass the first query string results are returned fine, however when
> I pass another query string I'm getting the following exception:
>
> Exception in thread "AWT-EventQueue-0"
> org.apache.jena.query.text.TextIndexException:
> org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out:
> org.apache.lucene.store.SingleInstanceLock@142847f2: write.lock
> at
> org.apache.jena.query.text.TextIndexLucene.exception(TextIndexLucene.java:294)
> at
> org.apache.jena.query.text.TextIndexLucene.startIndexing(TextIndexLucene.java:115)
> at
> org.apache.jena.query.text.TextDocProducerTriples.start(TextDocProducerTriples.java:40)
> at
> org.apache.jena.query.text.DatasetGraphText.begin(DatasetGraphText.java:104)
> at com.hp.hpl.jena.sparql.core.DatasetImpl.begin(DatasetImpl.java:125)
> .....................
>
> any ideas as to why?
>
> thanks
>
>