Virtuoso Open-Source Edition

  • Topic
  • Discussion
  • VOS.VirtTipsAndTricksSPARQL11Assign(Last) -- DAVWikiAdmin? , 2017-06-13 05:41:15 Edit WebDAV System Administrator 2017-06-13 05:41:15

    Using SPARQL 1.1 Assignments

    What?

    Using SPARQL 1.1 assignments.

    Why?

    Allows the creation of new values in a query.

    How?

    Here is example showcasing Virtuoso's support for this functionality:

    1. Assume the following Raw Data Representation in Turtle:

      <#lemonade> <#price> 4 . <#wine> <#price> 6 . <#water> <#price> 1 . <#beer> <#price> 3 . <#liqueur> <#price> 5 .

    2. Load the sample data using SPARQL 1.1. INSERT Syntax:

      INSERT { GRAPH <urn:sparql:tests:assign> { <#lemonade> <#price> 4 . <#wine> <#price> 6 . <#water> <#price> 1 . <#beer> <#price> 3 . <#liqueur> <#price> 5 . } }

    3. Let's assign new price:

      SELECT ?item (?price*2.3 as ?NewPrice) FROM <urn:sparql:tests:assign> WHERE { ?item <#price> ?price }

    Related