0

I am trying to run the following sparql query :

PREFIX  dct:  <http://purl.org/dc/terms/> 
select distinct ?subject 
where 
{ 
  ?concept rdfs:label 'Artificial intelligence'@en . 
  ?concept ^dct:subject ?subject . 
}
LIMIT 100

When I run this on dbpedia's public server, I get the following results : http://dbpedia.org/sparql?default-graph-uri=&query=PREFIX++dct%3A++%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E+select+distinct+%3Fsubject+where+%7B+%3Fconcept+rdfs%3Alabel+%27Artificial+intelligence%27%40en+.+%3Fconcept+%5Edct%3Asubject+%3Fsubject+.+%7D++LIMIT+100&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on

However, running the same query on a locally hosted instance of dbpedia, yields : http://34.195.108.80:8891/sparql?default-graph-uri=&query=PREFIX++dct%3A++%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E+select+distinct+%3Fsubject+where+%7B+%3Fconcept+rdfs%3Alabel+%27Artificial+intelligence%27%40en+.+%3Fconcept+%5Edct%3Asubject+%3Fsubject+.+%7D++LIMIT+100&format=text%2Fhtml&CXML_redir_for_subjs=121&CXML_redir_for_hrefs=&timeout=30000&debug=on

Why is there a discrepancy in the answers to the point where it's entirely different?

RobV
  • 28,022
  • 11
  • 77
  • 119

1 Answers1

2

I don't know what do you mean by "different", but without ORDER BY results will be returned more or less randomly simply influenced by the underlying system. There is even no guarantee that running the same query twice on the same server will return the results in the same order. Your query returns only 100 due to the LIMIT 100

The total number of results is the same for both queries, 271:

PREFIX  dct:  <http://purl.org/dc/terms/> 
SELECT count(distinct ?subject) WHERE { 
  ?concept rdfs:label 'Artificial intelligence'@en ; 
  ?        ^dct:subject ?subject . 
}  

For comparison, you have to use ORDER BY:

PREFIX  dct:  <http://purl.org/dc/terms/> 
SELECT ?subject WHERE { 
?concept rdfs:label 'Artificial intelligence'@en ; 
         ^dct:subject ?subject . 
}  
ORDER BY ?subject
UninformedUser
  • 8,397
  • 1
  • 14
  • 23
  • Hi, If you look at the results, the results on http://dbpedia.org/sparql has an entry called Darkforest. However, the results on http://34.195.108.80:8891/sparql doesn't have that. Hence the results aren't the same. – Kaustabh Datta Choudhury Apr 25 '17 at 05:50
  • Ehm, have you read my answer?! I said you're using `LMIT 100` which returns only 100 **random** results that match the query. The total number is 271 as you can check with my first query. What does it mean? Use a `LIMIT n` with `n >= 271` or omit the LIMIT at all. – UninformedUser Apr 25 '17 at 05:54
  • Thank you very much.! :) – Kaustabh Datta Choudhury Apr 25 '17 at 15:22