在我的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
列表的其他内容如何在ID
集合中返回{includeCharacteristicIds}
string s;
Console.WriteLine("Enter What you want to write in your File : ");
s = Convert.ToString(Console.ReadLine());
using (StreamWriter sw = new StreamWriter(@"E:/File.txt"))
{
sw.Write(s);
sw.Close();
}
using (StreamReader r = new StreamReader(@"E:/File.txt"))
{
char[] buffer = new char[1024];
int read;
int line = 0;
while ((read = r.ReadBlock(buffer, 0, buffer.Length)) > 0)
{
for (int i = 0; i < read; i++)
{
if (buffer[i] == '\n' && buffer[i]=='\r')
{
line++;
}
}
//Console.WriteLine(buffer[i]);
}
Console.WriteLine("Total Lines Are : " + line);
}
?
请帮助扩展此查询。
答案 0 :(得分:1)
你可以将这两个条件与这样的OR语句结合起来......
WHERE NOT ((ch1)<-[:DEPENDS_ON]-()) OR id(ch1) IN myIDs
模式理解中的WHERE就像MATCH条件的WHERE一样。