Coder Social home page Coder Social logo


maven code style
A powerful, flexible, lightning-fast graph query DSL

Features

  • Support popular graph query language (e.g. Cypher, nGQL, etc)
  • Out-of-the-box dsl interfaces for operate graph database.
  • Powerful and flexible predicate/selection/traversal/mutation conditional wrapper.
  • Lambda-style API Lambda

Getting started

Prepare dependency

Inclusion of the Cypher-DSL in a Maven project

<dependency>
  <groupId>io.github.maple-dsl</groupId>
  <artifactId>maple-dsl-cypher</artifactId>
  <version>1.0.3</version>
</dependency>

Inclusion of the Nebula-DSL in a Maven project

<dependency>
  <groupId>io.github.maple-dsl</groupId>
  <artifactId>maple-dsl-nebula</artifactId>
  <version>1.0.3</version>
</dependency>

How to use

Set up domain entities(vertex&edge)

@Label("actor")
class Actor extends Model.V<String> {
  private String name;
}

@Label("movie")
class Movie extends Model.V<String> {
  @Property("movie_name")
  private String name;
  @Property("movie_released")
  private Integer released;
}

@Label("acted_in")
class ActedIn extends Model.E<String,String> {

}

List all Tom Hanks movies released in the 1990s

var match = G.vertex(Actor.class).eq(Actor::getName, "Tom Hanks");
var statement = G.traverse(match)
    .outE(ActedIn.class)
    .outV("tomHanksMovies", Movie.class, it -> it
      .gte(Movie::getReleased, 1990)
      .lt(Movie::getReleased, 2000)
      .select(Movie::getReleased)
      .selectAs(Movie::getName, "movie_name"))
    .render();

or List all the actors that acted with Tom Hanks movies released in the 1990s

statement = G.traverse(match)
    .outE(ActedIn.class)
    .outV("tomHanksMovies", Movie.class, it -> it
      .gte(Movie::getReleased, 1990)
      .lt(Movie::getReleased, 2000)
      .select(Movie::getReleased)
      .selectAs(Movie::getName, "movie_name"))
    .inE(ActedIn.class)
    .outV("otherActors", Actor.class, TraversalStep.Step::selectAll)
    .render();

maple-dsl's Projects

maple-dsl icon maple-dsl

The Best GraphLanguage DSL(e.g. Cypher, Gremlin, nGQL)

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.