Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Eve Freeman
@freeeve
and installs neo, and runs our tests
Ben
@bmsherman
Where does it live?
Eve Freeman
@freeeve
in travis land
Ben
@bmsherman
And they do this for no charge?
Eve Freeman
@freeeve
open source love
Ben
@bmsherman
Wow
Eve Freeman
@freeeve
it tells travis what to do
Ben
@bmsherman
Wow that looks painful. No wonder it takes 8 minutes to compile and test!
Eve Freeman
@freeeve
yeah, I couldn't figure out a way to cache it
Eve Freeman
@freeeve
I'll try to get some data in travis so your query works
Eve Freeman
@freeeve
@bmsherman does EMinus (EProp n "score") (EProp m "score") need to wrap the props in parens? "(n.score) - (m.score)"
in real cypher you can just do n.score - m.score
is it defensive for infix in other cases or something?
Eve Freeman
@freeeve
also, my chess data might make sense if you check out my design gist: http://gist.neo4j.org/?6506717
it's not quite the same, but I've got my server crunching on deepening the analysis
Eve Freeman
@freeeve
@bmsherman let me know if you want me to merge my PR in... the build fails due to lack of data, but it's got the update cabal stuff and renamed test. I guess it doesn't matter too much as long as you don't tweak that stuff in the meantime. didn't quite get a script to add chess data last night, but I'll fix it tonight
Eve Freeman
@freeeve
@bmsherman I think we need a queryDB that takes a QueryString instead of a Query; maybe additionally? What do you think? Or maybe queryDBRaw should output QueryResult and accept a QueryString...
Ben
@bmsherman
@wfreeman That is a super-cool gist! I honestly don't really care about the tests. I just wrote that example to, well, test what I wrote, and so I realized that the Wes Freeman school of engineering probably says I should make that a test.
@wfreeman Yep, I think it would be good to have one strongly typed function that looks like Query xs -> NeoIO (HList Value xs), and one weakly-typed one which looks like QueryString -> NeoIO [[DValue]] or something like that.
I'll admit, though, that I really don't care too much about the particulars of the API. I'll let others sort that out, I think
Yes, the parentheses are defensive! Right now I do absolutely no tracking of "state" within the query, and so without the parens, if I wrote EMinus a (EPlus b + c), it would look like "a - b + c". With the parens, it's "(a) - ((b) + (c))". Obviously, neither is ideal, and it would be good for somebody actually, you know, do it right!
Ben
@bmsherman
I just added a branch where I started putting in code for parsing Cypher. We're using Alex/Happy!
It's not in master because it's extremely incomplete and there are a lot of warnings and stuff...
Eve Freeman
@freeeve
cool! I'll check it out tomorrow.
Eve Freeman
@freeeve
so is alex like happy--you have to install it apart, as an executable? cabal-1.20: The program 'alex' is required but it could not be found
Eve Freeman
@freeeve
coincidentally I already installed happy on travis because of hlint
Ben
@bmsherman
@wfreeman Yep, Alex is just like Happy in that way
Eve Freeman
@freeeve
I got it to build, but it fails because of the warnings
Eve Freeman
@freeeve
@bmsherman I created some todo items for the http part--you might be better suited to create DSL todo items
Ben
@bmsherman
OK, I added my to-do items!
Eve Freeman
@freeeve
hey, it builds. should we merge it to master? :P
Ben
@bmsherman
Yeah, I just turned off warnings in Alex's output. Sure, why not!
Eve Freeman
@freeeve
@bmsherman can you give me an example of how to use the parser? like a basic parse function?
I was going to write some tests for it
Eve Freeman
@freeeve
it looks like travis's cabal executable name changed for some reason
nevermind. maybe it was just busted temporarily
Ben
@bmsherman
@wfreeman Here's an an example of using the parser: https://github.com/HaskellDC/neo4j-cypher/blob/master/Test.hs
Eve Freeman
@freeeve
cool thanks
Eve Freeman
@freeeve
handleSearch :: Snap ()
handleSearch =
  where
    query :: Query '[Str, Str, Number]
    query = [cypher |
      MATCH (movie:Movie)
      WHERE movie.title =~ {0}
      RETURN movie.title as title, movie.tagline as tagline, movie.released as released|]
Eve Freeman
@freeeve
    query :: Query '[Str, Str, Str, Str]
    query = [cypher|
      MATCH (movie:Movie {title:{0}})
      OPTIONAL MATCH (movie)<-[r]-(person:Person)
      WITH movie.title as title,
           collect({name:person.name,
                    job:head(split(lower(type(r)),'_')),
                    role:r.roles}) as cast
      LIMIT 1
      UNWIND cast as c
      RETURN title, c.name as name, c.job as job, c.role as role|]
    query :: Query '[Str, Collection Str]
    query = [cypher|
      MATCH (m:Movie)<-[:ACTED_IN]-(a:Person)
      RETURN m.title as movie, collect(a.name) as cast
      LIMIT {0}|]
Eve Freeman
@freeeve
thanks guys, was fun...
I just pushed fixes to the warnings I think
Eve Freeman
@freeeve
doh...
    Exception when trying to run compile-time code:
      Parse error: [Paren L,Operator "-",Int 3,Dot,Int 7,Paren R]
      Code: template-haskell:Language.Haskell.TH.Quote.quoteExp
              cypher " RETURN sign(-3.7)"
Eve Freeman
@freeeve
weird... this passes in 7.6 but not 7.8:
  matchComma:                 FAIL
    expected: "MATCH (n), (m) RETURN n, m"
     but got: "MATCH (n) , (m) RETURN n, m"
  matchSimpleRelPattern:      FAIL
    expected: "MATCH (n)--(m) RETURN n, m"
     but got: "MATCH (n)-[]-(m) RETURN n, m"
  matchSimpleRelLeftPattern:  FAIL
    expected: "MATCH (n)<--(m) RETURN n, m"
     but got: "MATCH (n)<-[]-(m) RETURN n, m"
  matchSimpleRelRightPattern: FAIL
    expected: "MATCH (n)-->(m) RETURN n, m"
     but got: "MATCH (n)-[]->(m) RETURN n, m"
  matchRelCommaPattern:       FAIL
    expected: "MATCH (n)-->(m), (o) RETURN n, m"
     but got: "MATCH (n)-[]->(m) , (o) RETURN n, m"
5 out of 6 tests failed (0.00s)
Alex Zhidkov
@AlexZhidkov
Hi all. I have (Person)-[:AVAILABLE_ON]->(DayOfWeek) and (Person)-[:LIKES]->(Activity) in my database. How to select all people available on the same day who like the same activity?