Hello Peter, > Is there anyway with SPARQL and Virtuoso to create a URI in a result when it > is stored as a literal in the triplestore?
Virtuoso has built-in function iri() that is similar to str() but produce an IRI. > An example query of the relevant data is: > > SELECT * WHERE { GRAPH<http://purl.org/science/graph/obo/COG2GO> { ?s ?p > "http://purl.org/obo/owl/COG#COG_C"^^xsd:anyURI . } } > Endpoint: http://sparql.neurocommons.org/sparql/ SELECT ?s (iri(?o)) as ?o_iri WHERE { GRAPH<http://purl.org/science/graph/obo/COG2GO> { ?s <http://www.geneontology.org/formats/oboInOwl#hasURI> ?o } } It's easy to make some transformation of the IRI, like SELECT ?s (iri(bif:sprintf("http:/myproxyserver.private/describe?iri=%U", str(?o)))) as ?o_iri WHERE { GRAPH<http://purl.org/science/graph/obo/COG2GO> { ?s <http://www.geneontology.org/formats/oboInOwl#hasURI> ?o } } or, slightly better, SELECT ?s (bif:sprintf_iri("http:/myproxyserver.private/describe?iri=%U", str(?o))) as ?o_iri WHERE { GRAPH<http://purl.org/science/graph/obo/COG2GO> { ?s <http://www.geneontology.org/formats/oboInOwl#hasURI> ?o } } You may use "backquoted" calculated expressions as triple pattern fields... SELECT ?s (iri(?o)) as ?o_iri WHERE { GRAPH `iri(bif:concat("http://purl.org/science/graph/", "obo/COG2GO"))` { ?s <http://www.geneontology.org/formats/oboInOwl#hasURI> ?o } } ... or as triple construct fields: construct { ?s <my-proxy> `bif:sprintf_iri("http:/myproxyserver.private/describe?iri=%U", str(?o))` } WHERE { GRAPH<http://purl.org/science/graph/obo/COG2GO> { ?s <http://www.geneontology.org/formats/oboInOwl#hasURI> ?o } } Best Regards, Ivan Mikhailov OpenLink Software http://virtuoso.openlinksw.com