2015-06-17 66 views
0

提取GND RDF/XML数据中所有“DifferentiatedPerson”的姓,名,dateOfBirth和placeOfBirth的正确SPARQL查询是什么? (数据主页:http://www.dnb.de/DE/Service/DigitaleDienste/Datendienst/datendienst_node.html)数据的用于GND-RDF的Sparql查询

例摘录:

<?xml version="1.0" encoding="UTF-8"?> 
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:geo="http://www.opengis.net/ont/geosparql#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:sf="http://www.opengis.net/ont/sf#" xmlns:isbd="http://iflastandards.info/ns/isbd/elements/" xmlns:gndo="http://d-nb.info/standards/elementset/gnd#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:marcRole="http://id.loc.gov/vocabulary/relators/" xmlns:lib="http://purl.org/library/" xmlns:umbel="http://umbel.org/umbel#" xmlns:rdau="http://rdaregistry.info/Elements/u/" xmlns:bibo="http://purl.org/ontology/bibo/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2004/02/skos/core#"> 
... 
    <rdf:Description rdf:about="http://d-nb.info/gnd/1070954047"> 
      <rdf:type rdf:resource="http://d-nb.info/standards/elementset/gnd#DifferentiatedPerson" /> 
      <gndo:gndIdentifier>1070954047</gndo:gndIdentifier> 
      <gndo:preferredNameForThePerson>Kunz, Hans Jürgen</gndo:preferredNameForThePerson> 
      <gndo:preferredNameEntityForThePerson rdf:parseType="Resource"> 
        <gndo:forename>Hans Jürgen</gndo:forename> 
        <gndo:surname>Kunz</gndo:surname> 
      </gndo:preferredNameEntityForThePerson> 
      <gndo:affiliation rdf:resource="http://d-nb.info/gnd/2010684-1" /> 
      <gndo:affiliation rdf:resource="http://d-nb.info/gnd/2063435-3" /> 
      <gndo:professionOrOccupation rdf:resource="http://d-nb.info/gnd/4141636-3" /> 
      <gndo:professionOrOccupationAsLiteral>Zootechniker</gndo:professionOrOccupationAsLiteral> 
      <gndo:geographicAreaCode rdf:resource="http://d-nb.info/standards/vocab/gnd/geographic-area-code#XA-DE" /> 
      <gndo:publication>Abgangsursachen bei Ferkeln und Sauen. - 1986 (Diss., Kiel)</gndo:publication> 
      <gndo:placeOfBirth rdf:resource="http://d-nb.info/gnd/4050610-1" /> 
      <gndo:gender rdf:resource="http://d-nb.info/standards/vocab/gnd/Gender#male" /> 
      <gndo:dateOfBirth rdf:datatype="http://www.w3.org/2001/XMLSchema#gYear">1953</gndo:dateOfBirth> 
    </rdf:Description> 

我尝试以下SPARQL(数据存储在阿帕奇耶拿TDB):

PREFIX gndo: <http://d-nb.info/standards/elementset/gnd#> 
SELECT ?forename ?surname ?dateOfBirth ?placeOfBirth 
WHERE { 
    ?person a gndo:DifferentiatedPerson . 
    ?person gndo:forename ?forename . 
    ?person gndo:surname ?surname . 
    ?person gndo:dateOfBirth ?dateOfBirth . 
    ?person gndo:placeOfBirth ?placeOfBirth 
} 

返回任何结果。 (因为这是我第一次SPARQL查询这可能是完全错误的......)

+0

要调试SPARQL查询,请删除零件,直到出现问题。 “PREFIX ... SELECT * {?个人的一个gndo:DifferentiatedPerson} LIMIT 10”工作吗?如果是,请添加下一个三重模式。等等 – AndyS

回答

1

的名字及surename连接到通过属性GNDO人数:preferredNameEntityForThePerson和blanknode,即查询应该是这样的

PREFIX gndo: <http://d-nb.info/standards/elementset/gnd#> 
SELECT ?forename ?surname ?dateOfBirth ?placeOfBirth 
WHERE { 
    ?person a gndo:DifferentiatedPerson ; 
      gndo:dateOfBirth ?dateOfBirth ; 
      gndo:placeOfBirth ?placeOfBirth ; 
      gndo:preferredNameEntityForThePerson [ 
               gndo:forename ?forename ; 
               gndo:surname ?surname 
               ] 
}