Blazegraph connector using dotNetRDF
REST Endpoint |
Call / parameters |
dotNetRDF |
|
QUERY |
GET Request-URI ?query=... |
+ |
|
POST Request-URI ?query=... |
+ |
||
parameters |
timestamp |
+ |
|
explain |
- |
||
analytic |
- |
||
default-graph-uri |
- |
||
named-graph-uri |
- |
||
format |
- |
||
baseURI |
- |
||
includeInferred |
- |
||
timeout |
- |
||
${var}=Value |
- |
||
headers |
X-BIGDATA-MAX-QUERY-MILLIS |
+ |
|
INSERT |
|||
INSERT RDF (POST with Body) |
POST Request-URI |
- |
|
INSERT RDF (POST with URLs) |
POST Request-URI ?uri=URI |
- |
|
DELETE |
|||
DELETE with Query |
DELETE Request-URI ?query=... |
- |
|
DELETE with Body (using POST) |
POST Request-URI ?delete |
- |
|
UPDATE |
|||
UPDATE |
POST Request-URI ?update=... |
- |
|
parameters |
using-graph-uri |
- |
|
using-named-graph-uri |
- |
||
UPDATE (DELETE + INSERT) |
PUT Request-URI ?query=... |
+ |
|
UPDATE |
POST Request-URI ?updatePost |
+ |
|
Multi-Tenancy API |
|||
DESCRIBE DATA SETS |
GET /bigdata/namespace |
- |
|
CREATE DATA SET |
POST /bigdata/namespace |
- |
|
DESTROY DATA SET |
DELETE /bigdata/namespace/NAMESPACE |
- |
|
Transaction Management API |
|||
POST /bigdata/tx => txId |
+ |
||
COMMIT-TX |
POST /bigdata/tx/txid?COMMIT |
+ |
|
LIST-TX |
GET /bigdata/tx |
- |
|
CREATE-TX |
POST /bigdata/tx(?timestamp=TIMESTAMP) |
+ |
|
STATUS-TX |
POST /bigdata/tx/txId?STATUS |
- |
|
ABORT-TX |
POST /bigdata/tx/txId?ABORT |
+ |
|
PREPARE-TX |
POST /bigdata/tx/txId?PREPARE |
- |
|
Access Path Operations |
|||
FAST RANGE COUNTS |
GET Request-URI ?ESTCARD&([s|p|o|c]=(uri|literal))[&exact=(true|false)+ |
- |
|
HASSTMT |
GET Request-URI ?HASSTMT&([s|p|o|c]=(uri|literal))[&includeInferred=(true|false)+ |
- |
|
GETSTMTS |
GET Request-URI ?GETSTMTS |
- |
|
POST Request-URI ?GETSTMTS |
- |
||
DELETE with Access Path |
DELETE Request-URI ?([s|p|o|c]=(uri|literal))+ |
only c param |
|
STATUS |
GET /status |
- |
|
CANCEL |
POST /bigdata/sparql/?cancelQuery&queryId=.... |
- |
Download dll’s from the link and add to the project or include them by the NuGet. Look at the https://bitbucket.org/dotnetrdf/dotnetrdf/wiki/User%20Guide dotNetRDF documentation.
Examples of using Blazegraph connector:
BlazegraphConnector connector = new BlazegraphConnector("http://localhost:9999/bigdata/");
Graph newGraph = new Graph(); newGraph.BaseUri = UriFactory.Create("http://example/bookStore");
Triple triple = new Triple( newGraph.CreateUriNode(UriFactory.Create("http://example/book1")), newGraph.CreateUriNode(UriFactory.Create("http://example.org/ns#price")), newGraph.CreateLiteralNode("42", new Uri(XmlSpecsHelper.XmlSchemaDataTypeInteger)) ); newGraph.Assert(triple);
connector.SaveGraph(newGraph);
Graph loadGraph = new Graph(); connector.LoadGraph(loadGraph, UriFactory.Create("http://example/bookStore"));
Triple triple2remove = new Triple( newGraph.CreateUriNode(UriFactory.Create("http://example/book1")), newGraph.CreateUriNode(UriFactory.Create("http://example.org/ns#price")), newGraph.CreateLiteralNode("42", new Uri(XmlSpecsHelper.XmlSchemaDataTypeInteger)) ); Triple triple2add = new Triple( newGraph.CreateUriNode(UriFactory.Create("http://example/book1")), newGraph.CreateUriNode(UriFactory.Create("http://purl.org/dc/elements/1.1/title")), newGraph.CreateLiteralNode("Fundamentals of Compiler Design", new Uri(XmlSpecsHelper.XmlSchemaDataTypeString)) ); connector.UpdateGraph( UriFactory.Create("http://example/bookStore"), new List() { triple2add }, new List() { triple2remove } );
connector.DeleteGraph(UriFactory.Create("http://example/bookStore"));
SparqlResultSet resultSet = (SparqlResultSet)connector.Query("SELECT * { ?s ?p ?o }"); foreach (SparqlResult result in resultSet.Results) { Console.WriteLine(result.ToString()); }