Filtering results of SPARQL queries -
i want retrieve 20th century italian novelists' name. i've written this:
select ?label where{ ?novelist yago:italiannovelists. ?novelist rdfs:label ?label. filter (langmatches(lang(?label), "en")) } order ?label
how can filter results?
there several options. here i'd suggest two:
use pattern
?novelist dct:subject dbc:20th-century_novelists
, if can rely on classification.select ?label where{ ?novelist yago:italiannovelists; rdfs:label ?label; dct:subject dbc:20th-century_novelists. filter (langmatches(lang(?label), "en")) }
order ?labeldefine birth range or life-span range. example birth range:
select ?label where{ ?novelist yago:italiannovelists; rdfs:label ?label; dbo:birthdate ?date.
bind (year(?date) ?year) filter (langmatches(lang(?label), "en")) filter (?year > 1882 && ?year < 1972) } order ?label
with option 2 more results depending on range, might include novelists haven't published in 20th century.
a third option filter year of publishing. however, wouldn't recommend it. first, give results whom such information available in dbpedia, , subset smaller 1 first option. second, depending on how define 20 century novelist, query results omit wrote novel in 20 century, published in 21.
Comments
Post a Comment