Search code examples
sparqlrdf

SPARQL insert containing expression


I would like to insert triple patterns like this into a Sesame endpoint, but I just can't seem to pull it all together

bind(UUID() as ?uuid) .
bind(now() as ?timeVal) .
:event1 :hasUuid ?uuid.
:event1 :hasTimestamp ?timeVal

Solution

  • I'm not familiar with Sesame/RDF4J, but the following works with Jena ARQ:

    INSERT
      { 
      :event1 :hasUuid ?uuid .
      :event1 :hasTimestamp ?timeVal .
      }
    WHERE
      { SELECT ?uuid ?timeVal
        WHERE
          {
          BIND(UUID() AS ?uuid) .
          BIND(now() AS ?timeVal) .
          }
      }