How can I batch-insert many statements that are dependent on each other?



the documentation says that insert statements which are dependent on each other can’t be batch-inserted. But this is one of the most common scenarios. Usually when you have relationships, you insert some entities, then the relationship “container” references your inserted entity, for example

insert $entity1 isa something;
insert $entity2 isa something
<define relationship that references $entity1 and $entity2)

What is the best practice to handle this so that I can actually do batch insert? In which cases is batch insert most useful, if it cannot handle the above?


Use specific ID in insert query