Copyright © 2009 Marc Worrell Date: 2009-04-09
Behaviours: zotonic_model.
Authors: Marc Worrell (marc@worrell.nl).
all/1 | Return the list of all predicates. |
flush/1 | Flush all cached data about predicates. |
for_subject/2 | Return the list of predicates that are valid for the given resource id. |
get/2 | Return the definition of the predicate. |
id_to_name/2 | Lookup the name of a predicate with an id. |
insert/2 | Insert a new predicate, sets some defaults. |
is_predicate/2 | Test if the property is the name of a predicate. |
is_used/2 | Check if a predicate is actually in use for an existing edge. |
m_get/3 | Fetch the value for the key from a model source. |
name_to_id/2 | Return the id of the predicate. |
object_category/2 | Return all the valid categories for objects. |
objects/2 | Return the category ids that are valid as objects. |
subject_category/2 | Return all the valid categories for subjects. |
subjects/2 | Return the category ids that are valid as subjects. |
update_noflush/4 | Reset the list of valid subjects and objects. |
all(Context) -> PropList
Return the list of all predicates
flush(Context) -> any()
Flush all cached data about predicates.
for_subject(Id, Context) -> any()
Return the list of predicates that are valid for the given resource id. Append all predicates that have no restrictions.
get(PredId::atom() | m_rsc:resource_id() | string() | binary(), Context::z:context()) -> list() | undefined
Return the definition of the predicate
id_to_name(Id::m_rsc:resource_id(), Context::z:context()) -> {ok, atom()} | {error, {unknown_predicate, term()}}
Lookup the name of a predicate with an id
insert(Title::binary() | list(), Context::z:context()) -> {ok, integer()} | {error, any()}
Insert a new predicate, sets some defaults.
is_predicate(Id::Pred, Context) -> bool()
Test if the property is the name of a predicate
is_used(Predicate, Context) -> any()
Check if a predicate is actually in use for an existing edge.
m_get(Rest::list(), Msg::zotonic_model:opt_msg(), Context::z:context()) -> zotonic_model:return()
Fetch the value for the key from a model source
name_to_id(Name::m_rsc:resource_name(), Context::z:context()) -> {ok, m_rsc:resource_id()} | {error, {unknown_predicate, term()}}
Return the id of the predicate
object_category(Id, Context) -> List
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).
objects(Id, Context) -> any()
Return the category ids that are valid as objects
subject_category(Id, Context) -> List
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).
subjects(Id, Context) -> any()
Return the category ids that are valid as subjects
update_noflush(Id::integer(), Subjects::list(), Objects::list(), Context::z:context()) -> ok
Reset the list of valid subjects and objects.
Generated by EDoc