简体   繁体   中英

Delete all data in aws neptune

I have an aws neptune cluster and which I inserted many ntriples and nquads data using sparql http api.

curl -X POST --data-binary 'update=INSERT DATA { http://test.com/s http://test.com/p http://test.com/o . }' http://your-neptune-endpoint:8182/sparql

I would like to clean all the data I inserted(not the instance)

How can I do that?

You can do a SPARQL DROP ALL to delete all your data.

If you want a truly empty database (no data, no metrics in cloudwatch, no audit history etc), then I would highly recommend creating a new cluster up fresh. It takes only a few minutes.

If you want to want to remove only the data you inserted, one strategy is to use named graphs. When you insert the data, insert it into a named graph. When you delete, delete the graph.

To insert, one way is to use a call similar to the insert you gave. Except you insert into a named graph:

curl -X POST --data-binary 'update=INSERT DATA { GRAPH http://www.example.com/named/graph { http://test.com/s http://test.com/p http://test.com/o . } }'
https://endpoint:8182/sparql

Alternative is to insert using Graph Store Protocol:

curl --request POST -H "Content-Type: text/turtle"
--data-raw " http://test.com/s http://test.com/p http://test.com/o . "
'https://endpoint:8182/sparql/gsp/?graph=http%3A//www.example.com/named/graph'

Another is to use the bulk loader, which has namedGraphUri option ( https://docs.aws.amazon.com/neptune/latest/userguide/load-api-reference-load.html ).

Here is a delete that removes the named graph:

curl --request DELETE 'https://endpoint:8182/sparql/gsp/?graph=http%3A//www.example.com/named/graph'

See https://docs.aws.amazon.com/neptune/latest/userguide/sparql-graph-store-protocol.html for details on the Graph Store Protocol in Neptune.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM