如何删除具有给定类型的所有节点?

问题描述

https://dgraph.io/tour/schema/8/

显示一些删除选项

  1. 删除一个元组
  2. 删除给定边的所有三元组
  3. 删除给定节点的所有三元组

现在,我想删除给定类型节点的所有三元组。我假设这是通过查询的某种组合完成的,该查询选择给定类型的节点,然后为每个这些节点进行突变。在本教程中找不到该示例。

假设我要删除Country类型的节点的所有三元组

我知道如何为节点选择uid:

    {  
      query(func: has(<dgraph.type>)) @filter(eq(<dgraph.type>,"Country")) {
        uid
      }
    }

但是我该如何结合突变呢?

https://discuss.dgraph.io/t/how-to-bulk-delete-nodes-or-cascade-delete-nodes/7308

似乎要求“ upsert”

如何删除给定类型节点的所有三元组

解决方法

以下更新似乎有效:

<style>
          *{
            padding: 0;
            margin: 0;
            font-family:"Segoe UI",Tahoma,Geneva,Verdana,sans-serif
          }

    
          .recover a {
            display: flex;
            align-items: center;
            justify-content: space-around;
            text-decoration: none;
            font-weight: 500;
            width: 50%;
            height: 20%;
            background: #00a761;
            color: white;
            font-size: 15px;
          }
    
          .recover a:hover {
            background: #00d67d;
          }
          .recover h1 {
            color: white;
            margin-bottom: 1%;
          }
          .recover p {
            color: #afafaf;
            width: 50%;
            text-align: center;
            margin-bottom: 1%;
          }
         .recoverall .recover{
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            border-radius: 5px;
            width: 80%;
            height: 250px;
            background: #292929;
        }
         .recoverall{
            display: flex;
            justify-content: space-around;
            background: #070707;
            width: 100%;
            height: 100vh;
            padding-top: 5%;
        }
          
          @media screen and (max-width: 768px) {
            .recover h1 {
              font-size: 15px;
            }
            .recoverall {
              width: 100%;
            }
            .recover p {
              font-size: 10px;
              width: 95%;
            }
            .recover a {
              width: 70%;
            }
          }
        </style>
      <body>
        <table  class="recoverall" border="1" cellpadding="0" cellspacing="0" width="100%">
 <tbody  class="recover"><tr>
  <td>
   <h1>Recover Your Password</h1>
  </td>
 </tr>
 <tr>
  <td>
   <p>
              We Have Recive a request Fom this Account to reset Your password,if
              you have not sent this request ignore,but if You Are the One that
              sent it,Click the button Below
            </p>
  </td>
 </tr>
 <tr>
  <td>
   <a href='XXX'>Click Here To Continue</a>
  </td>
 </tr>
</tbody></table>
      </body>

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...