用uri进行sparql查询

时间:2015-04-06 08:43:50

标签: rdf sparql ontology

我有像这样的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时,如何通过label获取Latitudesparql ...

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

1 个答案:

答案 0 :(得分:1)

这取决于你如何定义本体。例如,假设您已经定义了类似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)