Module m_predicate

Model for predicates.

Copyright 2009 Marc Worrell Date: 2009-04-09

Behaviours: gen_model.

Authors: Marc Worrell (marc@worrell.nl).

Description

Model for predicates

Function Index

all/1Return the list of all predicates.
flush/1Flush all cached data about predicates.
for_subject/2Return the list of predicates that are valid for the given resource id.
get/2Return the definition of the predicate.
id_to_name/2Lookup the name of a predicate with an id.
insert/2Insert a new predicate, sets some defaults.
is_predicate/2Test if the property is the name of a predicate.
m_find_value/3Fetch the value for the key from a model source.
m_to_list/2Transform a model value to a list, used for template loops.
m_value/2Transform a model value so that it can be formatted or piped through filters.
name_to_id/2Return the id of the predicate.
name_to_id_check/2
object_category/2Return all the valid categories for objects.
objects/2Return the category ids that are valid as objects.
subject_category/2Return all the valid categories for subjects.
subjects/2Return the category ids that are valid as subjects.
update_noflush/4Update a predicate, save the reversed flag, reset the list of valid subjects and objects.

Function Details

all/1

all(Context) -> PropList

Return the list of all predicates

flush/1

flush(Context) -> any()

Flush all cached data about predicates.

for_subject/2

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/2

get(PredId, Context) -> PredicatePropList | undefined

Return the definition of the predicate

id_to_name/2

id_to_name(Id, Context) -> {ok, atom()} | {error, Reason}

Lookup the name of a predicate with an id

insert/2

insert(Title, Context) -> {ok, Id} | {error, Reason}

Insert a new predicate, sets some defaults.

is_predicate/2

is_predicate(Id::Pred, Context) -> bool()

Test if the property is the name of a predicate

m_find_value/3

m_find_value(Key, M::Source, Context) -> term()

Fetch the value for the key from a model source

m_to_list/2

m_to_list(M::Source, Context) -> List

Transform a model value to a list, used for template loops

m_value/2

m_value(M::Source, Context) -> term()

Transform a model value so that it can be formatted or piped through filters

name_to_id/2

name_to_id(Name::Pred, Context) -> {ok, int()} | {error, Reason}

Return the id of the predicate

name_to_id_check/2

name_to_id_check(Name, Context) -> any()

object_category/2

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/2

objects(Id, Context) -> any()

Return the category ids that are valid as objects

subject_category/2

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/2

subjects(Id, Context) -> any()

Return the category ids that are valid as subjects

update_noflush/4

update_noflush(Id, Subjects, Objects, Context) -> void()

Update a predicate, save the reversed flag, reset the list of valid subjects and objects.


Generated by EDoc, Aug 28 2014, 10:37:28.