Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the proper universal way of inserting blank nodes using SPARQL

I am writing an application using the Apache Jena framework. With this I am able to do everything (insert, update, select). But i can't wrap my head around how to properly insert blank nodes using an INSERT query.

Is there a go-to approach for this (which works with every endpoint)? I know SPARQL 1.1 introduced some features for this to be accomplished, but it does not seem to work using a Virtuoso endpoint.

like image 842
oole Avatar asked Oct 23 '25 17:10

oole


1 Answers

There are a couple of syntaxes to use. Suppose you want to add a bnode of type :Person to an object property named child. Here's one way:

?s :child [a :Person] .

And another:

?s :child [] .
[] a :Person .

And the _:bn notation is pretty universal, and useful when there are more than one bnode in a graph:

?s :child _:b0 .
_:b0 a :Person .
like image 61
scotthenninger Avatar answered Oct 26 '25 11:10

scotthenninger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!