SPARQL查询的计数结果的差异

时间:2016-01-16 09:23:07

标签: sparql dbpedia

我有这个问题:

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
prefix foaf: <http://xmlns.com/foaf/0.1/> 
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
select  ?Nom ?resource ?url (count( distinct (?o) as ?nb))
 where {
   ?resource rdfs:label ?Nom.
   ?resource foaf:isPrimaryTopicOf ?url.
   ?resource rdf:type ?p.
   ?resource dbpedia-owl:wikiPageExternalLink  ?o
FILTER ( langMatches( lang(?Nom), "EN" )).
?Nom <bif:contains> "Apple".
MINUS { ?resource dbo:wikiPageRedirects|dbo:wikiPageDisambiguates ?dis   }
      }Group By  ?Nom ?resource ?url 

现在,如果我更换行

    select  ?Nom ?resource ?url (count( distinct (?o) as ?nb))

由:

    select  ?Nom ?resource ?url (count( (?o) as ?nb))

它给了我不同的结果: 例如第一个例子:

| "Simon Apple"@en            | <http://dbpedia.org/resource/Simon_Apple>           | <http://en.wikipedia.org/wiki/Simon_Apple>           | 4   |
| "Golden Orange (apple)"@en  | <http://dbpedia.org/resource/Golden_Orange_(apple)> | <http://en.wikipedia.org/wiki/Golden_Orange_(apple)> | 1   |
| "Apple Watch"@en            | <http://dbpedia.org/resource/Apple_Watch>           | <http://en.wikipedia.org/wiki/Apple_Watch>           | 1   |

第二个例子给我:

和第二个结果:

| "Simon Apple"@en            | <http://dbpedia.org/resource/Simon_Apple>           | <http://en.wikipedia.org/wiki/Simon_Apple>           | 80   |
| "Golden Orange (apple)"@en  | <http://dbpedia.org/resource/Golden_Orange_(apple)> | <http://en.wikipedia.org/wiki/Golden_Orange_(apple)> | 14   |
| "Apple Watch"@en            | <http://dbpedia.org/resource/Apple_Watch>           | <http://en.wikipedia.org/wiki/Apple_Watch>           | 4   |

有什么区别? 提前致谢

0 个答案:

没有答案