You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Trevor Donaldson <tm...@gmail.com> on 2015/04/08 22:40:27 UTC
Suggestions on handling Transactions with Fuseki
Hi all,
I have the following use case.
1. Update triple (delete / insert using sparql queries)
I was going to perform my updates by creating a list of deletes (sparql
queries) and a list of inserts (sparql queries), then I was going to
persist delete batch and persist insert batch. The problem with this logic
is that, if for some reason one of the insert statements doesn't work, then
I have deleted the triple with no way to rollback. Has anyone ran into this
problem? Does anyone have any suggestions on how to transactionalize the
deletes / inserts? I was thinking about handling them one statement at a
time. One delete with one insert.
Thoughts?
Thanks in advance,
Trevor
Re: Suggestions on handling Transactions with Fuseki
Posted by Trevor Donaldson <tm...@gmail.com>.
Thanks Stephen and James. This fits what I needed exactly.
On Apr 9, 2015 12:32 AM, "Stephen Allen" <sa...@apache.org> wrote:
> Trevor,
>
> SPARQL Update supports multiple operations in a single update request. The
> entire request is atomic. So either all operations are applied, or none of
> them are. You can perform multiple operations by separating them with a
> semicolon. Example update request string:
>
> prefix : <http://example.org/>
> delete data { :a :b :c . :a :b :d . } ;
> insert data { :a :b :x . :a :b :y . }
>
> Additionally you can mix in delete/insert/where operations as well.
>
> If you want true remote transactions that allow you to do read queries
> along with update queries in a single transaction, then you are out of luck
> for the moment. I do have plans to implement that at some point in the
> near future however.
>
> -Stephen
>
>
> On Wednesday, April 8, 2015, Trevor Donaldson <tm...@gmail.com> wrote:
>
> > Hi all,
> >
> > I have the following use case.
> >
> > 1. Update triple (delete / insert using sparql queries)
> >
> > I was going to perform my updates by creating a list of deletes (sparql
> > queries) and a list of inserts (sparql queries), then I was going to
> > persist delete batch and persist insert batch. The problem with this
> logic
> > is that, if for some reason one of the insert statements doesn't work,
> then
> > I have deleted the triple with no way to rollback. Has anyone ran into
> this
> > problem? Does anyone have any suggestions on how to transactionalize the
> > deletes / inserts? I was thinking about handling them one statement at a
> > time. One delete with one insert.
> >
> > Thoughts?
> >
> > Thanks in advance,
> > Trevor
> >
>
Re: Suggestions on handling Transactions with Fuseki
Posted by Stephen Allen <sa...@apache.org>.
Trevor,
SPARQL Update supports multiple operations in a single update request. The
entire request is atomic. So either all operations are applied, or none of
them are. You can perform multiple operations by separating them with a
semicolon. Example update request string:
prefix : <http://example.org/>
delete data { :a :b :c . :a :b :d . } ;
insert data { :a :b :x . :a :b :y . }
Additionally you can mix in delete/insert/where operations as well.
If you want true remote transactions that allow you to do read queries
along with update queries in a single transaction, then you are out of luck
for the moment. I do have plans to implement that at some point in the
near future however.
-Stephen
On Wednesday, April 8, 2015, Trevor Donaldson <tm...@gmail.com> wrote:
> Hi all,
>
> I have the following use case.
>
> 1. Update triple (delete / insert using sparql queries)
>
> I was going to perform my updates by creating a list of deletes (sparql
> queries) and a list of inserts (sparql queries), then I was going to
> persist delete batch and persist insert batch. The problem with this logic
> is that, if for some reason one of the insert statements doesn't work, then
> I have deleted the triple with no way to rollback. Has anyone ran into this
> problem? Does anyone have any suggestions on how to transactionalize the
> deletes / inserts? I was thinking about handling them one statement at a
> time. One delete with one insert.
>
> Thoughts?
>
> Thanks in advance,
> Trevor
>