Thanks for a response !

What you are saying would mean that for rule [23] 'ORDER' 'BY' OrderCondition+ 
(http://www.w3.org/TR/sparql11-query/), SPARQL endpoint should accept "orderby" 
but for example dbpedia running on Virtuoso is not the case, so I guess that it 
is not the way the grammar is generally understood. Stardog uses Sesame's 
OpenRDF to check the queries and it does not accept "not exists".

Is there any reason why Jena generates "not exists" instead of "not exists" ?


Svatopluk Šperka

On Mar 14, 2012, at 7:56 PM, Andy Seaborne wrote:

> On 14/03/12 15:49, Svatopluk Šperka wrote:
>> Hi all,
>> 
>>      could someone give me an advice on how to correctly construct a SPARQL 
>> 1.1 query containing "FILTER NOT EXISTS" construct ?
>> 
>> What I've found in the ARQ documentation is that ElementFilter takes an Expr 
>> in the constructor but ElementNotExists is not a subclass of Expr. So far 
>> I've used E_NotExists with ElementFilter but it generates "FILTER notexists" 
>> which is not correct syntax. TDB accepts it but I'm experimenting with 
>> Stardog for performance reasons and it throws a MalformedQuery exception so 
>> I would need to generate a correct syntax.
> 
> ElementNotExists is for a ARQ/SPARQL extension not requiring the keyword 
> FILTER
> 
> SELECT *
> {
>  ?s ?p ?o
>  NOT EXISTS { ?s ?p ?o }
> }
> 
> otherwise you need to use the expression form in E_NotExists with 
> ElementFilter.
> 
> Generally, constructing SPARQL algebra is easier.  See OpToQuery to get 
> synatx out.
> 
> The SPARQL grammar rule is:
> 
> [118]  NotExistsFunc  ::=  'NOT' 'EXISTS' GroupGraphPattern
> 
> so 'notexists' is legal SPARQL (keywiords are case insensitive) as there is 
> no requirement for white space between tokens.
> 
>       Andy
> 
>> 
>> Thanks in advance.
>> 
>> 
>> Svatopluk Šperka
> 

Reply via email to