下面的简单类不会显示为插件
package com.danmacias.neoneoteplugin;
import java.util.ArrayList;
import java.util.List;
import org.neo4j.graphdb.*;
import org.neo4j.server.plugins.*;
import org.neo4j.graphalgo.*;
//import org.neo4j.tooling.GlobalGraphOperations;
@Description( "An extension to the Neo4j Server for getting all nodes or relationships" )
public class GetPaths extends ServerPlugin
{
@Name( "breadth_first_paths" )
@Description( "Breadth First Traversal of a specific node." )
@PluginTarget( Node.class )
public Iterable<Path> getPaths( @Source Node graphDb )
{
ArrayList<Path> paths = new ArrayList<>();
return paths;
}
}
curl 返回
{
"extensions" : {
"GetAll" : {
"get_all_nodes" : "http://localhost:7474/db/data/ext/GetAll/graphdb/get_all_nodes"
}
...
},
但是当我用 GraphDatabaseService.class 替换 Node.class 的两个实例时,它可以很好地识别该插件。为什么它不接受节点?
此外,/var/logs/neo4j 没有显示与此相关的任何错误
最佳答案
不是 100% 确定,但我认为通过使用 @PluginTarget(Node.class)
锚定在节点级别的插件不会出现在全局扩展中。相反,当通过 REST API 检索节点时,有一个 extensions
block 以及引用基于节点的插件。
关于java - @PluginTarget(Node.class) 未注册为 neo4j 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26601202/