# observe\_edge\_delete/2

Source: https://zotonic.com/docs/2126/observe_edge_delete-2

URI: https://zotonic.com/id/2126

Language: en



An edge has been deleted Note that the Context for this notification does not have the user who deleted the edge.

Type:

[notify](/id/doc_developerguide_notifications#notification-notify)

Return:

return value is ignored

`#edge_delete{}` properties:

- subject\_id: `m_rsc:resource()`
- predicate: `atom`
- object\_id: `m_rsc:resource()`
- edge\_id: `pos_integer`

Example
-------

Perform some action when an edge is deleted:

```erlang
-include_lib("zotonic_core/include/zotonic.hrl").
-export([observe_edge_delete/2]).

observe_edge_delete(#edge_delete{edge_id = Id}, Context) ->
    %% Consult the edge_log table to get the late edge's details
    Edge = z_db:assoc_row("select * from edge_log where edge_id = $1", [Id], Context)),

    ?DEBUG(Edge),
    %% logged is when the deletion was logged; created is when the edge was
    %% originally created
    %% [{id,11},{op,<<"DELETE">>},{edge_id,25},{subject_id,341},{predicate_id,300},{predicate,<<"about">>},{object_id,338},{seq,1000000},{logged,{{2016,10,13},{10,23,21}}},{created,{{2016,10,13},{10,23,13}}}]

    %% Do something...

    ok.
```

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2126?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/2126?language=en>)
