SPARQL Colon in Predicate

I am trying to request RDF data from linkedgeodata.org for in-country states. In RDF, it is presented as such:

<http://linkedgeodata.org/triplify/node1055351027> <http://linkedgeodata.org/property/is_in%3Acountry> "LT" . 

As you can see, the predicate contains an escape colon, so "% 3A" instead of ":" I could not find a suitable SPARQL query for this, these are some of my attempts

 ?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". 

I am using the open source virtuoso version as my triple repository, this is the error I get with all but the first form:

  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 . } 
+6
source share
1 answer

Characters encoded with % are not allowed when using namespaces, in which case you will need to use the full predicate directly (without a namespace). The following query is executed:

 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 } 

see the results here .

+7
source

Source: https://habr.com/ru/post/886890/


All Articles