|
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:
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 |
|
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. 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? 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. |

