Hi there,

I've read the spec but can't really figure out if it is allowed to have a blank node in an INSERT DATA SPARQL Update query. So, what would be the result of the following query:

PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT DATA
{ 
   _:book1 dc:title   "A new book" ;
           dc:creator "A.N.Other" .
}

Would it generate some (random) IRI for that blank node just as relational databases do for autoincrement columns?

If not, how could one possible create a IRI without having to check if it is already in use?

Thank you very much

asked 25 Oct '11, 07:48

Markus%20Lanthaler's gravatar image

Markus Lanth...
19416
accept rate: 50%


That is allowed, yes. But the SPARQL engine will not generate an IRI for you - it will remain as a blank node in your triple store. (However, it should not keep the label "book1".)

If you need to generate an IRI, probably the easiest and most portable way is to generate one based on a UUID before assembling the INSERT.

permanent link

answered 25 Oct '11, 07:57

tobyink's gravatar image

tobyink ♦
5.2k312
accept rate: 26%

So it will become somethings like _:lkdj23, right? How do I know to what it is renamed?

Will that blank node then stay the same, i.e., can I reference at a later point?

(25 Oct '11, 08:06) Markus Lanth... Markus%20Lanthaler's gravatar image
1

No, you can't reference a bnode at a later point. Not directly at least. (However, {?book dc:title "A new book"} will get you a match for ?book, which is the bnode.) If you need to refer to it by name, you should generate a unique name and/or use UUID as @tobyink suggests.

(25 Oct '11, 12:09) scotthenninger ♦ scotthenninger's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1,329
×50
×30

question asked: 25 Oct '11, 07:48

question was seen: 2,946 times

last updated: 02 Jan '13, 12:19