Search code examples
sparqlrdf

Excluding triples based on substring


I have a graph created by sponging web pages. I'm trying to write a query to exclude all triples where the subject is a web page. I can get these triples simply by

FILTER (STRENDS((STR(?i)), "html"))

but what's the best way to exclude them. Basically I need all {?s ?p ?o} minus the subset {?i ?p ?o}.


Solution

  • This

    SELECT *
    { ?s ?p ?o 
      FILTER ( ! STRENDS( STR(?s), "html") )
    }
    

    filters the outcome the pattern.