【发布时间】:2017-05-07 11:33:51
【问题描述】:
在我的 Cypher 查询中,我有以下模式理解:
[ (parentD)<-[:DEFINED_BY]-(ch1:Characteristic)<-[:SET_ON]-(v1:Value)-[:SET_FOR]->(childD) |
{characteristicId: id(ch1), value: v1.value, valueType: ch1.valueType, visualMode: ch1.visualMode} ] AS valuedCharacteristics
我已将 parentCharacteristic 添加到我的 SDN 4 Characteristic 实体:
@NodeEntity
public class Characteristic extends Votable {
private final static String DEPENDS_ON = "DEPENDS_ON";
@Relationship(type = DEPENDS_ON, direction = Relationship.OUTGOING)
private Characteristic parentCharacteristic;
...
}
现在我需要扩展我的模式理解并添加一个条件,以便返回与以前相同的 Characteristic 集,除了那些具有 parentCharacteristic != NULL 和模式理解的人也应该返回 Characteristic 具有 ID 在我将作为参数提供给此查询的 {includeCharacteristicIds} 集合。
为了避免所有Characteristic 没有孩子Characteristic 我添加了以下条件:
WHERE NOT ((ch1)<-[:DEPENDS_ON]-())
所以完整的模式理解现在看起来像:
[ (parentD)<-[:DEFINED_BY]-(ch1:Characteristic)<-[:SET_ON]-(v1:Value)-[:SET_FOR]->(childD) WHERE NOT ((ch1)<-[:DEPENDS_ON]-()) |
{characteristicId: id(ch1), value: v1.value, valueType: ch1.valueType, visualMode: ch1.visualMode} ] AS valuedCharacteristics
但是除了这个Characteristic 列表还返回Characteristic 在{includeCharacteristicIds} 集合中有ID 吗?
请帮助扩展此查询。
【问题讨论】: