Announcement Announcement Module
No announcement yet.
SDG: Problem with Neo4j REST server and Partial NodeEntities (cross-store) Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • SDG: Problem with Neo4j REST server and Partial NodeEntities (cross-store)

    I'm having a problem with using Partial NodeEntities and cross store persistence. Entities are primarily in JPA and Hibernate (in a mysql DB) and partially in the graph for relationships. The REST query that is run to populate the graph portion of the entity doesn't return a result. Therefore spring-data-graph creates a new graph node on every retrieval even though one was created on the initial persist.

    First, let me be sure I am doing this correctly. When I retrieve an entity, I have to call persist() on it (added via aspectj)? Like so:

    // Class have been changed to protect the innocent.
    Entity i = entityDao.findById(1);
    I should now have a fully populated entity if I read the documentation correctly.

    Here is the problem. When looking at the query on the neo4j index it looks like this:
    This returns an empty array. I have verified this in the debugger and running it by hand. However, I have discovered that I can get the node I'm looking for by finding it directly in the index:
    This gives me the fully populated array/json data I'm expecting. Am I doing something wrong? Is it a bug in spring-data-graph? Need more information?

    Thanks for your help.

  • #2
    Could you do me a favor and check if this query returns the values?

    index/node/Entity?query=foreignId:com.sesamestreet.domain.Ent ity%3A3


    • #3
      It appears that even though it's URL encoded, lucene doesn't like the colon separating the model and it's ID:

      ==> 500 Internal Server Error
      ==> {
      ==>   "message" : "org.apache.lucene.queryParser.ParseException: Cannot parse 'foreignId:com.sesamestreet.domain.Entity:2': Encountered \" \":\" \": \"\" at line 1, column 51.\nWas expecting one of:\n    <EOF> \n    <AND> ...\n    <OR> ...\n    <NOT> ...\n    \"+\" ...\n    \"-\" ...\n    \"(\" ...\n    \"*\" ...\n    \"^\" ...\n    <QUOTED> ...\n    <TERM> ...\n    <FUZZY_SLOP> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    \"[\" ...\n    \"{\" ...\n    <NUMBER> ...\n    ",
      ==>   "exception" : "java.lang.RuntimeException: org.apache.lucene.queryParser.ParseException: Cannot parse 'foreignId:com.sesamestreet.domain.Entity:2': Encountered \" \":\" \": \"\" at line 1, column 51.\nWas expecting one of:\n    <EOF> \n    <AND> ...\n    <OR> ...\n    <NOT> ...\n    \"+\" ...\n    \"-\" ...\n    \"(\" ...\n    \"*\" ...\n    \"^\" ...\n    <QUOTED> ...\n    <TERM> ...\n    <FUZZY_SLOP> ...\n    <PREFIXTERM> ...\n    <WILDTERM> ...\n    \"[\" ...\n    \"{\" ...\n    <NUMBER> ...\n    ",
      ==>   "stacktrace" : [ "org.neo4j.index.impl.lucene.IndexType.query(", "org.neo4j.index.impl.lucene.LuceneIndex.query(", "", "", "", "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "sun.reflect.NativeMethodAccessorImpl.invoke(", "sun.reflect.DelegatingMethodAccessorImpl.invoke(", "java.lang.reflect.Method.invoke(", "com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(", "com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(", "com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(", "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(", "com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(", "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(", "com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(", "com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(", "com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(", "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(", "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(", "com.sun.jersey.spi.container.servlet.WebComponent.service(", "com.sun.jersey.spi.container.servlet.ServletContainer.service(", "com.sun.jersey.spi.container.servlet.ServletContainer.service(", "javax.servlet.http.HttpServlet.service(", "org.mortbay.jetty.servlet.ServletHolder.handle(", "org.mortbay.jetty.servlet.ServletHandler.handle(", "org.mortbay.jetty.servlet.SessionHandler.handle(", "org.mortbay.jetty.handler.ContextHandler.handle(", "org.mortbay.jetty.handler.HandlerCollection.handle(", "org.mortbay.jetty.handler.HandlerWrapper.handle(", "org.mortbay.jetty.Server.handle(", "org.mortbay.jetty.HttpConnection.handleRequest(", "org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(", "org.mortbay.jetty.HttpParser.parseNext(", "org.mortbay.jetty.HttpParser.parseAvailable(", "org.mortbay.jetty.HttpConnection.handle(", "$", "org.mortbay.thread.QueuedThreadPool$" ]
      ==> }


      • #4
        Does this appear to be a bug?

        I was thinking about compiling a custom version of spring data graph and either changing the separator and/or escaping it to see what happens.


        • #5
          The current version of Neo4j is hosted at

          It has changed quite a lot in anticipation for SDN 2.0.

          I think I fixed your issue, i.e. doing the "get" index looking instead of forwarding it to query.

          Unfortunately there are some deployment issues, so that there is not current snapshot deployed.

          Could you build it on your own and try it out?

          Thanks so much.



          • #6
            I'll give it a shot. Is there a certain tag or branch I should build against?



            • #7
              Unfortunately it hasn't been deployed as snapshot, you you'd have to fetch it and build it on your own. I hope to get that fixed that tonight as it needs SpringSource staff care



              • #8
                Oh yeah. I meant to build it. Forget the question, when I saw the git repo I thought it was the same one I was looking at yesterday (I was looking at spring-data which has many tags).

                Are there build instructions somewhere? If not I may just hold off till the build process is fixed.

                Thanks for the help.


                • #9
                  Just git clone git://

                  And issue mvn clean install with mvn2.