你能不能告诉我哪个命令行可以帮我重新初始化neo4j查询,解释更多,我有一个查询给出了所有用户节点,第二个查询给出了文件夹节点,不幸的是,第二个查询记得结果第一个查询。
编辑0
以下是OP作为答案发布的其他信息的串联。对于有能力的人,请合并编辑并删除此评论。
编辑1
<td>
<select name=user>
<?php
$result1 = $client->sendCypherQuery("MATCH (n:$label1) return n")->getResult();
$i=0;
foreach ($result1->getNodes() as $nu){
$n[$i]=$nu->getproperty('lastname');
$i++;
}
while ($j<$i)
{
echo "<option value='$n[$j]'> $n[$j] </option>";
$j=$j+1;
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td>Nom dossier :</td>
<td>
<select name=folder>
<?php
$result2 = $client->sendCypherQuery("MATCH (n:$label2) return n")->getResult();
$i=0;
foreach ($result2->getNodes() as $nd){
$d[$i]=$nd->getProperty('name');
$i++;
}
$j=0;
while ($j<$i)
{
echo "<option value='$d[$j]'> $d[$j] </option>";
$j=$j+1;
}
echo "</select>";
?>
</td>
</tr>
编辑2
我有2个用户和2个文件夹。
$result1
应该返回用户,$result2
应该返回文件夹。
当我查找文件夹的大小时,我得到4而不是2,所以查询总是记住第一个查询的结果。
编辑3
var_dump($result1)
,我明白了:
object(Neoxygen\NeoClient\Formatter\Result) protected 'nodes' =>
array (size=2)
7 =>
object(Neoxygen\NeoClient\Formatter\Node)[796]
protected 'id' => string '7' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=6)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
9 =>
object(Neoxygen\NeoClient\Formatter\Node)[797]
protected 'id' => string '9' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=6)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
... protected 'relationships' =>
array (size=0)
empty protected 'errors' => null
protected 'identifiers' =>
array (size=1)
'n' =>
array (size=2)
0 =>
object(Neoxygen\NeoClient\Formatter\Node)[796]
...
1 =>
object(Neoxygen\NeoClient\Formatter\Node)[797]
...
编辑4
和var_dump($result2)
:
object(Neoxygen\NeoClient\Formatter\Result) protected 'nodes' =>
array (size=4)
7 =>
object(Neoxygen\NeoClient\Formatter\Node)[799]
protected 'id' => string '7' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=6)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
9 =>
object(Neoxygen\NeoClient\Formatter\Node)[800]
protected 'id' => string '9' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=6)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
8 =>
object(Neoxygen\NeoClient\Formatter\Node)[787]
protected 'id' => string '8' (length=1)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=2)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
10 =>
object(Neoxygen\NeoClient\Formatter\Node)[788]
protected 'id' => string '10' (length=2)
protected 'labels' =>
array (size=1)
...
protected 'properties' =>
array (size=2)
...
protected 'inboundRelationships' =>
array (size=0)
...
protected 'outboundRelationships' =>
array (size=0)
...
编辑5
<?php include 'connection.php';
$j=0;
$l=0;
$label1="user";
$label2="folder1";
?>
<br><br><br>
<h3>Ajouter relation</h3>
<form action='php/addlink.php' method=post>
<table>
<tr>
<td>Nom utilisateur:</td>
<td>
<select name=user>
<?php
$result1 = $client->sendCypherQuery("MATCH (n:$label1) return n")->getResult();
$i=0;
foreach ($result1->getNodes() as $nu){
$n[$i]=$nu->getproperty('lastname');
$i++;
}
while ($j<$i)
{
echo "<option value='$n[$j]'> $n[$j] </option>";
$j=$j+1;
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td>Nom dossier :</td>
<td>
<select name=folder>
<?php
$result2 = $client->sendCypherQuery("MATCH (n:$label2) return n")->getResult();
$i=0;
foreach ($result2->getNodes() as $nd){
$d[$i]=$nd->getid();
$i++;
}
$j=0;
while ($j<$i)
{
echo "<option value='$d[$j]'> $d[$j] </option>";
$j=$j+1;
}
echo "</select>";
?>
答案 0 :(得分:1)
这真的很奇怪,我创建了一个集成测试,证明在后续查询中结果不会重复:
所以我会看到不同的立场: