Re: Restricting SPARQL update to a single named graph

2022-06-08 Thread Andy Seaborne




On 08/06/2022 09:22, Martynas Jusevičius wrote:

On Tue, Jun 7, 2022 at 9:15 PM Andy Seaborne  wrote:


On 07/06/2022 10:47, Martynas Jusevičius wrote:

Hi,

I have implemented PATCH method for the Graph Store Protocol:
https://www.w3.org/TR/sparql11-http-rdf-update/#http-patch

The PATCH is applied to a named graph. I am missing this bit however:
" If a SPARQL 1.1 Update request is used as the RDF payload for a
PATCH request that makes changes to more than one graph or the graph
it modifies is not the one indicated, it would be prudent for the
server to respond with a 422 Unprocessable Entity status."


I read that in the context of GSP resource naming.

?graph=

and so the update does not name a graph - it'll look like the default
graph in the update.

So look for GRAPH in the update.


Thanks, that makes sense. GRAPH is also easy to check.

But then I need to forward the update to a triplestore that does not
support PATCH.


It's the GSP naming that matters.


Which means I would need to wrap INSERT/DELETE/WHERE templates into
GRAPH  { }.


WITH  DELETE {} INSERT {} WHERE {}

Also: USING. And protocol.


Is there some builder code that can help with that?


Have you looked at UpdateBuilder?






What would be the way to make sure that an update only affects a
single specific graph?


A dataset of one graph and no others. c.f. DatasetGraphOne but for a
single named graph and read-only dft graph.

Or a dataset which yields read-only graphs except for the target graph.

Or analyse the update - no GRAPH in templates if the target comes from
the URL.




Martynas
atomgraph.com


Re: Restricting SPARQL update to a single named graph

2022-06-08 Thread Martynas Jusevičius
On Tue, Jun 7, 2022 at 9:15 PM Andy Seaborne  wrote:
>
> On 07/06/2022 10:47, Martynas Jusevičius wrote:
> > Hi,
> >
> > I have implemented PATCH method for the Graph Store Protocol:
> > https://www.w3.org/TR/sparql11-http-rdf-update/#http-patch
> >
> > The PATCH is applied to a named graph. I am missing this bit however:
> > " If a SPARQL 1.1 Update request is used as the RDF payload for a
> > PATCH request that makes changes to more than one graph or the graph
> > it modifies is not the one indicated, it would be prudent for the
> > server to respond with a 422 Unprocessable Entity status."
>
> I read that in the context of GSP resource naming.
>
> ?graph=
>
> and so the update does not name a graph - it'll look like the default
> graph in the update.
>
> So look for GRAPH in the update.

Thanks, that makes sense. GRAPH is also easy to check.

But then I need to forward the update to a triplestore that does not
support PATCH.
Which means I would need to wrap INSERT/DELETE/WHERE templates into
GRAPH  { }.
Is there some builder code that can help with that?

>
> > What would be the way to make sure that an update only affects a
> > single specific graph?
>
> A dataset of one graph and no others. c.f. DatasetGraphOne but for a
> single named graph and read-only dft graph.
>
> Or a dataset which yields read-only graphs except for the target graph.
>
> Or analyse the update - no GRAPH in templates if the target comes from
> the URL.
>
> >
> >
> > Martynas
> > atomgraph.com