How to add data to graph from a CONSTRUCT query

Hey Guys,

I was just wondering about something we are doing at the moment during our database seeding. For our APIs we are creating specialized graphs with a CONSTRUCT query and saving them to file before adding them to a new graph using the stardog data add command.

My questions is whether there is a way to directly stream, in the same database, triples from one graph tp another using a CONSTRUCT query. I looked into using INSERT DATA before the CONSTRUCT command, but it didn't work.

I just want to know if it could be faster and done in one step.

Thanks

Matt

Hi Matthew,

Of course there is! The best way is to use SPARQL Update, however not INSERT DATA but INSERT ... WHERE, cf. https://www.w3.org/TR/sparql11-update/#deleteInsert . The graph template after INSERT and WHERE could look pretty much like in your CONSTRUCT.

Then the whole thing will happen on the server side without sending data back and forth.

Cheers,
Pavel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.