Git Product home page Git Product logo

Comments (4)

sbelak avatar sbelak commented on August 19, 2024

Have you given any thought how match should look? I'm thinking something along the lines of:

(q/query 
  ...
  (q/match :a
    :a (-> (q/out :created) (q/as :b))
    :b (q/has :name "lop")
    :b (-> (q/in :created) (q/as :c))
    :c (q/has :age 29))
  (q/select :a :c)
  ...)

(ie. modeled after core/cond->)

from ogre.

spmallette avatar spmallette commented on August 19, 2024

That's pretty. Watching this issue in TP3 for resolution might be good:

https://github.com/tinkerpop/tinkerpop3/issues/463

Discussion around the java/groovy representation of match

from ogre.

sbelak avatar sbelak commented on August 19, 2024

That thread looks like tacit endorsement for having a language with macros.
It did however emphasize the importance of as, so this might be better:

(q/query 
  ...
  (q/match :a
    :a [(q/out :created) :as b]
    :b (q/has :name "lop")
    :b [(q/in :created) :as :c]
    :c (q/has :age 29))
  (q/select :a :c)
  ...)

This one is nice for short match statements, but I still prefer my original suggestion, as I feel it's closer to idiomatic Clojure, while the latter is more of a DSL (I still tried to follow look and feel of ns macro).

from ogre.

spmallette avatar spmallette commented on August 19, 2024

Ultimately I implemented this pretty directly as:

clojurewerkz.ogre.core=> (traverse g V (match
                    #_=>   (__ (as :a) (out :created) (as :b))
                    #_=>   (__ (as :b) (has :name "lop"))
                    #_=>   (__ (as :b) (in :created) (as :c))
                    #_=>   (__ (as :c) (has :age 29)))
                    #_=>   (select :a :c) (by :name)
                    #_=>   (into-seq!))
({"a" "marko", "c" "marko"} {"a" "josh", "c" "marko"} {"a" "peter", "c" "marko"})

If there can be improvements, let's open a fresh issue.

from ogre.

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.