Code Monkey home page Code Monkey logo

Comments (7)

Kai-Chen avatar Kai-Chen commented on July 22, 2024

I believe you've observed what you described; there's no obvious reason to think otherwise. But something quite strange is going on here. This library is a very small and simple one, being essentially just a specific JSON mapper. So if the result is not in the original REST response, it's very hard to believe that the library would manufacture one out of nothing. Furthermore, if the library is consistently misbehaving like this, all our current tests would fail. But all the tests pass before we push a release out. Therefore, the cause is much more likely to be somewhere else, for example, in the environment you are running in.

The code that you've pasted in above actually won't work with 0.9.0. You need the following type annotation to bring in a required implicit conversion

 implicit val connection: Neo4jConnection = Neo4jREST()(wsclient)

This is actually my fault, as I didn't update README. I will do that right after this comment.

I would recommend running a separate neo4j-shell and verify that you don't have a rogue node created with the label anormcyphertest that doesn't have a name property.

from anormcypher.

emaung avatar emaung commented on July 22, 2024

Hi @Kai-Chen Sorry for late response.
I will try it again and more investigate further on this matter.
Thanks.

from anormcypher.

emaung avatar emaung commented on July 22, 2024

Hi @Kai-Chen So I tried that again and have the same issue. here is the exact code:

import org.anormcypher._
  import play.api.libs.ws._

  // Provide an instance of WSClient
  val wsclient = ning.NingWSClient()

  // Setup the Rest Client
  // Need to add the Neo4jConnection type annotation so that the default
  // Neo4jConnection -> Neo4jTransaction conversion is in the implicit scope
  implicit val connection: Neo4jConnection = Neo4jREST(host = "docker", username = "neo4j", password = "admin")(wsclient)

  // Provide an ExecutionContext
  implicit val ec = scala.concurrent.ExecutionContext.global

  // create some test nodes
  Cypher("""create (anorm:anormcyphertest {name:"AnormCypher"}), (test:anormcyphertest {name:"Test"})""").execute()

  // a simple query
  val req = Cypher("match (n:anormcyphertest) return n.name")

  // get a stream of results back
  val stream = req()

  // get the results and put them into a list
  stream.map(row => {row[String]("n.name")}).foreach(println)

  // remove the test nodes
  Cypher("match (n:anormcyphertest) delete n")()

  // shut down WSClient
  wsclient.close()

I got the following this UnexpectedNullableFound(n.name) exception.

If I used row[Option[String]], it worked and got following output;

Some(AnormCypher)
None
Some(Test)
None

I also made sure the db is empty before running the code above.
I am running neo4j 3.0.0 if that helps.

Cheers

from anormcypher.

Kai-Chen avatar Kai-Chen commented on July 22, 2024

I am running neo4j 3.0.0 if that helps.

Well, that's the cause. Neo4j 3.0.x has changed the REST response at the transaction endpoint. We can probably add a fix to handle that. However, the 3.0.x release also has a binary driver. So for your use case, it might be easier just to use the Java driver. I'm not sure if it provides non-blocking streaming, which might be the only reason left to use anormcypher in preference over the binary.

from anormcypher.

Kai-Chen avatar Kai-Chen commented on July 22, 2024

This simple query response is easy to fix for anorm to work with Neo4j 3. But quite a few other tests are failing. So to completely support Neo4j 3 may take a while; we will do a patch release when it's done.

from anormcypher.

Kai-Chen avatar Kai-Chen commented on July 22, 2024

The new release 0.9.1 should support Neo4j 3.0.

Cheers!

from anormcypher.

Kai-Chen avatar Kai-Chen commented on July 22, 2024

Closing since there is no further comments in the past month.

from anormcypher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.