On Wed, May 15, 2013 at 8:57 PM, Jerven Bolleman <[email protected]
> wrote:
> Hi Vishesh,
>
> Wouldn't the following work?
>
> WITH <nepomuk:/ctx/graph>
> DELETE { <resA> nao:lastModified ?mod . }
> INSERT { <resA> nao:lastModified "2012-01-29T16:29:11Z"^^xsd:dateTime . }
> WHERE { OPTIONAL {<resA> nao:lastModified ?mod .} }
>
> The first example you posted would not match in the case where the
> <resA> nao:lastModified ?mod did not yet exist.
> This form should match the update or insert behavior you are looking
> for. But I might be wrong not using update day to day.
>
Sorry for the delay
I tried out the suggested query and even it does not seem to work.
I think the reason it does not work is that when running a query such as
this -
select ?mod where { OPTIONAL { <resA> nao:lastModified ?mod . } }
The OPTIONAL does not really mater. Both ways, if the triple does not
exist, it will not return any results. Therefore, the insert/delete
operation will not be executed.
> Regards,
> Jerven
>
> On 15/05/13 17:20, Vishesh Handa wrote:
> > Hey Ivan
> >
> > On Tue, May 14, 2013 at 8:44 PM, Ivan Mikhailov
> > <[email protected]> wrote:
> >> Hello Vishesh,
> >>
> >> The query says:
> >>
> >> For every triple <resA> nao:lastModified ?mod found in database (if
> >> any),
> >>
> >> prepare future removal of <resA> nao:lastModified ?mod
> >> and
> >> prepare insertion of <resA> nao:lastModified
> >> "2012-01-29T16:29:11Z"^^xsd:dateTime .
> >>
> >> When all (if any) operations are prepared, perform the actual edition of
> >> the database.
> >>
> >> No <resA> nao:lastModified ?mod at the very beginning --- no
> >> manipulations prepared --- no effect.
> >>
> >> The solution is to make separate DELETE and then an unconditional
> >> INSERT.
> >
> > Thanks for the detailed explanation. I was hoping to optimize it by
> > not having to call a separate delete and insert operation.
> >
> > It would be nice to have something like an 'update or insert' like one
> > has in SQL.
> >
> >>
> >> Best Regards,
> >>
> >> Ivan Mikhailov
> >> OpenLink Software
> >> http://virtuoso.openlinksw.com
> >>
> >> On Tue, 2013-05-14 at 15:27 +0530, Vishesh Handa wrote:
> >>> Hey guys
> >>>
> >>> I've been trying to update some statements in a graph, and I have been
> >>> using the following query -
> >>>
> >>> WITH <nepomuk:/ctx/graph>
> >>> DELETE { <resA> nao:lastModified ?mod . }
> >>> INSERT { <resA> nao:lastModified "2012-01-29T16:29:11Z"^^xsd:dateTime
> . }
> >>> WHERE { <resA> nao:lastModified ?mod . }
> >>>
> >>> This works fine in the case when the <resA> nao:lastModified ?m triple
> >>> already exists, but it does not insert the new statement if that
> >>> triple does not exist.
> >>>
> >>> I was checking the SPARQL 1.1 Update Standard [1], and I found the
> >>> following text -
> >>>
> >>> "Deleting triples that are not present, or from a graph that is not
> >>> present will have no effect and will result in success."
> >>>
> >>> So in the case when the triple is not present the delete operation
> >>> should result in a success and the insert operation should be carried
> >>> out. But that does not seem to be the case.
> >>>
> >>> Could someone please confirm if this is just a bug or is that the
> >>> intended behaviour?
> >>>
> >>> [1]
> http://www.w3.org/TR/2012/PR-sparql11-update-20121108/#deleteInsert
> >>>
> >>> --
> >>> Vishesh Handa
> >>>
> >>>
> ------------------------------------------------------------------------------
> >>> AlienVault Unified Security Management (USM) platform delivers complete
> >>> security visibility with the essential security capabilities. Easily
> and
> >>> efficiently configure, manage, and operate all of your security
> controls
> >>> from a single console and one unified framework. Download a free trial.
> >>> http://p.sf.net/sfu/alienvault_d2d
> >>> _______________________________________________
> >>> Virtuoso-users mailing list
> >>> [email protected]
> >>> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
> >>
> >
> >
> >
> > --
> > Vishesh Handa
> >
> >
> ------------------------------------------------------------------------------
> > AlienVault Unified Security Management (USM) platform delivers complete
> > security visibility with the essential security capabilities. Easily and
> > efficiently configure, manage, and operate all of your security controls
> > from a single console and one unified framework. Download a free trial.
> > http://p.sf.net/sfu/alienvault_d2d
> > _______________________________________________
> > Virtuoso-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/virtuoso-users
> >
>
>
> --
> -------------------------------------------------------------------
> Jerven Bolleman [email protected]
> SIB Swiss Institute of Bioinformatics Tel: +41 (0)22 379 58 85
> CMU, rue Michel Servet 1 Fax: +41 (0)22 379 58 58
> 1211 Geneve 4,
> Switzerland www.isb-sib.ch - www.uniprot.org
> Follow us at https://twitter.com/#!/uniprot
> -------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Virtuoso-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>
--
Vishesh Handa
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
Virtuoso-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-users