Virtuoso Open-Source Edition

  • Topic
  • Discussion
  • VOS.VirtTipsAndTricksGuideSPARQLNOTEXISTS(Last) -- DAVWikiAdmin? , 2017-06-13 05:48:26 Edit WebDAV System Administrator 2017-06-13 05:48:26

    Virtuoso SPARQL 1.1. NOT EXISTS and MINUS

    What?

    This guide contains example queries using SPARQL 1.1 NOT EXISTS and MINUS, which you should be able to run against any SPARQL 1.1 endpoint.

    Why?

    NOT EXISTS and MINUS offer flexible ways to check for the absence of a given pattern, or to exclude possible solutions from the result set.

    How?

    Here are some examples showcasing Virtuoso's support for this functionality:

    NOT EXISTS

    SELECT COUNT(*) 
    WHERE 
      {
        ?s ?p "Novosibirsk"  
        FILTER 
          NOT EXISTS { ?s ?p "???????????" } 
      }
    

    MINUS

    SELECT COUNT(*) 
    WHERE 
      { 
        { ?s ?p "Novosibirsk" } 
        MINUS 
        { ?s ?p "???????????" }
      }
    

    Related