On 05/03/12 13:07, Milorad Tosic wrote:
I provided a code snippet.
Except it does not do as you describe!
When I run
Query query = QueryFactory.create("DROP ALL") ;
I get an exception as expected: Jena 2.7.0 and Jena 2.6.5.
Sure, I would provide the example as you suggested but I am not exactly sure
that I understand what it should look like. Here is my best try:
/**
* This section throws exception
**/
complete => code so that I don't have to guess how to complete it.
Every guess is risk the root issue is being overlooked.
"Complete" mean I can cut and paste it into my development environment.
(Also, I'd rather spend my time on the report, not fixing code - the
longer it will take, the longer it has to wait before I can find time to
do it)
minimal => no large than necessary to illusrate the point.
String querystr = "DROP ALL";
Query query = QueryFactory.create(querystr);
As above. I get an exception and it never gets to the next line.
if( query.isSelectType() ){ // evaluated TRUE
m_triplestore.enterCriticalSection(Lock.READ) ;
try {
QueryExecution qexec = QueryExecutionFactory.create(query,
m_triplestore) ;
ResultSet results = qexec.execSelect() ;
print(outFormat, out, results);
qexec.close();
} finally {
m_triplestore.leaveCriticalSection();
}
}
/**
* This section works fine
**/
String querystr = "DROP ALL";
Query query = QueryFactory.create(querystr);
m_triplestore.enterCriticalSection(Lock.WRITE);
try {
UpdateRequest updateRequest = UpdateFactory.create(querystr);
UpdateAction.execute(updateRequest, m_triplestore);
}catch (Exception e){
log.debug(e);
} finally {
m_triplestore.commit();
TDB.sync(m_triplestore);
m_triplestore.leaveCriticalSection();
}
So, the problem is that the query "DROP ALL" is evaluated as a SELECT query by
query.isSelectType() method instead of being evaluated as an update query.
Milorad
ps. We use jena 2.6.4/arq 2.8.7/tdb 0.8.10 and we still didn't hit the limits
in our development, so far so good (we are limited to Java 5). Migrating to new
versions of Jena would usually require some efforts investment, so we will
probably stick with the current version for some time. Does Jena 7 require Java
6 or not?
Jena 2.70 requires Java 6 - we don't support Java 5 anymore. Generally,
we aim for two major versions, currently java 6 and 7. Java 5 is past
it's end-of-life, depending on the system and support you have
Andy