标题:如何动态命名集合?
伪代码:collect(n) AS :Label
这样做的主要目的是为了便于阅读API服务器(节点应用程序)中的属性。
详细示例:
MATCH (user:User)--(n)
WHERE n:Movie OR n:Actor
RETURN user,
CASE
WHEN n:Movie THEN "movies"
WHEN n:Actor THEN "actors"
END as type, collect(n) as :type
JSON中的预期输出:
[{
"user": {
....
},
"movies": [
{
"_id": 1987,
"labels": [
"Movie"
],
"properties": {
....
}
}
],
"actors:" [ .... ]
}]
我最接近的是:
[{
"user": {
....
},
"type": "movies",
"collect(n)": [
{
"_id": 1987,
"labels": [
"Movie"
],
"properties": {
....
}
}
]
}]
目标是能够轻松地读取JSON结果:
neo4j.cypher.query(statement, function(err, results) {
for result of results
var user = result.user
var movies = result.movies
}
修改 对于无法正确命名数据库语义的任何困惑,我深表歉意。
答案 0 :(得分:2)
我想知道输出用户及其演员和电影的列表是否足够,而不是尝试更复杂的匹配和组合两种方式。
static public byte[] sign(byte[] data, PrivateKey privateKey, int saltLength) throws Exception {
Signature instance = Signature.getInstance("SHA256withRSA/PSS", provider);
MGF1ParameterSpec mgf1ParameterSpec = new MGF1ParameterSpec("SHA-256");
PSSParameterSpec pssParameterSpec = new PSSParameterSpec("SHA-256", "MGF1",mgf1ParameterSpec , saltLength, 1);
instance.setParameter(pssParameterSpec);
instance.initSign(privateKey);
instance.update(data);
return instance.sign();
}