3

我有这样的RDF数据:(更新,完整文件)

我得到这个RDF的来源是:http ://reach.suny.edu/display/Hajagos_Janos 当你在头像下的“回形针”按钮时,你可以下载这个文件。SPARQL 端点是: http: //link.informatics.stonybrook.edu/sparql/

    <rdf:RDF
    xmlns:geo="http://aims.fao.org/aos/geopolitical.owl#"
    xmlns:c4o="http://purl.org/spar/c4o/"
    xmlns:vitro-public="http://vitro.mannlib.cornell.edu/ns/vitro/public#"
    xmlns:skos="http://www.w3.org/2004/02/skos/core#"
    xmlns:ero="http://purl.obolibrary.org/obo/"
    xmlns:event="http://purl.org/NET/c4dm/event.owl#"
    xmlns:pvs="http://vivoweb.org/ontology/provenance-support#"
    xmlns:dcelem="http://purl.org/dc/elements/1.1/"
    xmlns:j.0="http://reach.suny.edu/ns#"
    xmlns:vivo="http://vivoweb.org/ontology/core#"
    xmlns:vitro="http://vitro.mannlib.cornell.edu/ns/vitro/0.7#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:bibo="http://purl.org/ontology/bibo/"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:reach="http://reach.suny.edu/ontology/core#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:scires="http://vivoweb.org/ontology/scientific-research#"
    xmlns:fabio="http://purl.org/spar/fabio/"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > 
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n2406">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#DateTimeInterval"/>
    <vivo:start rdf:resource="http://reach.suny.edu/individual/n10121"/>
    <vivo:end rdf:resource="http://reach.suny.edu/individual/n3729"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n6042">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#Role"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#PresenterRole"/>
    <vivo:roleRealizedIn rdf:resource="http://reach.suny.edu/individual/n3694"/>
    <vivo:dateTimeInterval rdf:resource="http://reach.suny.edu/individual/n2406"/>
    <vivo:presenterRoleOf rdf:resource="http://reach.suny.edu/individual/Hajagos_Janos"/>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Speaker</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n3694">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">VIVO Mini-Grant: Integrating the UMLS Ontology into VIVO for Linking Biomedical Scientists</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n4507">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#Position"/>
    <vivo:positionForPerson rdf:resource="http://reach.suny.edu/individual/Hajagos_Janos"/>
    <vivo:positionInOrganization rdf:resource="http://reach.suny.edu/individual/n4644"/>
    <vivo:rank rdf:datatype="http://www.w3.org/2001/XMLSchema#int">1</vivo:rank>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Clinical Assistant Professor</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n5408">
    <rdfs:label>Semantic Web</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://link.informatics.stonybrook.edu/umls/CUI/C0025088">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Medical Informatics</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://vivoweb.org/ontology/core#yearPrecision">
    <rdfs:label xml:lang="en-US">yearPrecision</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n4542">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Medical Informatics</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/a21575203">
    <rdfs:label>Linked open drug data for pharmaceutical research and development.</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://link.informatics.stonybrook.edu/umls/CUI/C0010992">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Data Analysis</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://link.informatics.stonybrook.edu/umls/CUI/C0085567">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">UMLS</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n10121">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#DateTimeValue"/>
    <vivo:dateTimePrecision rdf:resource="http://vivoweb.org/ontology/core#yearPrecision"/>
    <vivo:dateTime rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-01-01T00:00:00</vivo:dateTime>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n4418">
    <rdfs:label xml:lang="en-US">Semantic Web Architecture Group</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://link.informatics.stonybrook.edu/umls/CUI/C0025071">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Medicaid</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://link.informatics.stonybrook.edu/umls/CUI/C1882937">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">RDF</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/gHajagos_Janos_21575203">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#Relationship"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#Authorship"/>
    <vivo:linkedAuthor rdf:resource="http://reach.suny.edu/individual/Hajagos_Janos"/>
    <vivo:linkedInformationResource rdf:resource="http://reach.suny.edu/individual/a21575203"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n6907">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#Position"/>
    <vivo:positionForPerson rdf:resource="http://reach.suny.edu/individual/Hajagos_Janos"/>
    <vivo:positionInOrganization rdf:resource="http://reach.suny.edu/individual/n4542"/>
    <vivo:rank rdf:datatype="http://www.w3.org/2001/XMLSchema#int">2</vivo:rank>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Senior Programmer/Data Analyst</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n2444">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#Role"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#MemberRole"/>
    <vivo:memberRoleOf rdf:resource="http://reach.suny.edu/individual/Hajagos_Janos"/>
    <vivo:roleContributesTo rdf:resource="http://reach.suny.edu/individual/n4418"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n3729">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <rdf:type rdf:resource="http://vivoweb.org/ontology/core#DateTimeValue"/>
    <vivo:dateTimePrecision rdf:resource="http://vivoweb.org/ontology/core#yearPrecision"/>
    <vivo:dateTime rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-01-01T00:00:00</vivo:dateTime>
  </rdf:Description>
  <rdf:Description rdf:about="http://link.informatics.stonybrook.edu/umls/CUI/C0034379">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Health care quality</rdfs:label>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/Hajagos_Janos">
    <foaf:lastName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Hajagos</foaf:lastName>
    <vivo:personInPosition rdf:resource="http://reach.suny.edu/individual/n4507"/>
    <vivo:educationalTraining rdf:resource="http://reach.suny.edu/individual/n20726"/>
    <vivo:authorInAuthorship rdf:resource="http://reach.suny.edu/individual/gHajagos_Janos_21575203"/>
    <vivo:hasResearchArea rdf:resource="http://link.informatics.stonybrook.edu/umls/CUI/C0010992"/>
    <vivo:hasResearchArea rdf:resource="http://link.informatics.stonybrook.edu/umls/CUI/C1882937"/>
    <vivo:personInPosition rdf:resource="http://reach.suny.edu/individual/n6907"/>
    <vivo:faxNumber>631-444-8873</vivo:faxNumber>
    <j.0:networkId>jhajagos</j.0:networkId>
    <vivo:hasMemberRole rdf:resource="http://reach.suny.edu/individual/n2444"/>
    <vivo:hasPresenterRole rdf:resource="http://reach.suny.edu/individual/n6042"/>
    <vivo:middleName>G</vivo:middleName>
    <vitro-public:mainImage rdf:resource="http://reach.suny.edu/individual/n1206"/>
    <vivo:email>risk.limits@gmail.com</vivo:email>
    <vivo:hasResearchArea rdf:resource="http://link.informatics.stonybrook.edu/umls/CUI/C0025071"/>
    <rdf:type rdf:resource="http://reach.suny.edu/ontology/core#SUNY_REACH_Investigator"/>
    <vivo:hasResearchArea rdf:resource="http://link.informatics.stonybrook.edu/umls/CUI/C0085567"/>
    <rdfs:label xml:lang="en-US">Hajagos, Janos</rdfs:label>
    <foaf:firstName rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Janos</foaf:firstName>
    <vivo:phoneNumber>631-444-1596</vivo:phoneNumber>
    <vivo:hasResearchArea rdf:resource="http://link.informatics.stonybrook.edu/umls/CUI/C0034379"/>
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
    <vivo:hasResearchArea rdf:resource="http://reach.suny.edu/individual/n5408"/>
    <rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Agent"/>
    <vivo:preferredTitle>Senior Programmer/Analyst&lt;br /&gt;</vivo:preferredTitle>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
    <vivo:primaryEmail>janos.hajagos@stonybrook.edu</vivo:primaryEmail>
    <bibo:suffixName>Ph.D.</bibo:suffixName>
    <vivo:hasResearchArea rdf:resource="http://link.informatics.stonybrook.edu/umls/CUI/C0025088"/>
  </rdf:Description>
  <rdf:Description rdf:about="http://reach.suny.edu/individual/n4644">
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">BS/HS Program</rdfs:label>
  </rdf:Description>
</rdf:RDF>

我想查找姓氏为 的人的出版物"Hajagos"。从数据中,我们可以看到它在<rdfs:label> "Linked open drug data for pharmaceutical research and development". 但也有很多相同下的值<rdfs:label>。我怎么能查询到这个。我尝试了以下 SPARQL,但没有任何用处:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX vivo: <http://vivoweb.org/ontology/core#>

SELECT ?publication
WHERE {
  ?person foaf:lastName "Hajagos" .
  ?person rdfs:label ?publication
}

通过这个查询我只能得到en-US,这也是属性的一个值<rdfs:label>

4

1 回答 1

5

如果您获取数据并将其转换为更易于阅读的格式(例如 Turtle),则可以更轻松地查看数据中的联系。具体来说,经过转换后,我们得到了我们关注的作者的如下描述:

<http://reach.suny.edu/individual/Hajagos_Janos>
        a                         reach:SUNY_REACH_Investigator , foaf:Person , foaf:Agent , owl:Thing ;
        rdfs:label                "Hajagos, Janos"@en-US ;
        bibo:suffixName           "Ph.D." ;
        j.0:networkId             "jhajagos" ;
        vitro-public:mainImage    <http://reach.suny.edu/individual/n1206> ;
        vivo:authorInAuthorship   <http://reach.suny.edu/individual/gHajagos_Janos_21575203> ;
        vivo:educationalTraining  <http://reach.suny.edu/individual/n20726> ;
        vivo:email                "risk.limits@gmail.com" ;
        vivo:faxNumber            "631-444-8873" ;
        vivo:hasMemberRole        <http://reach.suny.edu/individual/n2444> ;
        vivo:hasPresenterRole     <http://reach.suny.edu/individual/n6042> ;
        vivo:hasResearchArea      <http://link.informatics.stonybrook.edu/umls/CUI/C0010992> , <http://link.informatics.stonybrook.edu/umls/CUI/C1882937> , <http://link.informatics.stonybrook.edu/umls/CUI/C0025071> , <http://link.informatics.stonybrook.edu/umls/CUI/C0085567> , <http://link.informatics.stonybrook.edu/umls/CUI/C0034379> , <http://reach.suny.edu/individual/n5408> , <http://link.informatics.stonybrook.edu/umls/CUI/C0025088> ;
        vivo:middleName           "G" ;
        vivo:personInPosition     <http://reach.suny.edu/individual/n4507> , <http://reach.suny.edu/individual/n6907> ;
        vivo:phoneNumber          "631-444-1596" ;
        vivo:preferredTitle       "Senior Programmer/Analyst<br />" ;
        vivo:primaryEmail         "janos.hajagos@stonybrook.edu" ;
        foaf:firstName            "Janos"^^<http://www.w3.org/2001/XMLSchema#string> ;
        foaf:lastName             "Hajagos"^^<http://www.w3.org/2001/XMLSchema#string> .

与作者身份相关的内容并不多,但有谓词和宾语:

vivo:authorInAuthorship   <http://reach.suny.edu/individual/gHajagos_Janos_21575203> ;

如果我们跟随那个对象,我们会看到:

<http://reach.suny.edu/individual/gHajagos_Janos_21575203>
        a                               owl:Thing , vivo:Relationship , vivo:Authorship ;
        vivo:linkedAuthor               <http://reach.suny.edu/individual/Hajagos_Janos> ;
        vivo:linkedInformationResource  <http://reach.suny.edu/individual/a21575203> .

它可能是<http://reach.suny.edu/individual/a21575203>我们感兴趣的链接信息资源。没有很多信息,但有

<http://reach.suny.edu/individual/a21575203>
        rdfs:label  "Linked open drug data for pharmaceutical research and development." .

基于这种结构,我们可以编写一个查询来查找vivo:Authorships 和它们vivo:linkedAuthor的 s,以及rdfs:label任何vivo:linkedInformationResources 的 s。要专门查询"Hajagos",您可以使用:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX vivo: <http://vivoweb.org/ontology/core#>

SELECT ?label
WHERE {
  ?authorship vivo:linkedAuthor ?author ;
              vivo:linkedInformationResource ?resource .
  ?author foaf:lastName "Hajagos" .
  ?resource rdfs:label ?label .
}

要获得更一般的结果(并稍微清理一下查询),您可以使用:

prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix vivo: <http://vivoweb.org/ontology/core#>

select ?lastName ?label where {
  ?authorship vivo:linkedAuthor [ foaf:lastName ?lastName ] ;
              vivo:linkedInformationResource [ rdfs:label ?label ] .
}

SPARQL 结果

它会用您的数据产生这样的结果;

$ sparql --data data2.n3 --query query.rq
-------------------------------------------------------------------------------------------------------------------------------
| lastName                                             | label                                                                |
===============================================================================================================================
| "Hajagos"^^<http://www.w3.org/2001/XMLSchema#string> | "Linked open drug data for pharmaceutical research and development." |
-------------------------------------------------------------------------------------------------------------------------------

在端点运行时会产生很多结果。也就是说,我在端点的结果中看不到 Hajagos 的任何结果。我不知道这是为什么(但在下一节中有一些注意事项)。

注意事项

经过一些实验,似乎有一些警告。例如,如果我们用 object 搜索三元组"Hajagos",我们会得到与搜索 不同的三元组"Hajagos"^^xsd:string。例如,这个查询

select ?s ?p { ?s ?p "Hajagos" }

返回

s                                          p
http://reach.suny.edu/individual/Hajagos_J http://xmlns.com/foaf/0.1/lastName

但是这个查询

select ?s ?p { ?s ?p "Hajagos"^^xsd:string } 

返回

s                                              p
http://reach.suny.edu/individual/Hajagos_Janos http://xmlns.com/foaf/0.1/lastName

请注意,个人是不同的!这不是一个伟大的事态。我们可以查询两者,但是

select ?s ?p { 
  { ?s ?p "Hajagos" } UNION { ?s ?p "Hajagos"^^xsd:string }
}

发现

s                                              p
http://reach.suny.edu/individual/Hajagos_J     http://xmlns.com/foaf/0.1/lastName
http://reach.suny.edu/individual/Hajagos_Janos http://xmlns.com/foaf/0.1/lastName
于 2013-10-14T18:18:38.090 回答