我打算将我的整个图形(两个节点都有关系和"独立的节点)导出到Gephi中。为了实现它,我当前执行两个查询:
// export relationships
match path = (n)--()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
// export independent nodes
match path = (p)
where not (p)--()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
我尝试用以下单个查询替换它们:
match path = (n)-[*0..]-()
with collect(path) as paths
call apoc.gephi.add(null, 'workspace1', paths, '', ['attr1', 'attr2']) yield nodes, relationships, time
return nodes, relationships, time
不幸的是,查询永远不会完成并且有效地使用DoS-es Neo4j(导致Neo4j端的CPU和RAM消耗很高并使其无响应)。
我也试图用[*0..10]
限制关系深度,但它没有帮助。
使用单个查询导出数据的正确方法是什么?
答案 0 :(得分:1)
我会尝试以下情况......
public function getInputFilterSpecification()
{
return [
'username' => [
'name' => 'username',
'required' => true,
'filters' => [
'name' => 'StringToLower',
'name'=>'StripTags',
'name'=>'StringTrim'
],
validators => [
[
'name'=>'Regex',
'options'=> [
'pattern' => '/^[a-z0-9_.-]{1,50}+$/',
'pattern_js' => '^[a-zA-Z0-9_\.\-]{1,50}$'
]
]
]
],
'password' => [
'name' => 'password',
'required' => true,
'filters' => [
array('name'=>'StripTags'),
array('name'=>'StringTrim')
],
'validators' => [
[
'name'=>'Regex',
'options'=> [
'pattern' => '/^[a-z0-9_.-]{6,25}+$/',
'pattern_js' => '^[a-zA-Z0-9_\.\-]{6,25}$'
]
]
]
]
];
}
所以我们已经添加了关系的方向并限制为只有1跳。这样我们就可以删除导出重复项并加快导出速度。