Add clause to match the relationship we want to delete
2858
private function matchRelationship(
        Identity $identity,
        object $entity,
        Query $query
    ): Query {
        $meta = ($this->metadata)(\get_class($entity));
        $name = $this->name->sprintf(\md5($identity->value()));
        $this->variables = $this->variables->add((string) $name);

        return $query
            ->match()
            ->linkedTo()
            ->through(
                (string) $meta->type(),
                (string) $name
            )
            ->withProperty(
                $meta->identity()->property(),
                (string) $name
                    ->prepend('{')
                    ->append('_identity}')
            )
            ->withParameter(
                (string) $name->append('_identity'),
                $identity->value()
            );
    }
1258071
public void deleteRelationshipIndex(EntityMetadata entityMetadata, GraphDatabaseService graphDb,
            Relationship relationship)
    {
        if (!isRelationshipAutoIndexingEnabled(graphDb) && entityMetadata.isIndexable())
        {
            Index<Relationship> relationshipIndex = graphDb.index().forRelationships(entityMetadata.getIndexName());
            relationshipIndex.remove(relationship);
        }
    }
617357
def replace_with(self, other):
        
        match_ids_to_delete = list(self.update_matches(other))
        TextLogErrorMatch.objects.filter(id__in=match_ids_to_delete).delete()

        # Update best classifications
        self.best_for_errors.update(best_classification=other)

        self.delete()
1348987
def delete(self, *args, **kwargs):
        """"""
        json_data = request.get_json() or {}

        relationship_field, model_relationship_field, related_type_, related_id_field = self._get_relationship_data()

        if 'data' not in json_data:
            raise BadRequest('You must provide data with a "data" route node', source={'pointer': '/data'})
        if isinstance(json_data['data'], dict):
            if 'type' not in json_data['data']:
                raise BadRequest('Missing type in "data" node', source={'pointer': '/data/type'})
            if 'id' not in json_data['data']:
                raise BadRequest('Missing id in "data" node', source={'pointer': '/data/id'})
            if json_data['data']['type'] != related_type_:
                raise InvalidType('The type field does not match the resource type', source={'pointer': '/data/type'})
        if isinstance(json_data['data'], list):
            for obj in json_data['data']:
                if 'type' not in obj:
                    raise BadRequest('Missing type in "data" node', source={'pointer': '/data/type'})
                if 'id' not in obj:
                    raise BadRequest('Missing id in "data" node', source={'pointer': '/data/id'})
                if obj['type'] != related_type_:
                    raise InvalidType('The type provided does not match the resource type',
                                      source={'pointer': '/data/type'})

        self.before_delete(args, kwargs, json_data=json_data)

        obj_, updated = self._data_layer.delete_relationship(json_data,
                                                             model_relationship_field,
                                                             related_id_field,
                                                             kwargs)

        status_code = 200
        result = {'meta': {'message': 'Relationship successfully updated'}}

        if updated is False:
            result = ''
            status_code = 204

        final_result = self.after_delete(result, status_code)

        return final_result
1037136
def delete_joined_table_sql(qualified_name, removing_qualified_name, primary_key):
    

    condition_template = 't.{}=d.{}'
    where_clause = ' AND '.join(condition_template.format(pkey, pkey)
                                for pkey in primary_key)
    delete_statement = (
        'DELETE FROM {table} t'
        ' USING {delete_table} d'
        ' WHERE {where_clause}').format(table=qualified_name,
                                        delete_table=removing_qualified_name,
                                        where_clause=where_clause)
    return delete_statement
380895
def delete(self):
        
        self._pre_action_check('delete')
        self.cypher("MATCH (self) WHERE id(self)={self} "
                    "OPTIONAL MATCH (self)-[r]-()"
                    " DELETE r, self")
        delattr(self, 'id')
        self.deleted = True
        return True
1184748
def <<(clause)
      new_clauses = @clauses.dup
      new_clauses.delete clause
      self.class.new(attributes) { new_clauses + [clause] }
    end
478408
private function assignClausesToDeleteQuery(DeleteQuery $query, array $clauses)
    {
        foreach ($clauses as $clause) {
            if ($clause instanceof FromClause) {
                foreach ($clause->getFrom() as $from) {
                    $query->addFrom($from['tableKey'], $from['table'], $from['alias'], $from['params']);
                }

                continue;
            }

            if ($clause instanceof JoinClause) {
                foreach ($clause->getJoin() as $tableKey => $join) {
                    $query->addJoin($tableKey, $join['type'], $join['source'], $join['table'], $join['alias'], $join['on'], $join['params']);
                }

                continue;
            }

            if ($clause instanceof WhereClause) {
                foreach ($clause->getWhere() as $where) {
                    $query->addWhere($where['logic'], $where['sql'], $where['params']);
                }

                continue;
            }

            if ($clause instanceof OrderByClause) {
                foreach ($clause->getOrderBy() as $orderBy) {
                    $query->addOrderBy($orderBy['sql'], $orderBy['type'], $orderBy['params']);
                }

                continue;
            }

            if ($clause instanceof LimitClause) {
                $query->limit($clause->getLimit());

                continue;
            }
        }

        return $this;
    }
189734
def delete(self):
        
        cmd = "delete from {table} {where_clause}".format(
            table=self.table_name,
            where_clause=self.where_clause
        ).rstrip()
        Repo.db.execute(cmd, self.where_values)
242545
def delete_relation(self, src, relation, target):
        '''  '''
        self.__require_string__(relation)
        if src in self and target in self:
            self._get_item_node(src).unlink(relation, self._get_item_node(target))
9030
function(model)
  {
    var exists = this.has( model.$key() );
    var matches = this.filter( model );

    if ( exists && !matches )
    {
      this.remove( model );
    }
    if ( !exists && matches )
    {
      this.add( model );
    }
  }
818317
def delete_relation(sender, instance, **kwargs):
    """"""
    def process_signal(relation_id):
        """Get the relation and delete it if it has no entities left."""
        try:
            relation = Relation.objects.get(pk=relation_id)
        except Relation.DoesNotExist:
            return

        if relation.entities.count() == 0:
            relation.delete()

    # Wait for partitions to be recreated.
    transaction.on_commit(lambda: process_signal(instance.relation_id))
1346704
def delete(self,pool_or_cursor):
    ""
    vals=self.pkey_vals()
    whereclause=' and '.join('%s=%%s'%k for k in self.PKEY.split(','))
    q='delete from %s where %s'%(self.TABLE,whereclause)
    commit_or_execute(pool_or_cursor,q,vals)
569643
private void removeFromIndexes(Object value, Object key, TransactionContext transactionContext) {
      performSearchWork(value, keyToString(key), WorkType.DELETE, transactionContext);
   }
1234734
def delete_relation(self, src, relation, *targets):
        '''  '''
        self.__require_string__(relation)
        if len(targets):
            for i in targets:
                self._delete_single_relation(src, relation, i)
        else:
            # delete all connections of that relation from src
            for i in list(self.find(src, relation)):
                self._delete_single_relation(src, relation, i)
1084227
public function withTrashed()
	{
		$column = $this->model->getQualifiedDeletedAtColumn();

		foreach ((array) $this->query->wheres as $key => $where)
		{
			// If the where clause is a soft delete date constraint, we will remove it from
			// the query and reset the keys on the wheres. This allows this developer to
			// include deleted model in a relationship result set that is lazy loaded.
			if ($this->isSoftDeleteConstraint($where, $column))
			{
				unset($this->query->wheres[$key]);

				$this->query->wheres = array_values($this->query->wheres);
			}
		}

		return $this;
	}
283518
final public function removeFromJunction($table, $masterValue, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN)
    {
        // Support for multiple removal
        if (!is_array($masterValue)) {
            $masterValue = array($masterValue);
        }

        return $this->db->delete()
                        ->from($table)
                        ->whereIn($masterColumn, $masterValue)
                        ->execute();
    }