2

I am trying to copy a specific graph from dbpedia.org to local virtuoso using dotnetrdf in C#. E.g. dbpedia.org/resource/Category:Cyclists_at_the_2012_Summer_Olympics

Code below gets graph from Virtuoso and asserts all its triples to my new graph. Then I am adding new graph to Virtuoso, But it doesn't work.

Example code

 IGraph g = new Graph()
 IGraph nG = new Graph()
 nG.BaseUri = new Uri(linkToDbpedia);

 UriLoader.Load(g, new Uri(linkToDbpedia))


 foreach(Triple t in g.Triples) {

   nG.Assert(t);

 }

 VirtuosoManager manager = new VirtuosoManager("localhost", 1111, VirtuosoManager.DefaultDB, "dba", "dba");
 PersistentTripleStore store = new PersistentTripleStore(manager);

 store.Add(nG);
 store.Flush();

My main task is to send SPARQL queries to my own Virtuoso db, because it takes less time.

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58

2 Answers2

0

In the second I tried to copy graph using sparql queries, but it was useless because In some cases my t.Object its Uri in other cases its Integer, Double, and Date.

This way Is not fully studied, so you can ignore it.

0

This is correct answer :3

VirtuosoManager manager = new VirtuosoManager("localhost", 1111, VirtuosoManager.DefaultDB, "dba", "dba");

IGraph g = new Graph();
UriLoader.Load(g, new Uri(linkToDBpedia));

g.BaseUri = new Uri(linkToDBpedia);

manager.saveGraph(g);