簡體   English   中英

Yasgui SPARQL查詢無法找到FOAF名稱

[英]Yasgui SPARQL Query search for FOAF name doesn't work

我正在使用Jamendo Yasgui SPARQL查詢來搜索藝術家姓名。 它是這樣的:

 PREFIX mo: <http://purl.org/ontology/mo/>
 PREFIX foaf:  <http://xmlns.com/foaf/0.1/>
 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 SELECT * WHERE {?a a mo:MusicArtist ;foaf:name ?name;} 

如果要查找以下特定名稱,則該名稱無效。 為什么?

PREFIX mo: <http://purl.org/ontology/mo/>
PREFIX foaf:  <http://xmlns.com/foaf/0.1/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
SELECT * WHERE {?a a mo:MusicArtist ;foaf:name "Carton";}

如您在RDF / XML中所見,數據存在:

<foaf:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Carton</foaf:name>

由於SPARQL語法的構建看起來像Turtle語法(反之亦然),因此在構建SPARQL查詢時在Turtle中查看數據通常很有幫助。 這個RDF / XML-

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE rdf:RDF><rdf:RDF xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:ns1="http://purl.org/ontology/mo/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<ns1:MusicArtist rdf:about="http://dbtune.org/jamendo/artist/5655">
  <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
  <owl:sameAs rdf:resource="http://zitgist.com/music/artist/b8b40a3c-91c0-413b-a4f9-194ef0c7151a"/>
  <foaf:based_near rdf:resource="http://sws.geonames.org/2802361/"/>
  <foaf:homepage rdf:resource="http://cartonpate.com"/>
  <foaf:img rdf:resource="http://img.jamendo.com/artists/c/carton.jpg"/>
  <foaf:made rdf:resource="http://dbtune.org/jamendo/record/4957"/>
  <foaf:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Carton</foaf:name>
</ns1:MusicArtist>

</rdf:RDF>

-跟這只海龜說同樣的話-

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
PREFIX  owl: <http://www.w3.org/2002/07/owl#> .
PREFIX foaf: <http://xmlns.com/foaf/0.1/> .
PREFIX  xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://dbtune.org/jamendo/artist/5655>
   a               <http://purl.org/ontology/mo/MusicArtist>, 
                   rdfs:Resource ;
   owl:sameAs      <http://zitgist.com/music/artist/b8b40a3c-91c0-413b-a4f9-194ef0c7151a> ;
   foaf:based_near <http://sws.geonames.org/2802361/> ;
   foaf:homepage   <http://cartonpate.com> ;
   foaf:img        <http://img.jamendo.com/artists/c/carton.jpg> ;
   foaf:made       <http://dbtune.org/jamendo/record/4957> ;
   foaf:name       "Carton"^^xsd:string .

-因此您的SPARQL查詢必須是(模空格,每個空格都可以減少到一個空格)-

PREFIX   mo: <http://purl.org/ontology/mo/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX  rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX  xsd: <http://www.w3.org/2001/XMLSchema#> 

SELECT * WHERE { ?a a         mo:MusicArtist ;
                    foaf:name "Carton"^^xsd:string }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM