Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正在试用neo4j grails插件,但它不会影响文档_Grails_Neo4j_Gorm - Fatal编程技术网

正在试用neo4j grails插件,但它不会影响文档

正在试用neo4j grails插件,但它不会影响文档,grails,neo4j,gorm,Grails,Neo4j,Gorm,我正在尝试neo4j插件,我创建了一个简单的测试,如下所示: package com.iibs.graph import groovy.util.GroovyTestCase import com.iibs.graph.Node public class NodeTests extends GroovyTestCase { void testCRUD() { Node.deleteAll(Node.list()) Node node = new N

我正在尝试neo4j插件,我创建了一个简单的测试,如下所示:

package com.iibs.graph

import groovy.util.GroovyTestCase
import com.iibs.graph.Node

public class NodeTests extends GroovyTestCase {

    void testCRUD() {
        Node.deleteAll(Node.list())

        Node node = new Node(name: "Name")

        node.save(flush: true, failOnError: true)

        Node found = Node.findByName("Name")

        assert found instanceof Node
        assert found.getName() == "Name"

        assert found.node instanceof org.neo4j.graphdb.Node 
    }
}
根据文件: 预计该测试将顺利通过,但我发现以下错误:

| Failure:  testCRUD(com.iibs.graph.NodeTests)
|  Assertion failed: 
assert found.node instanceof org.neo4j.graphdb.Node
       |     |    |
       |     null false
       com.iibs.graph.Node(Name)
    at com.iibs.graph.NodeTests.testCRUD(NodeTests.groovy:20)
    at junit.framework.TestCase.runTest(TestCase.java:176)
    at junit.framework.TestCase.runBare(TestCase.java:141)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:129)
    at junit.framework.TestSuite.runTest(TestSuite.java:255)
    at junit.framework.TestSuite.run(TestSuite.java:250)
| Completed 1 integration test, 1 failed in 0m 1s
我是否以错误的方式使用API

另外,如果我将最后一个断言行更改为:

assert found.getNode() instanceof org.neo4j.graphdb.Node 
错误是不同的:

Failure:  testCRUD(com.iibs.graph.NodeTests)
|  groovy.lang.MissingMethodException: No signature of method: com.iibs.graph.Node.getNode() is applicable for argument types: () values: []
Possible solutions: getName(), getId(), setName(java.lang.String), getMongo(), getAll(), getCount()
    at com.iibs.graph.NodeTests.testCRUD(NodeTests.groovy:20)
    at junit.framework.TestCase.runTest(TestCase.java:176)
    at junit.framework.TestCase.runBare(TestCase.java:141)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:129)
    at junit.framework.TestSuite.runTest(TestSuite.java:255)
    at junit.framework.TestSuite.run(TestSuite.java:250)
| Completed 1 integration test, 1 failed in 0m 2s
如错误所示,建议的解决方案之一是使用getMongo。这和mongo有什么关系。这是我的实体:

package com.iibs.graph

import groovy.transform.ToString;


@ToString(includes='name')
class Node {

    String name

    static mapWith = "neo4j"

    static constraints = {
    }
}

谢谢,

插件的文档还没有更新到2.x版本-这是第一个里程碑


简言之,域实例不再具有
节点
属性,因为我们只在内部依赖Cypher。域实例的
id
属性指的是图中节点上的
\uuuu id\uuuu
属性。

您正在使用哪个版本的插件?最新里程碑:compile:neo4j:2.0.0-M01“OK,有意义。如何访问节点上的hasRelationship等功能?目的是只使用较低级别的API吗?或者换句话说,如何获取实际节点?您可以执行
instance.cypher('MATCH(self)-(related)WHERE self.\uuuu id\uuu={this}RETURN related',[:])
我创建了一个新线程,因为问题与此主题没有直接关系: