tag42git
tag42git

Reputation: 35

Can I append a single branch of rdf:List rdf:rest's with one SPARQL Update query using VALUES keyword?

I am trying append to an rdf:List in SPARQL like so:

DELETE {
  ?end rdf:rest rdf:nil .
}
INSERT {
  ?end rdf:rest _:b0 .
  _:b0 rdf:type rdf:List .
  _:b0 rdf:first _:b1 .
  _:b1 rdfs:label ?t .
  _:b0 rdf:rest rdf:nil .
}
WHERE
  { <http://example/~/blah> (rdf:rest)* ?end .
    ?end  rdf:rest  rdf:nil
    VALUES ?t { "txt1" "txt2" "txt3" "txt4" }
  }

but I get the txtX's appended as rdf:rest's all at once which makes four branches, when what I'd like is to have the update executed sequentially for each value, to make a single branch. Is there a way to do this with a single query or a variable length string of VALUES?

Upvotes: 0

Views: 41

Answers (1)

UninformedUser
UninformedUser

Reputation: 8465

No, that's not possible with a single SPARQL query. The WHERE part allows for pattern matching, but not for recursion per each value of the VALUE clause.

Upvotes: 1

Related Questions