microsoft / GraphView

GraphView is a DLL library that enables users to use SQL Server or Azure SQL Database to efficiently manage graphs.
Other
530 stars 141 forks source link

GraphView

GraphView is a DLL library that enables users to use SQL Server or Azure SQL Database to manage graphs. It connects to a SQL database locally or in the cloud, stores graph data in tables and queries graphs through a SQL-extended language. It is not an independent database, but a middleware that accepts graph operations and translates them to T-SQL executed in SQL Server or Azure SQL Database. As such, GraphView can be viewed as a special connector to SQL Server/Azure SQL Database. Developers will experience no differences than the default SQL connector provided by the .NET framework (i.e., SqlConnection), only except that this new connector accepts graph-oriented statements.

Features

GraphView is a DLL library through which you manage graph data in SQL Server (version 2008 and onward) and Azure SQL Database (v12 and onward). It provides features a standard graph database is expected to have. In addition, since GraphView relies on SQL databases, it inherits many features in the relational world that are often missing in native graph databases.

GraphView offers the following major features:

Dependency

GraphView needs Microsoft.SqlServer.TransactSql.ScriptDom.dll. Download and install SQL Server Data Tools.

Build

Prerequisites

Build

Getting Started

GraphView is a DLL library. You reference the library in your application and open a graph database by instantiating a GraphViewConnection object with the connection string of a SQL database.

using GraphView;
......
string connectionString = "Data Source= (local); Initial Catalog=GraphTesting; Integrated Security=true;";
GraphViewConnection gdb = new GraphViewConnection(connectionString);
try {
  // Connects to a database. 
  gdb.Open(true);
}
catch(DatabaseException e) {
  // Exception handling goes here
}

When the connection string points to an Azure SQL Database instance, you open a graph database in Azure:

using GraphView;
......
var sqlConnectionBuilder = new SqlConnectionStringBuilder();
sqlConnectionBuilder["Server"] = "tcp:graphview.database.windows.net,1433";
sqlConnectionBuilder["User ID"] = "xxx";
sqlConnectionBuilder["Password"] = "xxx";
sqlConnectionBuilder["Database"] = "GraphTesting";
GraphViewConnection gdb = new GraphViewConnection(sqlConnectionBuilder.ToString());
try {
  gdb.Open(true);
}
catch(DatabaseException e) {
  // Exception handling goes here
}

Once you open a database, you send graph queries through the connector and retrieve results using the .NET standard data reader DataReader if needed.

try {
  gdb.Open(true);
  string queryString = "......";       // A graph query
  GraphViewCommand gcmd = new GraphViewCommand(queryString, gdb);
  DataReader dataReader = gcmd.ExecuteReader();
  While (dataReader.Read()) {
    // Retrieve results through DataReader
  }
  dataReader.Close();
  gcmd.Dispose();
  gdb.Close();
}

Please read the user manual for the full language specification, functionality and programming API's.

Get Help

User manual GraphView's user manual is the first place to get help. It introduces the full query language, functionality and programming API's. It also includes many code samples.

GitHub The GitHub repository contains a short introduction. You can use Github's issue tracker to report bugs, suggest features and ask questions.

Email If you prefer to talk to us in private, write to graphview@microsoft.com

Dev branches

License

GraphView is under the MIT license.