2015-04-06 89 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)