W3C home > Mailing lists > Public > public-sparql-dev@w3.org > October to December 2016

Re: Moving a given subset of triples to another graph.

From: Rob Vesse <rvesse@dotnetrdf.org>
Date: Tue, 15 Nov 2016 10:23:28 +0000
To: SPARQL <public-sparql-dev@w3.org>
Message-ID: <65B9774B-B07E-4AF8-A491-BD7121C46CFC@dotnetrdf.org>
INSERT {} WHERE {} should do the trick

https://www.w3.org/TR/sparql11-update/#insert

For your specific example:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
INSERT
{
  GRAPH <http://mygraph2/> { ?s rdf:type ?o }
}
WHERE
{
  GRAPH <http://mygraph/> { ?s rdf:type ?o }
}

Note that since this is a SPARQL update this may need to be submitted to a different endpoint/API than you would submit a query to

Regards,

Rob Vesse


On 15/11/2016 07:10, "Olivier Rossel" <olivier.rossel@gmail.com> wrote:

    Hi all.
    
    I wonder how I can move all triples matching a given SELECT (like this):
    SELECT * WHERE { GRAPH <http://mygraph/> {?s rdf:type ?o} }
    
    into another named graph (let's call it http://mygraph2).
    
    What kind of SPARQL statement would do that?
    
    
Received on Tuesday, 15 November 2016 10:24:31 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 15 November 2016 10:24:31 UTC