Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actually, when I run the query you provided:</p> <pre><code>select COUNT(?place) where { ?place a dbpedia-owl:Place . { ?x rdfs:label "John"@en } } </code></pre> <p>I get the result 93027312, not 81900104, but that does not really matter much. The strange results arise because <code>?x</code> and <code>?place</code> don't have to be bound to the same thing, so you are getting all the <code>dbpedia-owl:Places</code> and counting them, but the number of result rows is the number of <code>dbpedia-owl:Place</code> <em>multiplied</em> by the number of things with <code>rdfs:label "John@en"</code>:</p> <pre><code>select COUNT(?place) where { ?place a dbpedia-owl:Place } =&gt; 646023 select COUNT(?x) where { ?x rdfs:label "John"@en } =&gt; 144 646023 × 144 = 93027312 </code></pre> <p>If you actually ask for <code>dbpedia-owl:Place</code>s that have the <code>rdfs:label "John@en"</code>, you'll get no results:</p> <pre><code>select COUNT(?place) as ?numPlaces where { ?place a dbpedia-owl:Place ; rdfs:label "John"@en . } </code></pre> <p><a href="http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&amp;query=select+COUNT%28%3Fplace%29+as+%3FnumPlaces+where+%7B%0D%0A+++%3Fplace+a+dbpedia-owl%3APlace+%3B%0D%0A++++++++++rdfs%3Alabel+%22John%22%40en+.%0D%0A%7D&amp;format=text%2Fhtml&amp;timeout=0&amp;debug=on" rel="nofollow">SPARQL results</a></p> <p>Also, you might consider using <code>dbpprop:name</code> instead of <code>rdfs:label</code>. Some results seem like they are more useful that way. For instance, let us find places called <code>"Springfield"</code>. If we ask for places with that name we get no results:</p> <pre><code>select * where { ?place a dbpedia-owl:Place ; rdfs:label "Springfield"@en . } </code></pre> <p><a href="http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&amp;query=select+%2a+where+%7B%0D%0A+++%3Fplace+a+dbpedia-owl%3APlace+%3B%0D%0A++++++++++rdfs%3Alabel+%22Springfield%22%40en+.%0D%0A%7D&amp;format=text%2Fhtml&amp;timeout=0&amp;debug=on" rel="nofollow">SPARQL results</a></p> <p>However, if we modify the query and use <code>dbpprop:name</code>, we get 17. Some of these are duplicates though, so you might have to do something else to remove duplicates. The point, though, is that <code>dbpprop:name</code> got some results, and <code>rdfs:label</code> didn't. </p> <pre><code>select * where { ?place a dbpedia-owl:Place ; dbpprop:name "Springfield"@en . } </code></pre> <p><a href="http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&amp;query=select+%2a+where+%7B%0D%0A+++%3Fplace+a+dbpedia-owl%3APlace+%3B%0D%0A++++++++++dbpprop%3Aname+%22Springfield%22%40en+.%0D%0A%7D&amp;format=text%2Fhtml&amp;timeout=0&amp;debug=on" rel="nofollow">SPARQL results</a></p> <p>You can even use <code>dbpprop:name</code> in working with the names of persons, although it's not as useful, because the <code>dbpprop:name</code> value for most persons is their entire name. To find persons with the given name John using <code>dbpprop:name</code> requires a query like:</p> <pre><code>select * where { ?place a dbpedia-owl:Person ; dbpprop:name ?name . FILTER( STRSTARTS( str( ?name ), "John" ) ) } </code></pre> <p>(or you could use CONTAINS instead of STRSTARTS), but this becomes <em>much</em> more expensive, because it has to select all persons and their names, and then filter through that set. Being able to select persons based on a specific name (e.g., with <code>foaf:givenName</code>) is much more efficient.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload