Announcement Announcement Module
Collapse
No announcement yet.
Good Tutorial on writing traversal queries (language ref) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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, 11:26 AM. Reason: add

      Comment


      • #4
        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.

        Comment


        • #5
          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

          Comment


          • #6
            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

            Comment


            • #7
              Done

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

              Thanks Michael.

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

              Mark

              Comment


              • #8
                That would be awesome, thanks a lot!

                Michael

                Comment


                • #9
                  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

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      Bummer, the text portion is there, but the code isn't being displayed. I thought I got that correct too. ;( Will look into it tonight and fix it and make another pull request.

                      Mark

                      Comment


                      • #12
                        I think I corrected the issue. I am not using <variablelist> <varlistentry> tags anymore and just <example> and <programListing> tag with one big Repository.

                        I hope that works, it really does match what I saw in other sections.

                        Thanks

                        Mark

                        Comment

                        Working...
                        X