Thomas Kimber
Thomas Kimber

Reputation: 11057

How best to remotely load RDF:XML to Virtuoso (via http call if possible)?

I have inherited a Virtuoso graph database that is accessed by clients on

http://someaddress:8890/sparql

This I can clear down remotely by running:

curl -i --data-urlencode query="CLEAR SILENT GRAPH curl -i --data-urlencode query="CLEAR SILENT GRAPH <http://someaddress:8890/db>" -H "Content-Type: application/sparql-query" -G http://someaddress:8890/sparql

And test that it's done what I expected with:

curl -i --data-urlencode query="select (count(?s) as ?count) where { ?s ?p ?o . }" -H "Content-Type: application/sparql-query" -G http://someaddress:8890/sparql

Which gives me the count of triples in the database - the count is non-zero, but it looks as though the remaining triples are system managed ones.

Next, I have a number of RDF files I want to load, the contents of which I intend to make available to users over the network via a SPARQL endpoint.

So to load the data, I run

curl -X PUT --digest -u "user:pass" -T "C:\data\rdf\triples_domain_a.rdf" -G "http://someaddress:8890/sparql-graph-crud-auth" --data-urlencode "graph=http://someaddress:8890/db"

I can see the triples are created when I check the count using the earlier curl - and it's gone up by the triple count in this file. So far, so good.

However, when I run the second file in, with:

curl -X PUT --digest -u "user:pass" -T "C:\data\rdf\triples_domain_b.rdf" -G "http://someaddress:8890/sparql-graph-crud-auth" --data-urlencode "graph=http://someaddress:8890/db"

Rather than appending these triples to my database, it replaces the previously loaded content with this one.

I've got a series of additional files to load - what am I doing wrong?

I can do this directly on the http://someaddress:8890 server by connecting to an isql session and running RDF_GLOBAL_RESET(); and DB.DBA.RDF_LOAD_RDFXML_MT locally - but I'm generating the files from a different server, and ideally, I want that server to upload them to the triplestore itself, without any manual intervention. The curl approach is preferred since it's a relatively simple command I can parameterise and execute from the generating server.

It feels as though I'm close, but I can't seem to get past this replacement issue - any ideas?

Upvotes: 0

Views: 656

Answers (1)

Geert
Geert

Reputation: 11

Try:

curl -X POST --digest -u "user:pass" -T "C:\data\rdf\triples_domain_b.rdf" -G "http://someaddress:8890/sparql-graph-crud-auth" --data-urlencode "graph=http://someaddress:8890/db"

Replacing a resource is normal http PUT behaviour

Upvotes: 1

Related Questions