2015-04-06 120 views
0

我RDF結構這樣SPARQL查詢與URI

<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"/> 

我怎樣才能得到labelLatitude ......通過sparql當我知道URI:

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

回答

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)