Article Image
read

Despite being allowed by the the SPARQL 1.1 Update language, Virtuoso doesn’t allow to insert statements containing blank nodes using the INSERT DATA update query. Oddly enough, when using the INSERT update query it is possible to add statements with blank nodes. Unfortunately in this case a WHERE clause has to be specified. So what is needed is a WHERE clause which returns a non-empty result in all circumstances to ensure insertion of the statements. Here is a rather hacky solution to accomplish this problem:

INSERT {
  _:node123 <http://example.org/property> <http://example.org/object> .
}
WHERE {
  SELECT * {
    OPTIONAL { ?s ?p ?o . }
  } LIMIT 1
}

To get a non-empty result set at any price just use a nested SELECT query with an optional triple selection limited to one result. This guarantees the execution of the INSERT clause. Happy inserting of blank nodes.

Head over to GitHub to follow this issue.

Image credits: <a href="http://milicicvuk.com/blog/2011/07/14/problems-of-the-rdf-model-blank-nodes/">Problems of the RDF model: Blank Nodes</a>

Blog Logo

Marvin Frommhold

"Aufgrund falschen Medienkonsums und Bildungsmangel gibt es in Deutschland immer mehr assipöse Menschen."

Image

depressiveRobot

random stuff by a linked data engineer

Back to Overview