Access information about page connections.

Edges represent the connections between resources. They are implemented as tuples {EdgeId, SubjectId, PredicateId, ObjectId, OrderNr}. The edge id is a unique id representing the edge, it can be used with edit actions. The OrderNr defines the order of the edges with respect to the subject.

Most edge information is accessed using the m_rsc model, but some information can only accessed with the m_edge model.

This model implements two template accessible options. They are mainly used to obtain the edge’s id for edit pages.

The following m_edge model properties are available in templates:

Property Description Example value

Returns a function that accepts a page

id and a predicate. The end result is a list of tuples {PageId, EdgeId} which are objects of the page. Example usage: m.edge.o[id].author

[{204,13},{510,14}, {508,15}]
s Identical to the “o” property, except that this function returns the subject edges.  
o_props Similar to m.edge.o[id].author above, but returns a property list for the edges instead of the 2-tuple.
    {id, 86062},
    {subject_id, 10635},
    {predicate_id, 304},
    {object_id, 57577},
    {seq, 1},
    {creator_id, 1},
    {created, {
s_props Similar to m.edge.s[id].author above, but returns a property list for the edges instead of the 2-tuple.  
edges Returns a function that accepts a page id. The end result is a list of edges per predicate where the predicate is an atom and the edges are property lists. Example usage: m.edge[10635] See example below.

Look up an edge id by a subject/predicate/object triple. Example usage:




Returns undefined if the edge does not exist; otherwise returns an integer.


Example return value for {% print m.edge[10635] %}:


Other Topics

model/edge/post/o/+subject/+predicate/+object or model/edge/post/s/+object/+predicate/+object inserts a new edge between resources.

The posted message can optionally include the name or id of the object, predicate and subject.

                         predicate: "author",
                         subject: 7575

It is also possible to insert edges via cotonics onclick topics.

<div data-onclick-topic="bridge/origin/model/edge/post/o/{{ id }}/?/{{ m.acl.user }}">
   <button data-edge-predicate="is_going">Is Going</button>
   <button data-edge-predicate="is_interested">Might Go</button>

When a user clicks on a button, the model retrieves the predicate name (or id) from the data-edge-predicate attribute. This is also possible by for the object and subject attributes of the edge. When there is a ? in the topic path, the value can be retrieved from a data attribute. The attribute value for object is: data-edge-object. For subject it is: data-edge-subject.

model/edge/post/delete/o/+subject/+predicate/+object, model/edge/post/delete/s/+object/+predicate/+subject or model/edge/post/delete/edge/+edge_id deletes the specified edge.


Or via a onclick topic.

<button data-onclick-topic="bridge/origin/edge/delete/{{ edge_id }}">Delete</button

Edit on GitHub

m_rsc_gone Models m_template

Referred by


The main resource model, which is the central part of the Zotonic data model. This model provides an interface to all…