freme-project / freme-ner

Apache License 2.0
6 stars 1 forks source link

SPARQL INSERT request for uploading triples in virtuoso #132

Closed m1ci closed 7 years ago

m1ci commented 8 years ago

@jnehring here is a SPARQL query for inserting data:

INSERT DATA { GRAPH urn:sparql:tests:insert:data { <#book1> <#price> "32" . } }

Here is same SPARQL query via HTTP POST

curl -v -X POST -H "Content-Type: application/sparql-update" -d "INSERT DATA { GRAPH urn:sparql:tests:insert:data { <#book1> <#price> 42 } }" "http://rv2622.1blu.de:8890/sparql/"

jnehring commented 8 years ago

@koidl please test

koidl commented 8 years ago

Thanks Milan -

koidl commented 8 years ago

This might get messy - If I have a dataset with lets say 1000 entities how will I do this via curl? Also how do I delete or modify the tripplestore?

jnehring commented 8 years ago

@koidl did the curl work out for you? Could you add some sample data to a graph?

I have a dataset with lets say 1000 entities how will I do this via curl?

You can do subsequent requests in batches when a single request is too large.

Also how do I delete or modify the tripplestore?

Maybe @m1ci has another suggestion, but I would suggest modifying above SPARQL query to a DELETE query: https://www.w3.org/TR/sparql11-update/#delete

sandroacoelho commented 8 years ago

You have two more options:

If you have access to the Virtuoso Server and is familiar with command line tools, you can use isql (isql-v) that is under the Virtuoso folder (/usr/local/virtuoso-opensource/bin/). Just run /usr/local/virtuoso-opensource/bin/isql ( or /usr/local/virtuoso-opensource/bin/isql-v - depends of your version) using your dba credentials and then

  ld_dir(FOLDER, FILE, GRAPH);
  rdf_loader_run();

Eg.: I have DBpedia labels file in /tmp folder, so

  ld_dir('/tmp/', 'labels_en.ttl', 'http://dbpedia.org');
  rdf_loader_run();

To delete, just run

CLEAR GRAPH <http://mygraphuri/>

Or you can use Conductor (Virtuoso administration interface) that you access from your browser (http://PATH_TO_VIRTUOSO_SERVER:PORT/conductor - Eg: http://localhost:8890/conductor).

There you can use Linked Data menu to access Quad Store Upload feature, where you can upload your files.

Best,

m1ci commented 8 years ago

@koidl with one request you can insert/update/delete multiple triples, here is an example

INSERT DATA { GRAPH <urn:sparql:tests:insert:data> { <#book1> <#price> "1" . <#book1> <#price> "2" . <#book1> <#price> "3" . <#book1> <#price> "4" . <#book1> <#price> "5" . } }

m1ci commented 7 years ago

@koidl do you need any additional support on this?

m1ci commented 7 years ago

no active discussion, closing the issue.