m_predicate (zotonic_core v1.0.0-rc.14)
Link to this section Summary
Functions
Return the list of all predicates
Flush all cached data about predicates.
Return the list of predicates that are valid for the given resource id. Append all predicates that have no restrictions.
Return the definition of the predicate
Lookup the name of a predicate with an id
Insert a new predicate, sets some defaults.
Test if the property is the name of a predicate
Check if a predicate is actually in use for an existing edge.
Fetch the value for the key from a model source
Return the id of the predicate
Return all the valid categories for objects. Return the empty list when there is no constraint. Note that the resulting array is a bit strangely formatted [{id}, {id2}, ...], this is compatible with the category name lookup and prevents mixups with strings (lists of integers).
Return the category ids that are valid as objects
Return all the valid categories for subjects. Return the empty list when there is no constraint. Note that the resulting array is a bit strangely formatted [{id}, {id2}, ...], this is compatible with the category name lookup and prevents mixups with strings (lists of integers).
Return the category ids that are valid as subjects
Reset the list of valid subjects and objects.
Link to this section Functions
Link to this function
all(Context)
Link to this function
flush(Context)
Link to this function
for_subject(Id, Context)
Link to this function
get(PredId, Context)
-spec get(atom() | m_rsc:resource_id() | string() | binary(), z:context()) -> list() | undefined.
Link to this function
id_to_name(Id, Context)
-spec id_to_name(m_rsc:resource_id(), z:context()) -> {ok, atom()} | {error, {unknown_predicate, term()}}.
Link to this function
insert(Title, Context)
-spec insert(binary() | list(), z:context()) -> {ok, integer()} | {error, any()}.
Link to this function
is_predicate(Id, Context)
Link to this function
is_used(Predicate, Context)
Link to this function
m_get(Rest, Msg, Context)
-spec m_get(list(), zotonic_model:opt_msg(), z:context()) -> zotonic_model:return().
Link to this function
name_to_id(Name, Context)
-spec name_to_id(m_rsc:resource_name(), z:context()) -> {ok, m_rsc:resource_id()} | {error, {unknown_predicate, term()}}.
Link to this function
object_category(Id, Context)
Link to this function
objects(Id, Context)
Link to this function
subject_category(Id, Context)
Link to this function
subjects(Id, Context)
Link to this function
update_noflush(Id, Subjects, Objects, Context)
-spec update_noflush(integer(), list(), list(), z:context()) -> ok.