private Uri ReadRemoteTripleFormat(Uri graph, Uri location, RdfSerializationFormat format) { using (VDS.RDF.Storage.VirtuosoManager m = new VDS.RDF.Storage.VirtuosoManager(CreateConnectionString())) { using (VDS.RDF.Graph g = new VDS.RDF.Graph()) { UriLoader.Load(g, location); g.BaseUri = graph; m.SaveGraph(g); } } return(graph); }
private Uri ReadTripleFormat(TextReader reader, Uri graphUri, RdfSerializationFormat format, bool update) { using (VDS.RDF.Storage.VirtuosoManager m = new VDS.RDF.Storage.VirtuosoManager(CreateConnectionString())) { using (VDS.RDF.Graph graph = new VDS.RDF.Graph()) { IRdfReader parser = dotNetRDFStore.GetReader(format); parser.Load(graph, reader); graph.BaseUri = graphUri; if (update) { m.UpdateGraph(graphUri, graph.Triples, new Triple[] {}); } else { m.SaveGraph(graph); } } } return(graphUri); }
private Uri ReadQuadFormat(TextReader reader, Uri graph, RdfSerializationFormat format, bool update) { using (VDS.RDF.Storage.VirtuosoManager m = new VDS.RDF.Storage.VirtuosoManager(CreateConnectionString())) { using (VDS.RDF.ThreadSafeTripleStore store = new VDS.RDF.ThreadSafeTripleStore()) { VDS.RDF.Parsing.TriGParser p = new TriGParser(); p.Load(store, reader); foreach (var x in store.Graphs) { if (update) { m.UpdateGraph(x.BaseUri, x.Triples, new Triple[] { }); } else { m.SaveGraph(x); } } } } return(graph); }