{"result":{"depiction_url":null,"edges":{"hasreference":{"objects":[{"created":"2026-10-07T11:13:26Z","object_id":{"id":1297,"is_a":["text","documentation","reference","model"],"name":"doc_model_model_edge","title":"edge","uri":"https:\/\/zotonic.com\/id\/1297"},"seq":1}],"predicate":{"id":2774,"is_a":["meta","predicate"],"name":"hasreference","title":{"_type":"trans","tr":{"en":"Documentation reference"}},"uri":"https:\/\/zotonic.com\/id\/hasreference"}},"refers":{"objects":[{"created":"2026-10-07T11:13:08Z","object_id":{"id":1297,"is_a":["text","documentation","reference","model"],"name":"doc_model_model_edge","title":"edge","uri":"https:\/\/zotonic.com\/id\/1297"},"seq":1000000},{"created":"2026-10-07T11:13:08Z","object_id":{"id":2955,"is_a":["text","documentation","developerguide"],"name":"developer_datamodel_fixtures","title":{"_type":"trans","tr":{"en":"Install initial content with a datamodel"}},"uri":"https:\/\/zotonic.com\/id\/2955"},"seq":1000000},{"created":"2026-10-07T11:13:08Z","object_id":{"id":2957,"is_a":["text","documentation","developerguide"],"name":"developer_import_export","title":{"_type":"trans","tr":{"en":"Move content between sites"}},"uri":"https:\/\/zotonic.com\/id\/2957"},"seq":1000000}],"predicate":{"id":2409,"is_a":["meta","predicate"],"name":"refers","title":{"_type":"trans","tr":{"en":"Refers"}},"uri":"https:\/\/zotonic.com\/id\/refers"}},"relation":{"objects":[{"created":"2026-10-07T11:13:26Z","object_id":{"id":2894,"is_a":["text","documentation","userguide"],"name":"editor_connections_concept","title":{"_type":"trans","tr":{"en":"What connections mean"}},"uri":"https:\/\/zotonic.com\/id\/2894"},"seq":1},{"created":"2026-10-07T11:13:26Z","object_id":{"id":2840,"is_a":["text","documentation","userguide"],"name":"editor_collections","title":{"_type":"trans","tr":{"en":"Creating and using collections"}},"uri":"https:\/\/zotonic.com\/id\/2840"},"seq":2}],"predicate":{"id":303,"is_a":["meta","predicate"],"name":"relation","title":{"_type":"trans","tr":{"nl":"Relatie","en":"Relation"}},"uri":"http:\/\/purl.org\/dc\/terms\/relation"}},"subject":{"objects":[{"created":"2026-10-07T11:13:26Z","object_id":{"id":2554,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_how_to_guide","title":"How-to guide","uri":"https:\/\/zotonic.com\/id\/2554"},"seq":1},{"created":"2026-10-07T11:13:26Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":2},{"created":"2026-10-07T11:13:26Z","object_id":{"id":2617,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_edge","title":"Edge","uri":"https:\/\/zotonic.com\/id\/2617"},"seq":3},{"created":"2026-10-07T11:13:26Z","object_id":{"id":2616,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_predicate","title":"Predicate","uri":"https:\/\/zotonic.com\/id\/2616"},"seq":4},{"created":"2026-10-07T11:13:26Z","object_id":{"id":2574,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_content_relationships","title":"Content relationships","uri":"https:\/\/zotonic.com\/id\/2574"},"seq":5}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":2953,"is_a":["text","documentation","developerguide"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2953"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"developer_content_edges","page_url":{"en":"https:\/\/zotonic.com\/docs\/2953\/connect-resources-and-preserve-order","x-default":"https:\/\/zotonic.com\/docs\/2953\/connect-resources-and-preserve-order"},"preview_url":null,"resource":{"body":{"_type":"trans","tr":{"en":"<p>An edge connects a subject resource to an object resource through a predicate. Use <a href=\"\/id\/1297\" class=\"doc-reference doc-reference-model\"><code>model#edge<\/code><\/a> to inspect and manage these connections.<\/p>\n<p>For example, in a local shell:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">m_edge:objects(Id, haspart, C).\n<\/code><\/pre>\n<p>Use the edge API for insertions, deletions, and ordering. Direct database writes skip normal notifications and cache invalidation. Check permissions on the requested relationship as well as the resource being edited.<\/p>\n<p>When importing a collection, preserve the order of its children explicitly. A set of correct connections in the wrong order can still produce the wrong navigation. See <a href=\"\/id\/2957\">Move content between sites<\/a> and <a href=\"\/id\/2955\">Install initial content with a datamodel<\/a>.<\/p>\n<p>For two existing, authorized resources, connect a guide to its first task:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">{ok, _EdgeId} = m_edge:insert(GuideId, haspart, TaskId, C).\nm_edge:objects(GuideId, haspart, C).\n<\/code><\/pre>\n<p>The pattern match is useful in a test shell; application code must handle <code>{error, Reason}<\/code>. Use <code>relation<\/code> for related tasks and a site&#39;s <code>hasreference<\/code> predicate for citations, when that predicate exists. Neither should change collection membership.<\/p>\n<p><code>m_edge:set_sequence(GuideId, haspart, OrderedIds, C)<\/code> sets the requested outgoing list; it can add or remove membership as well as reorder it. Read the current list first and supply the complete intended list. Verify it with <code>m_edge:objects\/3<\/code>. Do not use this operation to overwrite connections owned by editors during a routine import.<\/p>"}},"category_id":{"id":317,"is_a":["meta","category"],"name":"developerguide","title":"Developer guide","uri":"https:\/\/zotonic.com\/id\/developerguide"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2026-10-07T11:12:56Z","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"doc_editorial_bundle":true,"doc_editorial_edges":{"hasreference":[1297],"relation":[2840,2894],"subject":[2554,2564,2574,2616,2617]},"is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2026-10-07T11:13:32Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"name":"developer_content_edges","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2026-10-07T11:12:56Z","slug":"connect-resources-and-preserve-order","summary":{"_type":"trans","tr":{"en":"An edge connects a subject resource to an object resource through a predicate. Use model#edge to inspect and manage these connections."}},"title":{"_type":"trans","tr":{"en":"Connect resources and preserve order"}},"title_slug":{"_type":"trans","tr":{"en":"connect-resources-and-preserve-order"}},"tz":"UTC","uri":null,"version":24,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/2953","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2953"}},"status":"ok"}