使用 uri 的 Sparql 查询

Sparql query with uri

我有这样的rdf结构

<owl:Thing rdf:about="http://hust.se.vtio.owl#atm-techcombank-127-pho-minh-khai-hai-ba-trung-ha-noi">
<rdf:type rdf:resource="http://hust.se.vtio.owl#ATM"/>
<rdfs:label xml:lang="vn"><![CDATA[ATM - Techcombank]]></rdfs:label>
<rdfs:label xml:lang="en"><![CDATA[ATM - Techcombank]]></rdfs:label>
<hasLatitude rdf:datatype="&xsd;double">20.9954529</hasLatitude>
<hasLongtitude rdf:datatype="&xsd;double">105.8546176</hasLongtitude>
<hasGeoPoint rdf:datatype="http://franz.com/ns/allegrograph/3.0/geospatial/spherical/degrees/-180.0/180.0/-90.0/90.0/5.0">+20.9954529+105.8546176</hasGeoPoint>
<hasLocation rdf:resource="http://hust.se.vtio.owl#atm-techcombank-127-pho-minh-khai-hai-ba-trung-ha-noi-address"/>
<belongToBank rdf:resource="http://hust.se.vtio.owl#techcombank"/>
<hasMedia rdf:resource="http://hust.se.vtio.owl#atm-techcombank-127-pho-minh-khai-hai-ba-trung-ha-noi-images"/>

当我知道 uri 时,如何通过 sparql 获得 labelLatitude... :

http://hust.se.vtio.owl#atm-techcombank-127-pho-minh-khai-hai-ba-trung-ha-noi

这取决于您如何定义ontology。例如,假设您已经定义了类似 x subClassOf: hasLatitude value 20.9954529 的内容,那么您可以提出与以下类似的查询:

prefix :<http://hust.se.vtio.owl#>
SELECT  *
    WHERE { ?s rdfs:label ?label.
            ?s rdfs:subClassOf  ?o.
            ?o owl:onProperty :hasLatitude.
            ?o ?x ?y.
 }

您可以过滤 ?s,只为您提供 atm-techcombank-127-pho-minh-khai-hai-ba-trung-ha-noi 的答案。例如,filter (?s=:atm-techcombank-127-pho-minh-khai-hai-ba-trung-ha-noi).