SPARQL not returning correct result

戏子无情 提交于 2019-12-08 06:19:24

问题


There is an RDF file about bird here.

I'm trying to run the following sparql on it:

PREFIX dc:<http://purl.org/dc/terms/>
PREFIX wo:<http://purl.org/ontology/wo/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc:<http://purl.org/dc/terms/>
PREFIX wo:<http://purl.org/ontology/wo/>
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 po:<http://purl.org/ontology/po/>
PREFIX owl:<http://www.w3.org/2002/07/owl#>

select * where { <http://www.bbc.co.uk/nature/life/Bird#class> dc:description ?y .}

It should have returned me one results because this file contains the following:

<wo:Class rdf:about="/nature/life/Bird#class">
      <rdfs:label>Birds</rdfs:label>
      <wo:name rdf:resource="http://www.bbc.co.uk/nature/class/Bird#name" />
      <foaf:depiction rdf:resource="http://ichef.bbci.co.uk/naturelibrary/images/ic/640x360/b/bi/bird/bird_1.jpg" />
      <dc:description>
         Birds are a class of vertebrates. They are bipedal, warm-blooded, have a covering of feathers, and their front limbs are modified into wings. Some birds, such as penguins and ostriches, have lost the power of flight. All birds lay eggs. Because birds are warm-blooded, their eggs have to be incubated to keep the embryos inside warm, or they will perish.
         <br />
         <br />
         <a href="/nature/19700707">All you need to know about British birds.</a>
      </dc:description>
      <owl:sameAs rdf:resource="http://dbpedia.org/resource/Bird" />
      <wo:phylum rdf:resource="/nature/life/Chordate#phylum" />
      <wo:kingdom rdf:resource="/nature/life/Animal#kingdom" />
   </wo:Class>

However, it is not returning any results. I'm using twinkle sparql client. I'm trying the same sparql for another rdf file for Mammal located here with the following sparql:

select * where { <http://www.bbc.co.uk/nature/life/Mammal#class> dc:description ?y .}

and the same prefixes as above. For this one, I'm getting results.

So the problem lies in the rdf file of the bird. I'm not being able to find the problem. Can anyone help?


回答1:


The data file Bird.rdf causes validator errors:

See http://www.w3.org/RDF/Validator/

with this operation

http://www.w3.org/RDF/Validator/rdfval?URI=http%3A%2F%2Fwww.bbc.co.uk%2Fnature%2Flife%2FBird.rdf&PARSE=Parse+URI%3A+&TRIPLES_AND_GRAPH=PRINT_TRIPLES&FORMAT=PNG_EMBED

May be this is causing the non-match in SPARQL. The dc:description is invalid.



来源:https://stackoverflow.com/questions/20885229/sparql-not-returning-correct-result

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!