Query with Sparql spaces

Tell me if I want to return the result of “fun” from the top three. I do not know how to explain the space between words. Below is the query I tried, but it did not work. Let me know if anyone can determine what I am doing wrong.

<rdf:Description rdf:about="http://website.com/urls/playing games"> <owl:sameAs rdf:resource="http://website.com/urls/having fun"/> </rdf:Description> "PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT * WHERE { ?y owl:sameAs+ <http://website.com/urls/playing fun> }"; 
+6
source share
2 answers

Short answer: you cannot, at least not directly.

Slightly long answer: RDF itself uses RDF URI references. On the other hand, the SPARQL query language uses IRI (the reason is that RDF precedes IRI, and the concept of RDF URI references was developed in the expectation that IRIs are ultimately expected). They understood almost correctly :)).

Unfortunately, there is a discrepancy between the RDF URI and IRI link definitions, and you just clicked on one of the cases: while RDF URI links allow spaces, IRI do not. SPARQL syntax cannot handle URI references, for example, in your example. See this discussion for more details.

What is your best bet? Avoid using spaces in URI links. Replace them with underscores or simply delete them.

All that is said is a way around your request:

 PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT ?y WHERE { ?y owl:sameAs+ ?x FILTER (str(?x) = "http://website.com/urls/playing fun") } 
+9
source
  • He owl:sameAs not owl:sameAs . Mark capital A.
  • There can be no spaces in the IRI.
+2
source

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


All Articles