Go to page content

m_predicate

Information about predicates.

Predicates are the labels on edges that give meaning to an edge. An example is the predicate “author” which refers to the authors of an article. Predicates form together with the referring and the referred page a triple {subject, predicate, object}.

Each predicate has a list of valid subject categories and valid object categories. This is used to filter the list of predicates in the admin edit page, and also to filter the list of found potential objects when making a connection.

A full predicate definition can be fetched by name or id with:

m.predicate.author
m.predicate[104]

Which returns a property list with information about the predicate. The property list contains all page properties and the properties: “pred” which is the atomic predicate name, “subject” which is a list of valid subject categories and “object” with is a list of valid object categories.

The following m_predicate model properties are available in templates:

PropertyDescriptionExample value
allReturn a property list of all predicates. Keys are the atomic predicate name, values are property lists with information about the predicate. The property list contains all page properties and the properties: “pred” which is the atomic predicate name, “subject” which is a list of valid subject categories and “object” with is a list of valid object categories.

[{about, [{pred,,about},{subject,[104]}, {object,[]}, {id,300}, … ]

object_categoryUsed to derive the list of valid object categories for a predicate. Example usage: m.predicate.object_category.author Each id is a 1-tuple.[{104}, … ]
subject_categoryUsed to derive the list of valid subject categories for a predicate. Example usage: m.predicate.subject_category.author Each id is a 1-tuple.[{674}, … ]

This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.