您能否告诉我哪个命令行可以帮助我重新初始化 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>";
?>