VirtTipsAndTricksGuideExpressionsUsageInConstructInsertDelete Using Expressions inside SPARQL CONSTRUCT {...}, INSERT {...}, or DELETE {...} statements Using Expressions inside SPARQL CONSTRUCT {...}, INSERT {...}, or DELETE {...} statements The are times when you may want to post-process existing RDF triples, en route to creating enhanced data views. For instance, you may want to enhance the literal values associated with annotation properties such as rdfs:label and rdfs:comment. You can do this in CONSTRUCT {...}, INSERT {...}, or DELETE {...} construction templates, by including expressions wrapped in back-ticks, i.e. -- `expression` Examples Here some SPARQL 1.1 Update Language examples showcasing how this is achieved using Virtuoso. Example showing an expression used inside a CONSTRUCT query CONSTRUCT { ?inst rdfs:label `bif:concat ( ?inst_label, " Instance with up to ", str(?core_val), " logical processor cores and " , str(?sess_val) , " concurrent ODBC sessions from licensed host" )` } FROM <http://uda.openlinksw.com/pricing/> WHERE { ?inst a gr:Individual , oplweb:ProductLicense ; rdfs:label ?inst_label ; oplweb:hasMaximumProcessorCores ?core ; oplweb:hasSessions ?sess . ?core a gr:QuantitativeValueInteger ; gr:hasMaxValueInteger ?core_val . ?sess a gr:QuantitativeValueInteger ; gr:hasValue ?sess_val . } You can see live results of this query. Example showing an expression used inside an INSERT query SPARQL INSERT INTO GRAPH <urn:mygraph> { ?inst rdfs:label `bif:concat ( ?inst_label, " Instance with up to ", str(?core_val), " logical processor cores and " , str(?sess_val) , " concurrent ODBC sessions from licensed host" )` } FROM <http://uda.openlinksw.com/pricing/> WHERE { ?inst a gr:Individual , oplweb:ProductLicense ; rdfs:label ?inst_label ; oplweb:hasMaximumProcessorCores ?core ; oplweb:hasSessions ?sess . ?core a gr:QuantitativeValueInteger ; gr:hasMaxValueInteger ?core_val . ?sess a gr:QuantitativeValueInteger ; gr:hasValue ?sess_val . }; Done. -- 406 msec. SQL> SPARQL SELECT ?label FROM <urn:mygraph> WHERE { ?inst rdfs:label ?label }; label VARCHAR _______________________________________________________________________________ ODBC Driver (Single-Tier Express Edition) Instance with up to 16 logical processor cores and 5 concurrent ODBC sessions from licensed host ODBC Driver (Single-Tier Express Edition) Instance with up to 16 logical processor cores and 5 concurrent ODBC sessions from licensed host ODBC Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor cores and 5 concurrent ODBC sessions from licensed host ODBC Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor cores and 5 concurrent ODBC sessions from licensed host ODBC Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor cores and 5 concurrent ODBC sessions from licensed host ODBC Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor cores and 5 concurrent ODBC sessions from licensed host JDBC Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor cores and 5 concurrent ODBC sessions from licensed host OLEDB Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor cores and 5 concurrent ODBC sessions from licensed host ADO.NET Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor cores and 5 concurrent ODBC sessions from licensed host 9 Rows. -- 31 msec. Example showing an expression used inside a DELETE query SPARQL DELETE FROM GRAPH <urn:mygraph> { ?inst rdfs:label `bif:concat ( "JDBC Driver (Single-Tier Lite Edition) Instance with up to ", str(?core_val), " logical processor cores and ", str(?sess_val), " concurrent ODBC sessions from licensed host" )` } FROM <http://uda.openlinksw.com/pricing/> WHERE { ?inst a gr:Individual , oplweb:ProductLicense ; rdfs:label ?inst_label ; oplweb:hasMaximumProcessorCores ?core ; oplweb:hasSessions ?sess . FILTER ( regex ( ?inst_label, "JDBC Driver" ) ) . ?core a gr:QuantitativeValueInteger ; gr:hasMaxValueInteger ?core_val . ?sess a gr:QuantitativeValueInteger ; gr:hasValue ?sess_val . }; Done. -- 32 msec. SQL> SPARQL SELECT ?label FROM <urn:mygraph> WHERE { ?inst rdfs:label ?label }; label VARCHAR _______________________________________________________________________________ ODBC Driver (Single-Tier Express Edition) Instance with up to 16 logical ... ODBC Driver (Single-Tier Express Edition) Instance with up to 16 logical ... ODBC Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor ... ODBC Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor ... ODBC Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor ... ODBC Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor ... OLEDB Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor ... ADO.NET Driver (Single-Tier Lite Edition) Instance with up to 16 logical processor ... 8 Rows. -- 16 msec. Related Virtuoso Tips and Tricks Collection Virtuoso Documentation