Code Monkey home page Code Monkey logo

Comments (18)

mcollina avatar mcollina commented on June 27, 2024

I have looked at https://github.com/entrendipity/gremlin-node and I did not like the code, and how it has been written: it's full of *Sync stuff.
Node.js needs a different API, with a pure-async approach.
That's why It's really impossible to follow Gremlin closely in node.js.
I am trying to follow a similar approach though, look at #4.
I am looking for feedback in this area, if things became nice, we can look for standardizing it in its own package.

There is one more little problem: Gremlin treats "vertexes" as special entities, while in LevelGraph they do cannot exists on their own: Vertexes are only part of a graph.

Adopting the Gremlin approach to graph traversal would enhance the awesomeness of Levelgraph as a performant backend for Node. My assessment of graphDB alternatives for Node is that there are few high speed options (i.e., those not accessing the graphdb via REST). Levelgraph could fill this void.

That's the problem I am trying to solve :).

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

yes, their Java (sync) mentality is a problem - but would be great to overcome with an async streaming approach (which is what you are working toward). It is a tough problem to implement Gremlin in an async world. The ability to have vertex and edge attributes can be problematic - maybe a clever solution could be developed.

Another possible alternative might be cypher (neo4j). They are about to roll out "labeling" (another layer of indexing) which I believe will be very useful in the practical graph world: http://blog.neo4j.org/2013/04/nodes-are-people-too.html http://bambuser.com/v/3461834

The cypher syntax (Neo4j) is focused on getting data rather how to get data (like Gremlin) and is pretty powerful. Maybe this would be better approach (and a more straightforward async implementation)...

from levelgraph.

mcollina avatar mcollina commented on June 27, 2024

@Marketcentric exactly.

Could you please take some time to review #4?

Moreover, what are the most used features of Gremlin that I should port here?

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

ahh, sorry I did not look at it in detail (and sorry for closing this too ... I have not left a comment before).

This looks great. I like the suggestions in the thread.

One of the most important features I think in gremlin is pattern matching (http://markorodriguez.com/2011/06/15/graph-pattern-matching-with-gremlin-1-1/) . I think your inclusion of variables in the fluent chain is a step in the right direction to achieving this. Some of Marko's pattern matching examples should be easy to implement - while others may be more difficult (i.e., recursion). I am not sure what is important here and what is not - I will have to think about it.

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

I have a couple of examples written in iGraph (python) that I can port to use as examples here - when ready

from levelgraph.

mcollina avatar mcollina commented on June 27, 2024

That can me super-nice. Chek out the latest changes in the fluent API pull-request, and let me know if you need something more.

It's still a work in progress, though.

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

yes, good stuff! How can we do the "table" interim storage in Gremlin?

from levelgraph.

mcollina avatar mcollina commented on June 27, 2024

It's not that hard. I hope I'll work on it this evening :).

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

Great!

from levelgraph.

mcollina avatar mcollina commented on June 27, 2024

Hi @Marketcentric, the 'gremlin style' API is published on NPM.
Let me know how your experiments go.

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

Great. Will do. I look forward to it.

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

Hi @mcollina, have you given some thought to how properties might be assigned, used or queried such as commonly found in Directed Property Graphs? or should every vertex property be made into a separate node? Also, I find edge properties to be very useful. Any clever thoughts?

from levelgraph.

mcollina avatar mcollina commented on June 27, 2024

There is no storage of a 'node' in LevelGraph, it knows only about triples. So, in order to create some properties you have to define them through triples. However, it should also be possible to store the properties directly in the key-value store.

As for other methods, what do you need? Grouping? Counting? If you can make some example, I'll try to add the support for them.

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

yes, my thoughts are that using a clever approach, the properties could be represented as triples pointing to the vertex, such as "member_of" predicate. I we can then use them in queries where the "member_of" properties are handled in the background. Something to think about.

Grouping, counting...not sure yet. "Neighbors" would be handy (for a given vertex return a list of connected vertices). "Incident" is also handy (all the edges for a given vertex) - in a triple these two would most likely be the same. FYI - here is a list of methods I use with iGraph (http://igraph.sourceforge.net/doc/python/igraph.GraphBase-class.html) - 99% are specialized but interesting none the less.

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

fyi - http://tm.durusau.net/?p=41113

from levelgraph.

mcollina avatar mcollina commented on June 27, 2024

yes, my thoughts are that using a clever approach, the properties could be represented as triples pointing to the vertex, such as "member_of" predicate. I we can then use them in queries where the "member_of" properties are handled in the background. Something to think about.

Yes, but for me it's another lib.
It should be feasible to implement an ORM-like library on top of LevelGraph.

Grouping, counting...not sure yet. "Neighbors" would be handy (for a given vertex return a list of connected vertices). "Incident" is also handy (all the edges for a given vertex) - in a triple these two would most likely be the same. FYI - here is a list of methods I use with iGraph (http://igraph.sourceforge.net/doc/python/igraph.GraphBase-class.html) - 99% are specialized but interesting none the less.

You can easily get the 'Neighbors' and "Incident" using a basic get:

db.get({ subject: "myvertext" }, function (err, results) { .... });
db.get({ object: "myvertext" }, function (err, results) { .... });

I think all the basic operators are there, but a nicer and better-documented API is needed.

from levelgraph.

Marketcentric avatar Marketcentric commented on June 27, 2024

Thanks for the .get -> neighbors relationship (I should have thought more about this before asking)

from levelgraph.

mcollina avatar mcollina commented on June 27, 2024

I am closing this as there is not much more discussion on this issue.

@Marketcentric if you have more question, feel free to reopen!

from levelgraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.