[英]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.