Hello Christian,

There's no NOT EXISTS in current version but you may use, say,

FILTER (!bif:exists ((select (1) ...)))

Example from an RDF clone of Q-16 from TPC-D benchmark:

sparql
prefix tpcd: <http://www.openlinksw.com/schemas/tpcd#>
prefix oplsioc: <http://www.openlinksw.com/schemas/oplsioc#>
prefix sioc: <http://rdfs.org/sioc/ns#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
select
  ?part+>tpcd:brand,
  ?part+>tpcd:type,
  ?part+>tpcd:size,
  (count(distinct ?supp)) as ?supplier_cnt
from <http://example.com/tpcd>
where
  {
    ?ps a tpcd:partsupp ; tpcd:has_part ?part ;
tpcd:has_supplier ?supp .
    filter (
      (?part+>tpcd:brand != "Brand#45") &&
      !(?part+>tpcd:type like "MEDIUM POLISHED%") &&
      (?part+>tpcd:size in (49, 14, 23, 45, 19, 3, 36, 9)) &&
      !bif:exists ((select (1) where {
        ?supp a tpcd:supplier; tpcd:comment ?badcomment . filter
(?badcomment like "%Customer%Complaints%") } ) ) )
  }
order by
  desc ((count(distinct ?supp)))
  ?part+>tpcd:brand
  ?part+>tpcd:type
  ?part+>tpcd:size

The SPARQL 1.1 WD syntax will be supported in the next versions of both
Virtuoso Open Source and Virtuoso Universal Server.

Best Regards,

Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com

On Sun, 2010-03-21 at 14:29 +0100, Christian Fuerber wrote:
> Hi,
> 
> while using vos6, I discovered that the virtuoso SPARQL endpoints do not
> support the NOT EXISTS keyword
> (http://www.w3.org/TR/2009/WD-sparql11-query-20091022/#negation) at present.
> 
> Is there any virtuoso specific function that acts like it?
> 
> Thanks,
> 
> Christian Fürber



Reply via email to