m_edge (zotonic_core v1.0.0-rc.12)
Link to this section Summary
Functions
Delete an edge by Id
Delete an edge by subject, object and predicate id
Delete multiple edges between the subject and the object
Duplicate all edges from one id to another id. Skip all edges that give ACL errors.
Get the complete edge with the id
Return the full description of all edges from a subject, grouped by predicate
Get the edge id of a subject/pred/object combination
Get the edge as a triple {subject_id, predicate, object_id}
Insert a new edge
Fetch all object/edge ids for a subject/predicate
Move all edges from one id to another id, part of m_rsc:merge_delete/3
Return the Nth object with a certain predicate of a subject.
Return all object ids with the edge id for a predicate/subject_id
Return all object ids with edge properties
Return the list of predicate ids in use by edges to objects from the id
Return the list of predicates in use by edges to objects from the id
Return all object ids of the resource
Return all object ids of an id with a certain predicate. The order of the ids is deterministic.
Replace the objects with the new list
Set edges order so that the specified object ids are in given order. Any extra edges not specified will be deleted, and any missing edges will be inserted.
Return the Nth subject with a certain predicate of an object.
Return all subject ids with the edge id for a predicate/object_id
Return all subject ids with the edge properties
Return the list of predicates is use by edges from subjects to the id
Return the list of predicates is use by edges from subjects to the id
Return all subject ids of the resource
Return all subject ids of an object id with a certain predicate. The order of the ids is deterministic.
Update the nth edge of a subject. Set a new object, keep the predicate. If there are not enough edges then an error is returned. The first edge is nr 1.
Reorder the edges so that the mentioned ids are in front, in the listed order.
Update the sequence for the given edge ids. Optionally rename the predicate on the edge.
Link to this section Types
Link to this type
insert_option/0
-type insert_option() :: is_insert_before | no_touch | {seq, integer()} | {creator_id, m_rsc:resource_id()} | {created, calendar:datetime()}.
Link to this type
insert_options/0
-type insert_options() :: [insert_option()].
Link to this section Functions
Link to this function
delete(Id, Context)
Link to this function
delete(SubjectId, Pred, ObjectId, Context)
-spec delete(m_rsc:resource(), m_rsc:resource(), m_rsc:resource(), z:context()) -> ok | {error, atom()}.
Link to this function
delete(SubjectId, Pred, ObjectId, Options, Context)
-spec delete(m_rsc:resource(), m_rsc:resource(), m_rsc:resource(), list(), z:context()) -> ok | {error, atom()}.
Link to this function
delete_multiple(SubjectId, Preds, ObjectId, Context)
Link to this function
duplicate(Id, ToId, Context)
-spec duplicate(m_rsc:resource(), m_rsc:resource(), #context{}) -> ok | {error, {atom(), m_rsc:resource_id()}}.
Link to this function
get(Id, Context)
Link to this function
get_edges(SubjectId, Context)
Link to this function
get_id(SubjectId, PredId, ObjectId, Context)
-spec get_id(m_rsc:resource(), m_rsc:resource(), m_rsc:resource(), #context{}) -> pos_integer() | undefined.
Link to this function
get_triple(Id, Context)
-spec get_triple(pos_integer(), #context{}) -> {m_rsc:resource_id(), atom(), m_rsc:resource_id()}.
Link to this function
insert(Subject, Pred, Object, Context)
-spec insert(m_rsc:resource(), m_rsc:resource(), m_rsc:resource(), z:context()) -> {ok, EdgeId :: pos_integer()} | {error, term()}.
Link to this function
insert(SubjectId, PredId, ObjectId, Opts, Context)
-spec insert(m_rsc:resource(), m_rsc:resource(), m_rsc:resource(), insert_options(), z:context()) -> {ok, EdgeId :: pos_integer()} | {error, term()}.
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
merge(WinnerId, LoserId, Context)
Link to this function
object(Id, Pred, N, Context)
Link to this function
object_edge_ids(Subject, Predicate, Context)
-spec object_edge_ids(m_rsc:resource(), m_rsc:resource(), z:context()) -> [{m_rsc:resource_id(), integer()}].
Link to this function
object_edge_props(Subject, Predicate, Context)
-spec object_edge_props(m_rsc:resource(), m_rsc:resource(), z:context()) -> [m_rsc:resource_id()].
Link to this function
object_predicate_ids(Id, Context)
-spec object_predicate_ids(m_rsc:resource_id(), z:context()) -> [m_rsc:resource_id()].
Link to this function
object_predicates(Id, Context)
-spec object_predicates(m_rsc:resource_id(), z:context()) -> [atom()].
Link to this function
objects(Subject, Context)
-spec objects(m_rsc:resource(), z:context()) -> [m_rsc:resource_id()].
Link to this function
objects(SubjectId, Predicate, Context)
-spec objects(SubjectId :: m_rsc:resource(), Predicate :: m_rsc:resource(), z:context()) -> [m_rsc:resource_id()].
Link to this function
replace(SubjectId, PredId, NewObjects, Context)
-spec replace(m_rsc:resource(), m_rsc:resource(), [m_rsc:resource()], z:context()) -> ok | {error, atom()}.
Link to this function
set_sequence(Subject, Pred, ObjectIds, Context)
-spec set_sequence(m_rsc:resource(), m_rsc:resource(), [m_rsc:resource_id()], z:context()) -> ok | {error, term()}.
Link to this function
subject(Id, Pred, N, Context)
Link to this function
subject_edge_ids(Object, Predicate, Context)
-spec subject_edge_ids(m_rsc:resource(), m_rsc:resource(), z:context()) -> [{m_rsc:resource_id(), integer()}].
Link to this function
subject_edge_props(Object, Predicate, Context)
-spec subject_edge_props(m_rsc:resource(), m_rsc:resource(), z:context()) -> [m_rsc:resource_id()].
Link to this function
subject_predicate_ids(Id, Context)
-spec subject_predicate_ids(m_rsc:resource_id(), z:context()) -> [m_rsc:resource_id()].
Link to this function
subject_predicates(Id, Context)
-spec subject_predicates(m_rsc:resource_id(), z:context()) -> [atom()].
Link to this function
subjects(Object, Context)
-spec subjects(m_rsc:resource(), z:context()) -> [m_rsc:resource_id()].
Link to this function
subjects(ObjectId, Predicate, Context)
-spec subjects(ObjectId :: m_rsc:resource(), Predicate :: m_rsc:resource(), z:context()) -> [m_rsc:resource_id()].
Link to this function
update_nth(SubjectId, Predicate, Nth, ObjectId, Context)
-spec update_nth(m_rsc:resource_id(), m_rsc:resource(), m_rsc:resource_id(), integer(), z:context()) -> {ok, pos_integer()} | {error, eacces | enoent}.
Link to this function
update_sequence(Subject, Pred, ObjectIds, Context)
-spec update_sequence(m_rsc:resource(), m_rsc:resource(), [m_rsc:resource_id()], z:context()) -> ok | {error, term()}.
Link to this function
update_sequence_edge_ids(Subject, Pred, EdgeIds, Context)
-spec update_sequence_edge_ids(m_rsc:resource_id(), m_rsc:resource(), [integer()], z:context()) -> ok | {error, term()}.