0

I need to get related topics for a wikipedia page say upto 5 levels. For a page Mathematics, I get this using:

select ?value where { <http://dbpedia.org/resource/Category:Mathematics> skos:broader{0,4} ?value }

This does not work for Science(http://dbpedia.org/page/Category:Science) since the broader at each level points back to Science_and_technology,Main_topic_classifications etc. This is happenning since Science is high up in the ontology unlike Category:Mathematics. So I try to use the property is skos:broader of. Is this a valid property? How do I handle the spaces here? Using skos:broader alone does not give intended result.

  • 2
    "is PROPERTY of" -> inverse relation, i.e. the entity `e` is the object in an RDF triple, e.g. `(a, PROPERTY, e)`. That means you have to invert the triple pattern. Or you simply use the inverse relation which is unsurprisingly `skos:narrower` and hope that the inverse triples exist. I'd go for the first solution: `select ?value where { ^skos:broader{0,4} ?value }` – UninformedUser May 10 '18 at 03:33
  • Thanks for the reply. Inverse relation should do it. So now this would be traversing the tree upward. Would using `dct:subject` instead get the succeeding nodes? – Adarsa Sivaprasad May 10 '18 at 05:57
  • "succeeding nodes" - not sure what you mean by that but it get's all entities that belong to the category: `select ?value where { ?value dct:subject/^skos:broader{0,4} }` – UninformedUser May 10 '18 at 06:34
  • 1
    I wrote about this in [this answer](https://stackoverflow.com/a/28768818/1281433). – Joshua Taylor May 10 '18 at 17:15
  • Thanks @AKSW. It works with ^skos:broader{0,4}. – Adarsa Sivaprasad May 11 '18 at 08:53
  • @Joshua unlike the question you answered, my intention is to get the hierarchy in the same direction. Since the results are all at high level, I wanted to know how to query the opposite direction. So now my logic changes to 'go one level up(is skos:broader of) and then find all the categories with skos:broader of relation with it'. I am trying to build a dictionary of topics in subject Science. – Adarsa Sivaprasad May 11 '18 at 08:54

0 Answers0