7

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

ffa
  • 747
  • 1
  • 6
  • 14

2 Answers2

8

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.

AndyS
  • 16,345
  • 17
  • 21
1

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

DROP GRAPH <yourgraph>
Roman Susi
  • 4,135
  • 2
  • 32
  • 47