Redesign structure handling #25

Closed
opened 2026-01-11 00:28:59 +00:00 by scossu · 2 comments
Owner

Mixing curatorial resources and structural elements (bricks) in the same graph was a bad idea.

Bricks can be hard to clean up and update when updating a resource and its tree structure. They also make for complicated laundry lists when these are recreated from archived resources.

A better solution would be to handle structures separately from curatorial resources:

  • Structures can be created from LL layout, as they do now.
    • (in a later release users can also provide a structured file, e.g. JSON, to define a custom structure -- not for v1.0)
  • Each resource with members gets a pas:hasTree relationship that points to a named graph.
    • Named graphs haven't been used in Pocket Archive, so that's a good use for them. All curatorial resources are in one main graph.
    • For simplicity's and practicality's sake, there is only one tree per resource. As usual, any resource can be in any number of trees.
  • The tree starts with the related resource URI, and branches off from there.
  • Tree branches are created as bricks in the same way they are created now. Each tree is contained in its own named graph.
  • Presentation can build the structure from the related tree, if present. Instead of looking for pas:first, it looks for pas:hasTree and then for the subject inside the tree.
  • When a resource with a related structure is updated, the whole tree is removed and recreated from the updating LL. That is easy to do because the whole structure is in the same named graph.
Mixing curatorial resources and structural elements (bricks) in the same graph was a bad idea. Bricks can be hard to clean up and update when updating a resource and its tree structure. They also make for complicated laundry lists when these are recreated from archived resources. A better solution would be to handle structures separately from curatorial resources: - Structures can be created from LL layout, as they do now. - (in a later release users can also provide a structured file, e.g. JSON, to define a custom structure -- not for v1.0) - Each resource with members gets a `pas:hasTree` relationship that points to a named graph. - Named graphs haven't been used in Pocket Archive, so that's a good use for them. All curatorial resources are in one main graph. - For simplicity's and practicality's sake, there is only one tree per resource. As usual, any resource can be in any number of trees. - The tree starts with the related resource URI, and branches off from there. - Tree branches are created as bricks in the same way they are created now. Each tree is contained in its own named graph. - Presentation can build the structure from the related tree, if present. Instead of looking for `pas:first`, it looks for `pas:hasTree` and then for the subject inside the tree. - When a resource with a related structure is updated, the whole tree is removed and recreated from the updating LL. That is easy to do because the whole structure is in the same named graph.
scossu added this to the v1.0.0 milestone 2026-01-11 00:28:59 +00:00
Author
Owner

Note that this will break serialization until Volksdata implements a triG codec. See #26

Note that this will break serialization until Volksdata implements a triG codec. See https://git.knowledgetx.com/scossu/pocket_archive/issues/26
Author
Owner

Tasks (in named_tree branch):

  • Replace pas:Brick type with pas:Proxy type
  • Remove brick content type from content model
  • Functions to create trees from a submission (one per top-level resource)
  • Adjust repo to handle multiple named graphs
  • Assign trees to resources before calling rsrc_to_graph
  • Delete each existing resource tree graph after calling rsrc_to_graph
  • Link new trees to resources
  • Rework presentation to handle trees in resource view
  • Special handling of collections: they get a flat, ordered tree, and each direct member gets its own tree (stretch goal)
  • Clean up and debug
  • Update tests
  • Update documentation
Tasks (in `named_tree` branch): - [X] Replace `pas:Brick` type with `pas:Proxy` type - [x] Remove `brick` content type from content model - [X] Functions to create trees from a submission (one per top-level resource) - [X] Adjust repo to handle multiple named graphs - [x] Assign trees to resources before calling `rsrc_to_graph` - [x] Delete each existing resource tree graph after calling `rsrc_to_graph` - [x] Link new trees to resources - [x] Rework presentation to handle trees in resource view - [x] Special handling of collections: they get a flat, ordered tree, and each direct member gets its own tree (stretch goal) - [x] Clean up and debug - [x] Update tests - [x] Update documentation
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
scossu/pocket_archive#25
No description provided.