Virtuoso Open-Source Wiki
Virtuoso Open-Source, OpenLink Data Spaces, and OpenLink Ajax Toolkit
Advanced Search
Help?
Location: / Dashboard / Main / VirtTipsAndTricksGuide / VirtTipsAndTricksControlConvertPropertiesToString

How to construct query to change all the values of properties in a triple to strings?

Suppose for given graph all values of properties are a mixture of strings and decimals.

SELECT DISTINCT ?sa ?oa 
FROM <http://ucb.com/nbeabase>
WHERE 
  { 
    ?sa a <http://ucb.com/nbeabase/resource/Batch> .
    ?sa <http://ucb.com/nbeabase/resource/chemAbsNo> ?oa . FILTER regex(?oa, '-','i')
  }

In order to change the values to string, should be executed the following statement:

SQL> SPARQL 
INSERT INTO GRAPH <http://ucb.com/nbeabase> 
  { 
    ?sa <http://ucb.com/nbeabase/resource/sampleId> `str (?oa)` 
  }  
WHERE 
  { 
    ?sa <http://ucb.com/nbeabase/resource/chemAbsNo> ?oa .  FILTER regex(?oa, '-','i')   
  }

Related

Powered By Virtuoso