Announcement Announcement Module
Collapse
No announcement yet.
SDG: Problem with Neo4j REST server and Partial NodeEntities (cross-store) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:

    Code:
    // Class have been changed to protect the innocent.
    Entity i = entityDao.findById(1);
    i.persist();
    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:
    Code:
    index/node/Entity/foreignId?query=com.sesamestreet.domain.Entity%3A3
    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:
    Code:
    index/node/Entity/foreignId/com.sesamestreet.domain.Entity%3A3
    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

    Comment


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

      Code:
      ==> 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(IndexType.java:285)", "org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:207)", "org.neo4j.server.rest.web.DatabaseActions.getIndexedNodesByQuery(DatabaseActions.java:863)", "org.neo4j.server.rest.web.DatabaseActions.getIndexedNodesByQuery(DatabaseActions.java:847)", "org.neo4j.server.rest.web.RestfulGraphDatabase.getIndexedNodesByQuery(RestfulGraphDatabase.java:634)", "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)", "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)", "java.lang.reflect.Method.invoke(Method.java:616)", "com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:184)", "com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)", "com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:276)", "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)", "com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)", "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)", "com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)", "com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1171)", "com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1103)", "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1053)", "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1043)", "com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:406)", "com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:477)", "com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662)", "javax.servlet.http.HttpServlet.service(HttpServlet.java:820)", "org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)", "org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)", "org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)", "org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)", "org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)", "org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)", "org.mortbay.jetty.Server.handle(Server.java:326)", "org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)", "org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)", "org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)", "org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)", "org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)", "org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)", "org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)" ]
      ==> }

      Comment


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

        Comment


        • #5
          The current version of Neo4j is hosted at http://github.com/springsource/spring-data-neo4j.

          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.

          Michael

          Comment


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

            Thanks.

            Comment


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

              Thanks

              Comment


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

                Comment


                • #9
                  Just git clone git://github.com/SpringSource/spring-data-neo4j.git

                  And issue mvn clean install with mvn2.

                  Thanks

                  Michael

                  Comment

                  Working...
                  X