当您使用新的Windows安装程序安装1.9.4时,从何处启动Neo4j-Shell(之前在bin中找到)?
DETACH DELETE
在Neo4j 2.3.x中添加新Cypher运算符的行为和目的是什么?
如果我在Neo4j中有一组具有相同属性的节点,是否有办法将所有节点的某个属性的类型从字符串转换为int(反之亦然)?
例如,如果我想按名称获取用户列表:
class UserRepository extands GraphRepository<User> {
List<User> findByName(String name);
}
Run Code Online (Sandbox Code Playgroud)
那么如何将加载深度设置为2?
我试图在SDN 4.0.0.RC2文档中找到答案,但它没有包含有关此问题的任何内容.
语境:我正在开发一个由neo4j数据库支持的java Spring Boot系统.我使用"ClassRepo extends GraphRepository"结构访问数据库.编写查询是我的精确查询中硬编码的简单情况,并用提供的参数(在本例中为courseName)替换它的指定部分.
@Query("MATCH (node:Course) WHERE node.name = {courseName} RETURN node LIMIT 1")
Course findByName(@Param("courseName") String name);
Run Code Online (Sandbox Code Playgroud)
这对我来说都很好,让我可以毫无问题地返回一个或多个结果.然而,随着我的项目的发展,我现在提供了大量的搜索选项列表(分面搜索,思考亚马逊产品过滤器).为所选择的或未选择的过滤选项的每个排列编写静态密码查询似乎很愚蠢.
我的解决方案(尝试)是将部分查询作为参数传递,实质上是创建一个字符串查询构建器:
@Query("MATCH (course:Course) -[r]-> (description:CourseYearDescription) " +
"WITH course, count(description) as relationCount, collect(description) as descriptions " +
"WHERE relationCount > {numberOfYears} {returnCourse}")
Iterable<Course> findCourseWithNumberOfYears(
@Param("numberOfYears") int numberOfYears,
@Param("returnCourse") String returnCourse
);
Run Code Online (Sandbox Code Playgroud)
其中"returnCourse"是一个值为"RETURN course"的字符串.我知道在查询字符串中静态输入"RETURN课程"的事实.我刚删除它并将字符串值作为参数传递,以查看它是否可以生成相同的查询并在运行时运行它.
这没有真正的成功,让我回到错误页面并打印出以下堆栈:http://pastebin.com/J9VBfpxw
问题:是否有办法将字符串附加/插入到GraphRepository使用的密码查询字符串中,以便可以动态更改查询,即在运行时将where子句添加到匹配查询的末尾.
对于以下数据:
create (a:Attendee {name:'luanne'});
create (a:Attendee {name:'adam'});
create (a:Attendee {name:'christoph'});
create (a:Attendee {name:'vince'});
create (a:Attendee {name:'michal'});
Run Code Online (Sandbox Code Playgroud)
这个查询
MATCH p=(n:Attendee)-[r*0..1]-(m)
WITH p order by head(nodes(p)).name
return collect(distinct(p))
Run Code Online (Sandbox Code Playgroud)
当通过长度为1的shell返回路径执行时,按路径中第一个节点的名称排序.
但是,通过REST API:
POST http://localhost:7474/db/data/transaction/commit
{"statements":[
{"statement":"MATCH p=(n:`Attendee`)-[r*0..1]-(m) WITH p order by head(nodes(p)).name return collect(distinct(p))","parameters":{},"resultDataContents":["graph"]}
]}]}
Run Code Online (Sandbox Code Playgroud)
不维护相同的顺序(看起来它是由节点ID排序的).
如何修复我的Cypher给我与通过shell执行时相同的结果?
PS.如果resultDataContents是"row",并且在REST中没有使用COLLECT,则工作正常
我正在尝试创建新的Project并制作简单的类,Master和Pet类.
这是我的大师班
package com.david.duck.model;
import java.util.Set;
import org.neo4j.ogm.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
@NodeEntity
public class Master {
@GraphId
private long id;
private String name;
@Relationship(type="OWNS")
@JsonIgnore
private Set<Pet> pets;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<Pet> getPets() {
return pets;
}
public void setPets(Set<Pet> pets) {
this.pets = pets;
}
public Master(){
super();
}
} …
Run Code Online (Sandbox Code Playgroud) 我试图持久化一个类的对象列表,假设xyz。当我在NodeEntity类中执行此操作时:
@Property
List<xyz> listOfConditions
Run Code Online (Sandbox Code Playgroud)
通过Neo4jOperations.load(entity)方法从neo4j数据库加载Node表时,将返回错误消息:-将GraphModel映射到NodeEntity类型类时出错。
有什么方法可以将对象列表持久保存到Neo4j的节点属性上吗?我正在使用neo4j-ogm嵌入式驱动程序和Spring-data-neo4j。
目前实施的是
MATCH (emp:Employee)
WHERE emp.name = 'Abc'
RETURN emp
Run Code Online (Sandbox Code Playgroud)
是否有可能有一个类似的条款,例如
MATCH (emp:Employee)
WHERE emp.name Like %'Abc'%
RETURN emp
Run Code Online (Sandbox Code Playgroud)
就像我们在SQL中的方式一样?
我的非托管服务器扩展使用slf4j-log4j日志记录.当log4j.properties与扩展捆绑在一起时,日志记录工作正常.当它没有捆绑但是放在Neo4j的conf目录中时,我假设了
wrapper.java.additional=-Dlog4j.configuration=file:conf/log4j.properties
Run Code Online (Sandbox Code Playgroud)
来自neo4j-wrapper.conf
将确保它被拿起.但是,我没有看到正在创建的日志文件或正在使用的指定日志级别.配置文件必须正确,因为它与扩展捆绑在一起时按设计工作.添加-Dlog4j.debug
在其他职位建议增加没有进一步的信息.
有没有我错过的东西?我在Mac OS X上使用Neo4j 2.1.3