Search code examples
sparqlsparqlwrapper

SPARQL types convert uri to/from literal


I want to write a cross ontologies request, so it takes information from two ontologies per say onto1 and onto2:

select x y z where {
x onto1:hasY y
y onto2:hasZ Z
}

the problem is that the y differs in term of uri, from onto1 you get this y

http://uri1.com/yis#y

from onto2 you get this one:

http://uri2.com/yis#y

I tried to change one of the two uris but if you change it to the other, it doesn't work for its own triplet..

what I did is a bind to get rid of the uri1 and a concat to insert uri2 in it..

but then the type of the returned json changes from uri to literal! is there a way to change the type from literal to uri??


update

the returned json is : {"type": "uri" , "value": "http://uri1...} and {"type": "literal" , "value": "http://uri1...}


Solution

  • Just discovered the URI command. To solve my problem just add this to the concat function:

    uri(fn:concat("http://uri2.com/#", "y1"))
    

    It works for me, I can SPARQL from two different ontologies using a common class.