0

I am using the following query

PREFIX  dct:  <http://purl.org/dc/terms/> 
SELECT ?subject WHERE { 
?concept rdfs:label 'Exoskeleton'@en ; 
         ^dct:subject ?subject . 
}  
ORDER BY ?subject

This doesn't give me any results. However, the rdfs:label exists. (See http://dbpedia.org/page/Exoskeleton.)

On querying with a different label, it works :

PREFIX  dct:  <http://purl.org/dc/terms/> 
SELECT ?subject WHERE { 
?concept rdfs:label 'Machine learning'@en ; 
         ^dct:subject ?subject . 
}  
ORDER BY ?subject

The above query works and gives me the results. (See http://dbpedia.org/page/Machine_learning.)

What do I change, such that the first query works too?

TallTed
  • 9,069
  • 2
  • 22
  • 37

2 Answers2

2

The dct:subject predicate is used between a page and a category it belongs to. So, your second query is giving you results that are in Category:Machine learning. But since there is no Category:Exoskeleton, your first query gives you no results. This also means the two pages you liked to are irrelevant to your queries.

I don't know how to change the first query so that it works, because I don't understand what would "working" entail.

svick
  • 236,525
  • 50
  • 385
  • 514
  • Hi, If you go to http://dbpedia.org/page/Exoskeleton , you'll find that there are some entries under dct:subject. How do I get those to show up using a sparql query.? Could you please help me out. – Kaustabh Datta Choudhury Apr 25 '17 at 14:50
1

Devil is in the details:

PREFIX  dct:  <http://purl.org/dc/terms/> 
SELECT ?concept WHERE { 
  ?concept rdfs:label 'Machine learning'@en. 
}  
ORDER BY ?concept

Returns two results:

While Exoskeleton has no corresponding concept:

Thus your inverse property path finds resources under a http://dbpedia.org/resource/Category:Machine_learning concept but not under a http://dbpedia.org/resource/Machine_learning or http://dbpedia.org/resource/Exoskeleton pages.

If you drop the inverse modifier,

PREFIX  dct:  <http://purl.org/dc/terms/> 
SELECT ?subject WHERE { 
?concept rdfs:label 'Exoskeleton'@en ; 
         dct:subject ?subject . 
}  
ORDER BY ?subject

Will return the categories (subject) for the concepts under a given label.

svick
  • 236,525
  • 50
  • 385
  • 514
berezovskyi
  • 3,133
  • 2
  • 25
  • 30