[英]SPARQL Query with colon in predicate
我試圖從linkedgeodata.org查詢一個國家內的國家的RDF數據。 在RDF中,它表示如下:
<http://linkedgeodata.org/triplify/node1055351027> <http://linkedgeodata.org/property/is_in%3Acountry> "LT" .
您可能會注意到,謂詞包含一個轉義冒號,所以“%3A”而不是“:”我無法為此找到合適的SPARQL查詢,這些是我的一些嘗試
?node lgdp:is_in "LT".
?node lgdp:is_in:country "LT".
?node lgdp:is_in%3Acountry "LT".
?node lgdp:is_in\u003Acountry "LT".
?node lgdp:is_in"\u003A"country "LT".
我使用開源版的virtuoso作為我的三重存儲,這是我收到的錯誤消息,除了第一個表單:
Virtuoso 37000 Error SP030: SPARQL compiler, line 0: Invalid character in SPARQL expression at '\'
SPARQL query:
define sql:big-data-const 0
#output-format:text/html
define input:default-graph-uri PREFIX lgdo:
PREFIX lgdp:
PREFIX lgd:
PREFIX pos:
PREFIX rdf:
SELECT ?node, ?label
Where {
?node a lgdo:State .
?node lgdp:is_in\u003Acountry "LT".
?node rdfs:label ?label .
}
使用命名空間時,不允許使用%
編碼的字符,在這種情況下,您必須直接使用完整謂詞(不使用命名空間)。 以下查詢有效:
Prefix lgdo:<http://linkedgeodata.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?node, ?label
Where {
?node a lgdo:State .
?node <http://linkedgeodata.org/property/is_in%3Acountry> "LT".
?node rdfs:label ?label
}
在這里看到結果。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.