Copyright © 2009-2019 Marc Worrell Date: 2009-04-09 Copyright 2009-2019 Marc Worrell Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Behaviours: zotonic_model.
Authors: Marc Worrell (marc@worrell.nl).
insert_option() = is_insert_before | no_touch | {seq, integer()} | {creator_id, m_rsc:resource_id()} | {created, calendar:datetime()}
insert_options() = [insert_option()]
delete/2 | Delete an edge by Id. |
delete/4 | Delete an edge by subject, object and predicate id. |
delete/5 | |
delete_multiple/4 | Delete multiple edges between the subject and the object. |
duplicate/3 | Duplicate all edges from one id to another id. |
get/2 | Get the complete edge with the id. |
get_edges/2 | Return the full description of all edges from a subject, grouped by predicate. |
get_id/4 | Get the edge id of a subject/pred/object combination. |
get_triple/2 | Get the edge as a triple {subject_id, predicate, object_id}. |
insert/4 | Insert a new edge. |
insert/5 | |
m_get/3 | Fetch all object/edge ids for a subject/predicate. |
merge/3 | Move all edges from one id to another id, part of m_rsc:merge_delete/3. |
object/4 | Return the Nth object with a certain predicate of a subject. |
object_edge_ids/3 | Return all object ids with the edge id for a predicate/subject_id. |
object_edge_props/3 | Return all object ids with edge properties. |
object_predicate_ids/2 | Return the list of predicate ids in use by edges to objects from the id. |
object_predicates/2 | Return the list of predicates in use by edges to objects from the id. |
objects/2 | Return all object ids of the resource. |
objects/3 | Return all object ids of an id with a certain predicate. |
replace/4 | Replace the objects with the new list. |
set_sequence/4 | Set edges order so that the specified object ids are in given order. |
subject/4 | Return the Nth subject with a certain predicate of an object. |
subject_edge_ids/3 | Return all subject ids with the edge id for a predicate/object_id. |
subject_edge_props/3 | Return all subject ids with the edge properties. |
subject_predicate_ids/2 | Return the list of predicates is use by edges from subjects to the id. |
subject_predicates/2 | Return the list of predicates is use by edges from subjects to the id. |
subjects/2 | Return all subject ids of the resource. |
subjects/3 | Return all subject ids of an object id with a certain predicate. |
update_nth/5 | Update the nth edge of a subject. |
update_sequence/4 | Reorder the edges so that the mentioned ids are in front, in the listed order. |
update_sequence_edge_ids/4 | Update the sequence for the given edge ids. |
delete(Id, Context) -> any()
Delete an edge by Id
delete(SubjectId::m_rsc:resource(), Pred::m_rsc:resource(), ObjectId::m_rsc:resource(), Context::z:context()) -> ok | {error, atom()}
Delete an edge by subject, object and predicate id
delete(SubjectId::m_rsc:resource(), Pred::m_rsc:resource(), ObjectId::m_rsc:resource(), Options::list(), Context::z:context()) -> ok | {error, atom()}
delete_multiple(SubjectId, Preds, ObjectId, Context) -> any()
Delete multiple edges between the subject and the object
duplicate(Id::m_rsc:resource(), ToId::m_rsc:resource(), Context::#context{}) -> ok | {error, {atom(), m_rsc:resource_id()}}
Duplicate all edges from one id to another id. Skip all edges that give ACL errors.
get(Id, Context) -> any()
Get the complete edge with the id
get_edges(SubjectId, Context) -> any()
Return the full description of all edges from a subject, grouped by predicate
get_id(SubjectId::m_rsc:resource(), PredId::m_rsc:resource(), ObjectId::m_rsc:resource(), Context::#context{}) -> pos_integer() | undefined
Get the edge id of a subject/pred/object combination
get_triple(Id::pos_integer(), Context::#context{}) -> {m_rsc:resource_id(), atom(), m_rsc:resource_id()}
Get the edge as a triple {subject_id, predicate, object_id}
insert(Subject::m_rsc:resource(), Pred::m_rsc:resource(), Object::m_rsc:resource(), Context::z:context()) -> {ok, EdgeId::pos_integer()} | {error, term()}
Insert a new edge
insert(SubjectId::m_rsc:resource(), PredId::m_rsc:resource(), ObjectId::m_rsc:resource(), Opts::insert_options(), Context::z:context()) -> {ok, EdgeId::pos_integer()} | {error, term()}
m_get(Rest::list(), Msg::zotonic_model:opt_msg(), Context::z:context()) -> zotonic_model:return()
Fetch all object/edge ids for a subject/predicate
merge(WinnerId, LoserId, Context) -> any()
Move all edges from one id to another id, part of m_rsc:merge_delete/3
object(Id, Pred, N, Context) -> any()
Return the Nth object with a certain predicate of a subject.
object_edge_ids(Id, Predicate, Context) -> list()
Return all object ids with the edge id for a predicate/subject_id
object_edge_props(Id::m_rsc:resource_id(), Predicate::binary() | string() | atom() | integer(), Context::z:context()) -> list()
Return all object ids with edge properties
object_predicate_ids(Id, Context) -> List
Return the list of predicate ids in use by edges to objects from the id
object_predicates(Id, Context) -> List
Return the list of predicates in use by edges to objects from the id
objects(Id, Context) -> list()
Return all object ids of the resource
objects(SubjectId::m_rsc:resource(), Predicate::m_rsc:resource(), Context::z:context()) -> [m_rsc:resource_id()]
Return all object ids of an id with a certain predicate. The order of the ids is deterministic.
replace(SubjectId::m_rsc:resource(), PredId::pos_integer() | atom(), NewObjects::m_rsc:resource(), Context::#context{}) -> ok | {error, atom()}
Replace the objects with the new list
set_sequence(Id, Pred::Predicate, ObjectIds, Context) -> ok | {error, Reason}
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.
subject(Id, Pred, N, Context) -> any()
Return the Nth subject with a certain predicate of an object.
subject_edge_ids(Id, Predicate, Context) -> list()
Return all subject ids with the edge id for a predicate/object_id
subject_edge_props(Id::m_rsc:resource_id(), Predicate::binary() | string() | atom() | integer(), Context::z:context()) -> list()
Return all subject ids with the edge properties
subject_predicate_ids(Id, Context) -> List
Return the list of predicates is use by edges from subjects to the id
subject_predicates(Id, Context) -> List
Return the list of predicates is use by edges from subjects to the id
subjects(Id, Context) -> list()
Return all subject ids of the resource
subjects(ObjectId::m_rsc:resource(), Predicate::m_rsc:resource(), Context::z:context()) -> [m_rsc:resource_id()]
Return all subject ids of an object id with a certain predicate. The order of the ids is deterministic.
update_nth(SubjectId::m_rsc:resource_id(), Predicate::m_rsc:resource(), Nth::m_rsc:resource_id(), ObjectId::integer(), Context::z:context()) -> {ok, pos_integer()} | {error, eacces | enoent}
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.
update_sequence(Id, Pred::Predicate, ObjectIds, Context) -> ok | {error, Reason}
Reorder the edges so that the mentioned ids are in front, in the listed order.
update_sequence_edge_ids(Id, Pred::Predicate, EdgeIds, Context) -> ok | {error, Reason}
Update the sequence for the given edge ids. Optionally rename the predicate on the edge.
Generated by EDoc