0
我试图通过可变数量的成对参数功能forTypesAndDirection运气不大。尝试下面的方式...任何想法?将多个参数传递给Neo4j中的forTypesAndDirections函数
// The relationships we will follow
RelationshipType isa = DynamicRelationshipType.withName("is_a");
RelationshipType partof = DynamicRelationshipType.withName("part_of");
Object[] relations = new Object[4];
relations[0] = isa;
relations[1] = Direction.OUTGOING;
relations[2] = partof;
relations[3] = Direction.OUTGOING;
maxdistance = shortestDistance(node1, node2, 1000, relations);
...
private Integer shortestDistance(Node source, Node target, Integer depth, Object... relations) {
PathFinder<org.neo4j.graphdb.Path> finder = GraphAlgoFactory.shortestPath(PathExpanders.forTypesAndDirections(relations), depth);
...
}
错误消息:
[ERROR] ...:[441,105] method forTypesAndDirections in class org.neo4j.graphdb.PathExpanders cannot be applied to given types;
required: org.neo4j.graphdb.RelationshipType,org.neo4j.graphdb.Direction,org.neo4j.graphdb.RelationshipType,org.neo4j.graphdb.Direction,java.lang.Object[]
found: java.lang.Object[]
reason: no instance(s) of type variable(s) STATE exist so that argument type java.lang.Object[] conforms to formal parameter type org.neo4j.graphdb.RelationshipType
谢谢!那么我会这样管理! –