ffa
ffa

Reputation: 797

Rename a graph with sparql update

Is possible to rename a graph using sparql update?

The only way through that I see is this:

INSERT {GRAPH uri:graphNEW {?s ?p ?o}}
WHERE  {GRAPH uri:graphOLD {?s ?p ?o}};
DROP GRAPH uri:graphOLD

but I'm not 100% sure that all the triples and attributes (like langue tags and xsd format) will be copied in the new graph.

Is there a cleverer way to do it?

EDIT: question improved thanks to Roman Susi suggestion

Upvotes: 7

Views: 1285

Answers (2)

AndyS
AndyS

Reputation: 16630

From http://www.w3.org/TR/sparql11-update/#graphManagement

MOVE uri:graphOLD TO uri:graphNEW

which will replace uri:graphNEW

ADD uri:graphOLD TO uri:graphNEW

which will add all of old into new and keep existing triples in uri:graphNEW.

Upvotes: 8

Roman Susi
Roman Susi

Reputation: 4199

Graphs can be made empty of records with DELETE, but to remove the graph itself DROP GRAPH directive is needed:

DROP GRAPH <yourgraph>

Upvotes: 1

Related Questions