Hello Ivan, just FYI. I tried the same initial query in Sesame and I think works just fine.
Moreover, according to sparql 1.1 documentation [1]: "The SPARQL query language incorporates two styles of negation, one based on filtering results depending on whether a graph pattern does or does not match in the context of the query solution being filtered. Filtering of query solutions is done within a FILTER expression using NOT EXISTS and EXISTS." So what I understand is that the filtering is applied after the query solution's results (please correct if I am wrong). I think that If there are no results then no filtering will be applied. Of course the workaround query with the ?s ?p ?o pattern I assume will work. However, how will it be evaluated? Will it make the filtering after all triples are given as result? If yes IMO this is worse as solution. Given my query, I was hoping for a large selectivity (i.e., a smaller result) before the filter be applied. [1] http://www.w3.org/TR/sparql11-query/#negation On 14 July 2012 23:45, Ivan Mikhailov <[email protected]> wrote: > Hello Alex, > > On Fri, 2012-06-29 at 13:52 +0300, Alex wrote: > > > > select ?o from > > <http://www.heppnetz.de/ontologies/goodrelations/v1.owl> where{filter > > not exists{?o comment1212 ?x}} > > > > > > And I get a syntax error: Virtuoso 37000 Error SP030: SPARQL compiler, > > line 2: syntax error at 'comment1212' before '?x'. Not an internal > > error. > > Indeed it's a syntax error to use "comment1212", i.e. neither > angle-bracketed URI like "<comment1212>" nor QName like > "prefix:comment1212" or ":comment1212" with proper prefix declaration. > > Even if it's fixed, the query will return nothing because filtering can > only shorten the set of bindings and the set is initially empty because > there's no triple pattern that could produce a binding. Probably you > need something like > select distinct ?o ... where { ?s ?p ?o . filter not exists { ?o ... } } > > Best Regards, > > Ivan Mikhailov > OpenLink Software > http://virtuoso.openlinksw.com > > > >
