Giter VIP home page Giter VIP logo

ex-cypher's People

Contributors

gleopoldo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

olivbak kenichi

ex-cypher's Issues

Fix syntax for nodes/relations with multiple labels

Motivation

We need to change the syntax for nodes or relations with multiple labels to separate them with a pipe | instead of a comma , as it's being done currently. This is compliant with the cypher docs, and thus is believed to be the most recent and supported syntax.

Add support to complex variables binding inside queries

Motivation

It'll be awesome to have support for maps inside queries. Something like this:

person = %{name: "bob", age: 12}
cypher do
  match node([:Person], %{name: person.name, age: person.age})
end

This should return the following match query:

MATCH (:Person {name:"bob",age:12})

Add support to merging relations

We need to add support to merging relations instead of only nodes.

This example might be satisfied by the implementation:

  iex> cypher do
  ...>   merge node(:p, [:Player], %{nick: "like4boss"})
  ...>   merge node(:p2, [:Player], %{nick: "marioboss"})
  ...>   merge node(:p) -- rel([:IN_LOBBY]) -> node(:p2)
  ...>   return "p.name"
  ...> end
  ~S|MERGE (p:Player {"nick":"like4boss"}) MERGE (p2:Player {"nick":"marioboss"}) MERGE (p)-[:IN_LOBBY]->(p2) RETURN p.name|

Change `WHERE` equality operator to `==`

We should avoid conflicting the original purpose of = in elixir (for binding and pattern matching) with the cypher's one (equality operator). WHERE statements should use elixir's == operator instead, in order to make equality comparisons in Cypher.

Provide more informative errors when building queries

The actual implementation of cypher macro allows very different combinations of cypher commands into the query, but provides little debug information when building invalid queries.

In this example below, the following command is invalid since where statements should be placed before the return statement. The corresponding error coming from the Bolt.Sips isn't helpful:

Example:

        query = cypher do
          match (node(:person, [:Person]) -- rel([:WORKS_IN]) -> node(:company, [:Company]))
          return person.name
          where company.name == "Acme"
          order {person.name, :asc}
        end

Running the code above, we get this:

%Bolt.Sips.Error{                                                                                                          
  code: "Neo.ClientError.Statement.SyntaxError",                                                                                                                                                                                              
  message: "Invalid input 'H': expected 'i/I' (line 1, column 74 (offset: 73))\n\"MATCH (person:Person)-[:WORKS_IN]->(company:Company) RETURN person.name WHERE company.name = \"Acme\" ORDER BY person.name ASC\"\n                          
                                                ^"                                                                                                                                                                                            
} 

One would expect to get a more informative error, such as:

{:error, "WHERE statements shouldn't come after RETURN statements."} = cypher do
  # ...
end

Improve query building to preserve the original types of some statements

Some statements that were originally integers or booleans are being converted when applying MERGE, MATCH or CREATE commands.

The only one that isn't converting stuff is the WHERE statement, that already manipulates the AST to provide support to more advanced matches. Maybe it could be a nice opportunity to merge both the relationship building logic with the Where's AST structure manipulation.

Bind variables from outer scopes

It would be nice to have the following example working:

      name = "sarah"
      query =
        cypher do
          match node(:p, [:Person])
          where p.name = name
          return p
        end

However, the name variable will be printed along with the cypher query. The expected result would be to include the "sarah" string in the query

Review the docs

A little review in the docs is needed in order to make it clearer and expose the API in a friendly format

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.