Filter in a SPARQL query

I have the following SPARQL query:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX type: <http://dbpedia.org/class/yago/>      
PREFIX prop: <http://dbpedia.org/property/>
SELECT *
WHERE {
  ?person a foaf:Person;
  foaf:name ?name;
  prop:deathCause ?death_cause.
  FILTER (langMatches(lang(?name), "EN")) .
}
LIMIT 50

If you run it here: http://dbpedia.org/snorql/

You will see that you get a lot of results. Now I would like to filter out one cause of death, say, “Traffic collision”. So this should just be adding a filter:

FILTER (?death_cause = "Traffic collision").

Thus, the request should be as follows:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX type: <http://dbpedia.org/class/yago/>      
PREFIX prop: <http://dbpedia.org/property/>
SELECT *
WHERE {
  ?person a foaf:Person;
  foaf:name ?name;
  prop:deathCause ?death_cause.
  FILTER (?death_cause = "Traffic collision").
  FILTER (langMatches(lang(?name), "EN")) .
}
LIMIT 50

However, this does not return anything. Who knows what is wrong with the request? Thank.

+3
source share
1 answer

You will see that you get a lot of results. Now I would like to filter output one cause of death, let's say, “Traffic collision”. So this should be just adding a filter:

FILTER (?death_cause = "Traffic collision" ).

, , , , , , :

FILTER ( ?death_cause != "Traffic collision" )

, , "Traffic collision" "Traffic collision"@en. ( ) - (.. ). "en". , , . "Traffic collision"@en, :

FILTER ( ?death_cause != "Traffic collision"@en )

str, , "Traffic collision" ( , ):

FILTER ( str(?death_cause) != "Traffic collision" )

:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX type: <http://dbpedia.org/class/yago/>      
PREFIX prop: <http://dbpedia.org/property/>
SELECT *
WHERE {
  ?person a foaf:Person;
  foaf:name ?name;
  prop:deathCause ?death_cause.
  FILTER (langMatches(lang(?name), "EN")) .
  FILTER ( ?death_cause != "Traffic collision"@en )
}
LIMIT 50

SPARQL

+4

All Articles