Virtuoso Open-Source Edition

  • Topic
  • Discussion
  • VOS.VirtTipsAndTricksConvertPropertiesToString(Last) -- DAVWikiAdmin? , 2017-06-13 05:43:59 Edit WebDAV System Administrator 2017-06-13 05:43:59

    How do I use SPARUL to change a selection of property values from URI References to Literals?

    Assume a given graph where triples are comprised of property values that are mixed across URI References and Typed Literals as exemplified by the results of the query below:
    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')
      }
    

    You can use the following SPARUL pattern to harmonize the property values across relevant triples in a specific graph, as shown below:

    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