sparql - How to traverse from a Wikipedia Parent category to all its subcategories -
i trying collect list of landmarks listed in wikipedia per country, illustration us landmarks . parent category includes subcategories , not clear how many layers 1 has go downwards actual data. there way create sparql query that? or there other way it? simple queries returns nothing
select distinct ?namedent {?namedent <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/category:category:landmarks_in_the_united_states_by_state>} limit 10
it seems relationship between sucategory , parent category represented using skos:broader
in dbpedia. if combine *
, represents 1 or more applications of predicate, query becomes:
prefix cat: <http://dbpedia.org/resource/category:> prefix dcterms: <http://purl.org/dc/terms/> prefix skos: <http://www.w3.org/2004/02/skos/core#> select distinct ?page { ?subcat skos:broader* cat:landmarks_in_the_united_states_by_state. ?page dcterms:subject ?subcat }
or can shorten using /
just:
select distinct ?page { ?page dcterms:subject/skos:broader* cat:landmarks_in_the_united_states_by_state }
sparql wikipedia dbpedia
No comments:
Post a Comment