On 05/03/12 07:39, Milorad Tosic wrote:
Hi,
DROP clause is part of UPDATE SPARQL specification and in ARQ queries it is
processed accordingly with UpdateRequest as well as other UPDATE type requests,
while SELECT type queries are processed with QueryExecution. So, in a query
processor code, that accepts arbitrary SPARQL query, one must resolve type of
the input query first and then apply appropriate class. I do the query type
resolution as follows:
Query query = QueryFactory.create(querystr);
if( query.isAskType() ){
executeAskSPARQL(querystr,out,outFormat);
}else if( query.isConstructType() ){
executeConstructSPARQL(querystr,out,outFormat);
}else if( query.isDescribeType() ){
executeDescribeSPARQL(querystr,out,outFormat);
}else if( query.isSelectType() ){
executeQuerySPARQL(querystr, out, outFormat);
}else{
// UPDATE is handled here
executeUpdateSPARQL(querystr);
}
However, DROP evaluates true on query.isSelectType() and ends up firing
exception within executeQuerySPARQL. If DROP is processed by
executeUpdateSPARQL, as it should be, everithing is fine.
Query query = QueryFactory.create(querystr);
This should throw an exception if a DROP update request is passed in
then the rest of the code does not execute.
Query query = QueryFactory.create("DROP GRAPH <http://example/g>") ;
==>
Exception in thread "main" com.hp.hpl.jena.query.QueryParseException:
Encountered " "drop" "DROP "" at line 1, column 1.
Was expecting one of:
"base" ...
"prefix" ...
"select" ...
"describe" ...
"construct" ...
"ask" ...
I would say that DROP evaluating true by query.isSelectType() is a bug?
Which version are you running?
Andy
Regards,
Milorad