Search code examples
rdfsparqlsemantic-webdbpedia

Retrieve subjects with no value for a property?


I'm getting a list of names from the German DBpedia SPARQL endpoint belonging to "Haus Liechtenstein" with this query:

select ?name where {
  ?name dcterms:subject category-de:Haus_Liechtenstein
}

I want only the people from this list who are still living. There is a property dbo:deathDate used for deceased people. How can I restrict my results to individuals without a value for dbo:deathDate?


Solution

  • How can I filter this list for people WITHOUT the Property "dbo:deathDate"?

    You use filter to keep only those where there does not exist a triple of the form ?name dbpedia-owl:deathDate ?something:

    select ?name where {
      ?name dcterms:subject category-de:Haus_Liechtenstein
      filter not exists { 
        ?name dbpedia-owl:deathDate ?deathDate
      }
    }
    

    SPARQL results