Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Good Tutorial on writing traversal queries (language ref)

  1. #1
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default Good Tutorial on writing traversal queries (language ref)

    I have to start writing some traversal queries and the Neo4J docs haven't helped. It is my fault that I don't understand the query language, so I was hoping someone might know a really good tutorial out there that fully explains the query language. All types of neo4j queries would be great, but mostly traversals.

    Thanks

    Mark

  2. #2
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    Do you mean the Spring Data Neo4j docs or the Neo4j docs?

    There is the Cypher Cookbook, the illustrated syntax docs and Alistair recorded a great introduction screencast on Cypher.

    Hope those help.

    I thought the SDN docs referred to those sources.

  3. #3
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    I had already looked at the docs, except the Cypher cookbook (Really cool it has hypervertex queries which I need), but the screencast is really good and helpful. So those queries as written work exactly in Spring Data Neo4J? I think I see differences between the Neo4j docs and the Spring Data Neo4j docs.

    Thanks for the links

    Mark
    Last edited by bytor99999; Feb 3rd, 2012 at 10:26 AM. Reason: add

  4. #4
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    Which differences have you seen? Except that SDN converts method parameters to indexed parameters in the query and adds the {self} parameter for computed fields, there should be no difference.

  5. #5
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    One difference I see has to do with parenthesis, needing them or not in the match clause.

    So in the Neo4J docs I see something along the lines of (I shortened it on purpose)

    start user:node(blah)
    match (user)-->(address)…..

    Whereas in the Spring Data Neo4J docs it would have something along the lines of

    @Query("start user:node(blah) match user-->address

    That confused me, now I think I see that both work, but it wasn't documented anywhere that both work. At least that I found.

    I think the Spring Data Neo4J docs need to show more examples of those method parameters to indexed parameters in action.

    So if I pass an id or I pass a Node, how do I know what to put in the "start" portion

    If I pass the Node into the repo, I use "start startNode:node({0})"
    But what if I pass the id instead, I don't think "start startNode:node({0})" would work. Or does the first automatically go into the Node object and get the nodeId and pass that in for {0}? If it does, I think that statement needs to be in the documentation.

    Other examples of how to get method parameters into the Match or where or orderby clauses too. I just can't amke any assumptions on how it works or I will spend hours and days trying to figure out what works and doesn't.

    I definitely can spend days maybe weeks trying to get all variations figured out and post a blog entry and update the docs myself, but I know you know this stuff down cold.

    Maybe you don't have the time and I should spend days and weeks figuring it out to help out.

    Thanks

    Mark

  6. #6
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    The parentheses are optional, just for readability. Only for empty identifiers you need them
    Code:
    me-->()<--other
    Can you create a docs issue or comment if there was an existing one, listing the types of examples for SDN that would be needed? (Keeping in mind that there are the other Neo4j based resources - docs, cookbook and screencast out there and we don't want to duplicate their content).

    Michael

  7. #7
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    Done

    https://jira.springsource.org/browse/DATAGRAPH-194

    Thanks Michael.

    I will probably write them myself and do a pull request.

    Mark

  8. #8
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    That would be awesome, thanks a lot!

    Michael

  9. #9
    Join Date
    Jan 2009
    Location
    Huntington Beach, CA
    Posts
    718

    Default

    The pull request is in.

    I am pretty sure I did the xml correct. Mostly looked at what was already there and copy pasted/mimicked it.

    I ran the .sh script but not sure if it put any docs anywhere where I could check to see that it looked right.

    I might do a couple of other corrections in the docs, like a few spelling errors in code.

    Thanks

    Mark

  10. #10
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    Has been built (http://spring.neo4j.org/nightly) already, can you check if it is correctly in there: http://spring.neo4j.org/docs

    Thanks for the offer.

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •