Skip to content

.NET object-graph-mapper for Apache TinkerPop™ Gremlin enabled databases.

License

Notifications You must be signed in to change notification settings

SyntaxUnknown/ExRam.Gremlinq

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExRam.Gremlinq is a .NET object-graph-mapper for Apache TinkerPop™ Gremlin enabled databases.

Packages

Package Link
ExRam.Gremlinq.Core #
ExRam.Gremlinq.Providers.WebSocket #
ExRam.Gremlinq.Providers.CosmosDb #

Sample project

A sample project can be found at https://github.com/ExRam/ExRam.Gremlinq.Samples.

Features

Build strongly typed gremlin queries

var persons = await g
    .V<Person>()
    .Where(x => x.Age == 36)
    .ToArray();

var person = await g
    .AddV(new Person { Age = 36 })
    .First();

Inheritance support

var animals = await g
    .V<Animal>()
    .ToArray();     // Gets vertices of type 'Cat' or 'Dog' if they inherit from 'Animal'

Deal with anonymous traversals, continuation passing style

var edge = await g
    .AddV<Person>()
    .AddE<WorksAt>()
    .To(__ => __
        .AddV<Company>())
    .First();

The fluent api remembers in- and out-vertices

var person = await g
    .AddV<Person>()
    .AddE<WorksAt>()
    .To(__ => __
        .AddV<Company>())
    .OutV()
    .First();

Navigate through the graph:

var employers = await g
    .V<Person>('bob')
    .Out<WorksAt>()
    .ToArray();

Deal easily with step labels, also continuation passing style

var tuples = await g
    .V<Person>('bob')
    .As((p, __ => __
        .Out<WorksAt>()
        .As((c, ___) => ___
            .Select(p, c)))
    .ToArray();

Support for complex boolean expressions

var persons = await g
    .V<Person>()
    .Where(x => x.Age == 36 && x.Name == "Bob")
    .ToArray();

var persons = await g
    .V<Person>()
    .Where(x => x.Age != 36)
    .ToArray();

var persons = await g
    .V<Person>()
    .Where(x => x.Age < 36 && x.Name == "Bob")
    .ToArray();

Support for string expressions

var persons = await g
    .V<Person>()
    .Where(x => x.Name.StartsWith("B"))
    .ToArray();

Support for Linq expressions

var persons = await g
    .V<Person>()
    .Where(x => x.Pets.Contains("Daisy"))
    .ToArray();

var persons = await g
    .V<Person>()
    .Where(x => x.Pets.Any())
    .ToArray();
    
var persons = await g
    .V<Person>()
    .Where(t => t.PhoneNumbers.Intersects(new[] { "+4912345", "+4923456" }))
    .ToArray();

var persons = await g
    .V<Person>()
    .Where(t => new[] { 36, 37, 38 }.Contains(t.Age))
    .ToArray();

Development

The library is still under development. The API might change without notice. Help on this project is greatly appreciated! Check out the issues labelled 'up-for-grabs' or file your own and tackle them!

Acknowledgements

The graphic on top of this page is a trademark of the Apache Software Foundation/Apache TinkerPop.

About

.NET object-graph-mapper for Apache TinkerPop™ Gremlin enabled databases.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%