Azure-cosmos-dotnet-v2: Better type-safe APIs for Gremlin

Created on 11 May 2017  路  13Comments  路  Source: Azure/azure-cosmos-dotnet-v2

Hello guys,

With the recent announcement of CosmosDB which includes Gremlin APIs, is there any plan to have a more fluent/linq/lambda-friendly APIs on .Net SDK?

I'm looking at this sample https://github.com/Azure-Samples/azure-cosmos-db-graph-dotnet-getting-started/tree/master/GraphGetStarted from docs, and the Gremlin queries are fully string-based.

I could contribute that to a package like Microsoft.Azure.Graphs.Extensions or something like that.

I know that lambda/linq syntax don't map 100% to the the Gremlin one.

So the idea would be translate:

g.addV('person').property('id', 'thomas').property('firstName', 'Thomas').property('age', 44)"

to something like that:

graph.Vertice<Person>().Property(p => p.Id == "thomas").Property(p => p.FirstName == "thomas").Property(p => p.Age == 44);

That would internally build the proper Gremlin query string and send to CosmosDB.

What do you guys think?

Thanks

backlog graph

All 13 comments

I don't trust myself with strings! I have a documentdb database where i am mimiking a graph db and using linq to query. Migrating to the graph model completely would be a step in the right direction but string queries were a deal breaker. Let me know what I can do to help

I would also be willing to lend a hand.

Thank you for the feedback! We are indeed looking at fluent style / LINQ approach, closer to groovy but preserving .NET flavor.

Please create an item and vote here - https://feedback.azure.com/forums/263030-documentdb

-Shireesh

@shireeshkthota that means this SDK will not be OSSed and we can't contribute, right?

Hey Folks. Any update on that matter?

If you just need a graph anywhere, SqlServer now has graph features and limited Entity Framework compatibility. EF only works for CRUD, not graph features.

@farlee2121 thanks for the reply but no, SQL is not an option.

Hello @galvesribeiro! We are currently working on improving the compatibility with Gremlin Language Variants that would basically enable type safe usage of Gremlin in apps.

@LuisBosquez do you have any ETA? We are almost one year with the product released and still no support for .net basic features like lambda or even typesafe :(

Hey, as I understand Microsoft now recommends to use Gremlin.NET which already have a fluent API. But the fluent traversal API doesn't work because Cosmos DB doesn't support Gremlin Bytecode yet. So I suggested a new idea, see: https://feedback.azure.com/forums/263030-azure-cosmos-db/suggestions/33632779-support-gremlin-bytecode-to-enable-the-fluent-api

For a type safe object-graph-mapper with a binding for CosmosDb, check out this sample project: https://github.com/ExRam/ExRam.Gremlinq.Samples.

Disclaimer: I am the author of ExRam.Gremlinq.

@danielcweber good work man!

That is somehow the experience I wanted for it.

Nonetheless, I still think it is something that should be provided by CosmosDB team...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cgelon picture cgelon  路  7Comments

ChristopherHaws picture ChristopherHaws  路  4Comments

wingfeng picture wingfeng  路  8Comments

bowen5 picture bowen5  路  4Comments

felschr picture felschr  路  5Comments