Ability to decode a column containing URIs

Hi Team,
I have created a virtual graph using a sms file that i created which as follows

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX stardog: <tag:stardog:api:>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix a-core: <http://sample.com/def/core#> 
prefix a-prod: <http://sample1.com/def/product#> 
prefix skos: <http://www.w3.org/2004/02/skos/core#> 

MAPPING
FROM SQL {
  SELECT *
  FROM core.ingredient
}
TO {
  ?api a-prod:is-active ?is_active .
  ?api a-prod:created-by ?created_by .
  ?api a-prod:created-timestamp ?created_timestamp .
  ?api a-prod:updated-by ?updated_by .
  ?api a-prod:updated-timestamp ?updated_timestamp .
  ?api a-prod:is-deleted ?is_deleted .
} WHERE {

      BIND(template("{ingredient_uri}") AS ?api) #uri Column
}

The column ingredient_uri has all the URIs . The issue is when i run a normal Select *{?s ?p ?o} query ingredient_uri column which has URIs comes in a encoded format example :http%3A%2F%2Frefdata.sample.com%2FGPI%2af-106

Is there a way in sms mapping itself while binding the template to "ingredient_uri" column, I can decode the Uri's present in the column

Try

BIND(IRI(?ingredient_uri) AS ?api)

1 Like

Thanks! This is working

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.