7

おそらく完全に解決しやすいこの問題について、誰かが私を助けてくれることを願っています:

次の RDF に対して SPARQL クエリを実行したいと考えています (N3 に記載されています。RDF/XMl はここにあります)。これは、ジャーナル記事の説明と、ジャーナル、著者、および発行者の説明です。

 @prefix bibo: <http://purl.org/ontology/bibo/> .
 @prefix dc: <http://purl.org/dc/elements/1.1/> .
 @prefix ex: <http://example.org/thesis/> .
 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<ex:XY>     a bibo:Article;
     dc:creator ex:umstaetter;
     dc:date "2008-11-01";
     dc:isPartOf ex:bibdienst;
     dc:title "DDC in Europa"@de;
     bibo:endPage "1221";
     bibo:issue "11";
     bibo:language "de";
     bibo:pageStart "1194";
     bibo:uri <http://www.zlb.de/Erschliessung020309BD.pdf>;
     bibo:volume "42" .

<ex:bibdienst>     a bibo:Journal;
     dc:publisher ex:zlb;
     dc:title "Bibliotheksdienst"@de;
     bibo:issn "00061972" .

<ex:umstaetter>     a foaf:person;
     foaf:birthday "1941-06-12";
     foaf:gender "Male";
     foaf:givenName "Walther";
     foaf:homepage <http://www.ib.hu-berlin.de/~wumsta/index.html>;
     foaf:img "http://libreas.eu/ausgabe7/pictures/wumstaetter1.jpg";
     foaf:name "Walther Umst\u00E4tter";
     foaf:surname "Umst\u00E4tter";
     foaf:title "Prof. Dr. rer. nat." .

<ex:zlb>     a foaf:Organization;
     foaf:homepage <http://www.zlb.de>;
     foaf:name "Zentral- und Landesbibliothek Berlin"@de .

テスト目的で、ex:zlb の foaf:homepage を読みたかった-実行たい SPARQL は次のとおりです。

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX ex: <http://example.org/thesis/>

SELECT ?article ?publisher ?publisher_url
WHERE 
{
    ?article dc:isPartOf ?journal .
    ?journal dc:publisher ?publisher .
    ?publisher foaf:homepage ?publisher_url
}

(繰り返しますが、記事のエンティティは 1 つしかないため、これはテストのみを目的としています。)

Python と RDflib を使用してローカル マシンで実行しても、結果が得られません。Online Redland SPARQL Query Demo もそうではありません。

解決策を見ている人はいますか?私は正しい道を進んでいますか、それとも完全に間違っていますか?

4

2 に答える 2

7

I don't think that you can use a QName in an XML attribute value; e.g. the value of rdf:about. So consider this line from your RDF/XML file:

 <bibo:Journal rdf:about="ex:bibdienst">

I think that this is actually saying that the subject URI is "ex:bibdienst". That is a syntactically valid URI, but it is not the same URI as appears as the object of the triple corresponding to this line:

 <dc:isPartOf rdf:resource="http://example.org/thesis/bibdienst" />

Try replacing the QNames in XML attribute values with the corresponding URIs and see if that fixes your problem.

于 2009-10-20T14:22:28.360 に答える
6

はい、スティーブン C は、XML 属性で QNames を使用できないことは完全に正しいです。代わりに、ドキュメントの上部にある DTD ブロックで次のように定義する XML エンティティを使用できます。

例えば。

<!DOCTYPE rdf:RDF[
    <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
    <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
    <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'>
    <!ENTITY ex 'http://example.org/thesis/'>
    <!ENTITY dc 'http://purl.org/dc/elements/1.1/'>
    <!ENTITY foaf 'http://xmlns.com/foaf/0.1/'>
    <!ENTITY bibo 'http://purl.org/ontology/bibo/'>
]>

次に、次のように属性を定義できます。

<bibo:Journal rdf:about="&ex;bibdienst">
于 2009-10-20T14:55:57.730 に答える