Skip to content

Instantly share code, notes, and snippets.

View rvesse's full-sized avatar

Rob Vesse rvesse

View GitHub Profile
// Assuming we already have a StardogConnector in the variable stardog
IGraph g = new Graph();
// The graph gets populated with data somehow...
// Set the name for the graph
g.BaseUri = new Uri("http://example.org/name");
// Save to Stardog
stardog.SaveGraph(g);
@rvesse
rvesse / StardogConnectWithReasoning.cs
Last active December 18, 2015 05:29
Creating a Stardog connection with Reasoning enabled
StardogConnector stardog = new StardogConnector("http://localhost:5820", "db", StardogReasoningMode.QL,
"admin", "admin");
StardogConnector stardog = new StardogConnector("http://localhost:5820", "db", "admin", "admin");
// Servers are IDisposable so either wrap usage in a using block or remember to call Dispose() when done
// Connect to the server
using (StardogServer stardogServer = new StardogServer("http://localhost:5820", "admin", "admin"))
{
// Create a template for configuring our desired options
BaseStardogTemplate template = new StardogDiskTemplate("id");
template.IcvEnabled = true;
template.IcvReasoningMode = StardogReasoningMode.QL;
// Servers are IDisposable so either wrap usage in a using block or remember to call Dispose() when done
// Connect to the server
using (StardogServer stardogServer = new StardogServer("http://localhost:5820", "admin", "admin"))
{
// Create a template for configuring our desired options
BaseStardogTemplate template = new StardogDiskTemplate("id");
template.FullTextSearch = true;
template.DurableTransactions = true;
// Servers are IDisposable so either wrap usage in a using block or remember to call Dispose() when done
// Connect to the server
using (StardogServer stardogServer = new StardogServer("http://localhost:5820", "admin", "admin"))
{
// Get a default template for creating a DB with the given ID
IStoreTemplate template = stardogServer.GetDefaultTemplate("id");
// A true return indicates the DB was successfully created
if (stardogServer.CreateStore(template))