Understanding Page and Block Relations in LogSeq (Part 3)
In Part 2, we explored how to query basic relation types using advanced queries in LogSeq. This continuation delves into weighting these different types of relations.
Important Notes
During the development of the weighting system, I discovered several defects in the previous relationship listings. While I attempted to use new notation and Mermaid diagrams to cover all cases, this proved to be time-consuming. I’ve decided to focus on the main content for now, with updates to Parts 1 and 2, including new notations and diagrams, coming in the future.
First-Degree Relations
First-degree relations represent direct connections between elements in LogSeq. The new notation system is structured as follows:
Notation Format: {node} {relation}
- Node: ‘P’ for page, ‘B’ for block
- Relation: Indicates the relation type, where the second letter indicates the destination element type
- Example:
P MP
means a page has a reference to another page in metadata
First-degree relations include:
- P MP: Page references another page in metadata
flowchart LRsubgraph 1P[Page 1]1Pp[tags:: page-2]end1P~~~1P2([&Page 2])
- P UP: Page belongs to a parent page
graph LR;1P["Page 2 (parent)"]-->1C["Page 1 (child)"];
- P DP: Page has a child page
graph LR;1P["Page 1 (parent)"]-->1C["Page 2 (child)"];
- P PB: Page has a block
graph LRsubgraph 1P[Page 1]1Pb[Block 1]end
- B CP: Block references a page in content
flowchart LRsubgraph 1B[Block 1]1Bp[#page-1]end1B~~~2P([&Page 1])
- B CB: Block references another block in content
flowchart LRsubgraph 1B[Block 1]1Bb[#block-2]end1B~~~1B2([&Block 2])
- B UB: Block belongs to a parent block
graph LR;1P["Block 2 (parent)"]-->1C["Block 1 (child)"];
- B DB: Block has a child block
graph LR;1P["Block 1 (parent)"]-->1C["Block 2 (child)"];
- B BP: Block belongs to a page
graph LRsubgraph 1P[Page 1]1Pb[Block 1]end
Second-Degree Relations
Second-degree relations represent indirect connections derived from combining two first-degree relations.
Notation Format: {link type}{node} {1st relation} {2nd relation}
- Link Type:
- ’~’ for serial (order-dependent)
- ’=’ for parallel (order-independent)
- Example:
=P MP MP
represents a page with two interrelated page references in metadata
Categories of second-degree relations:
- OIR: Order Interchangeable Refs
=P MP MP
=B CP CP
=B CP CB
=B CB CB
- DBE: Dereference a block then extend
~B CB BP
~B CB CP
~B CB CB
~B CB UB
~B CB DB
- BDP: Start from block, dereference a page then extend
~B CP BP
~B CP MP
~B CP DP
~B CP PB
- PDP: Start from page, dereference a page then extend
~P MP UP
~P MP DP
~P MP MP
~P MP PB
- 1BB: A block lineal relation + a block ref
~P PB CB
=B CB DB
=B CB UB
- 1BP: A block lineal relation + a page ref
~P PB CP
=B CP DB
=B CP UB
- 1PP: A page lineal relation + a page ref
~P UP MP
=P UP MP
=P PB MP
- 2LD1: Two lineal relations of same node-type with depth of 1
=P DP DP
=B DB DB
- 2LD2: Two lineal relations of same node-type with depth of 2
~P UP UP
~B UB UB
- 2LPB: Two lineal relations of different node-type
~P DP PB
~P UP PB
Methodology and Research Notes
The evaluation methodology combines quantitative and qualitative factors:
-
Primary Factors (Scale 1-3):
- Usage frequency (quantitative, based on personal usage data)
- Dereference complexity (qualitative, the less the better)
-
Secondary Factors (Scale 1-5):
- Relation specificity (quantitative, based on maintenance cost)
- Lineal relation (qualitative, prefer parent relation type)
The final evaluation score uses the formula: primary^3 * secondary^1
to appropriately weight the factors while preventing edge cases where high secondary scores might overshadow primary importance.
Evaluation Result
no | item | group | primary | secondary | eval | rank |
---|---|---|---|---|---|---|
1 | =P MP MP | OIR | 3 | 4 | 108 | 1 |
2 | =B CP CP | OIR | 2 | 3 | 24 | 5 |
3 | =B CP CB | OIR | 2 | 2 | 16 | 10 |
4 | =B CB CB | OIR | 2 | 1 | 8 | 13 |
5 | ~B CB BP | DBE | 1 | 5 | 5 | 17 |
6 | ~B CB CP | DBE | 1 | 4 | 4 | 18 |
7 | ~B CB CB | DBE | 1 | 3 | 3 | 20 |
8 | ~B CB UB | DBE | 1 | 2 | 2 | 22 |
9 | ~B CB DB | DBE | 1 | 1 | 1 | 27 |
10 | ~B CP BP | BDP | 1 | 4 | 4 | 19 |
11 | ~B CP MP | BDP | 1 | 3 | 3 | 21 |
12 | ~B CP DP | BDP | 1 | 2 | 2 | 23 |
13 | ~B CP PB | BDP | 1 | 1 | 1 | 28 |
14 | ~P MP UP | PDP | 2 | 4 | 32 | 3 |
15 | ~P MP DP | PDP | 2 | 3 | 24 | 6 |
16 | ~P MP MP | PDP | 2 | 2 | 16 | 11 |
17 | ~P MP PB | PDP | 2 | 1 | 8 | 14 |
18 | ~P PB CB | 1BB | 2 | 3 | 24 | 7 |
19 | =B CB DB | 1BB | 1 | 2 | 2 | 24 |
20 | =B CB UB | 1BB | 1 | 1 | 1 | 29 |
21 | ~P PB CP | 1BP | 2 | 3 | 24 | 8 |
22 | =B CP DB | 1BP | 1 | 2 | 2 | 25 |
23 | =B CP UB | 1BP | 1 | 1 | 1 | 30 |
24 | ~P UP MP | 1PP | 2 | 3 | 24 | 9 |
25 | =P UP MP | 1PP | 2 | 2 | 16 | 12 |
26 | =P PB MP | 1PP | 1 | 1 | 1 | 31 |
27 | =P DP DP | 2LD1 | 3 | 1 | 27 | 4 |
28 | =B DB DB | 2LD1 | 2 | 1 | 8 | 15 |
29 | ~P UP UP | 2LD2 | 3 | 2 | 54 | 2 |
30 | ~B UB UB | 2LD2 | 2 | 1 | 8 | 16 |
31 | ~P DP PB | 2LPB | 1 | 2 | 2 | 26 |
32 | ~P UP PB | 2LPB | 1 | 1 | 1 | 32 |
Sorted by rank
no | item | group | primary | secondary | eval | rank |
---|---|---|---|---|---|---|
1 | =P MP MP | OIR | 3 | 4 | 108 | 1 |
29 | ~P UP UP | 2LD2 | 3 | 2 | 54 | 2 |
14 | ~P MP UP | PDP | 2 | 4 | 32 | 3 |
27 | =P DP DP | 2LD1 | 3 | 1 | 27 | 4 |
2 | =B CP CP | OIR | 2 | 3 | 24 | 5 |
15 | ~P MP DP | PDP | 2 | 3 | 24 | 6 |
18 | ~P PB CB | 1BB | 2 | 3 | 24 | 7 |
21 | ~P PB CP | 1BP | 2 | 3 | 24 | 8 |
24 | ~P UP MP | 1PP | 2 | 3 | 24 | 9 |
3 | =B CP CB | OIR | 2 | 2 | 16 | 10 |
16 | ~P MP MP | PDP | 2 | 2 | 16 | 11 |
25 | =P UP MP | 1PP | 2 | 2 | 16 | 12 |
4 | =B CB CB | OIR | 2 | 1 | 8 | 13 |
17 | ~P MP PB | PDP | 2 | 1 | 8 | 14 |
28 | =B DB DB | 2LD1 | 2 | 1 | 8 | 15 |
30 | ~B UB UB | 2LD2 | 2 | 1 | 8 | 16 |
5 | ~B CB BP | DBE | 1 | 5 | 5 | 17 |
6 | ~B CB CP | DBE | 1 | 4 | 4 | 18 |
10 | ~B CP BP | BDP | 1 | 4 | 4 | 19 |
7 | ~B CB CB | DBE | 1 | 3 | 3 | 20 |
11 | ~B CP MP | BDP | 1 | 3 | 3 | 21 |
8 | ~B CB UB | DBE | 1 | 2 | 2 | 22 |
12 | ~B CP DP | BDP | 1 | 2 | 2 | 23 |
19 | =B CB DB | 1BB | 1 | 2 | 2 | 24 |
22 | =B CP DB | 1BP | 1 | 2 | 2 | 25 |
31 | ~P DP PB | 2LPB | 1 | 2 | 2 | 26 |
9 | ~B CB DB | DBE | 1 | 1 | 1 | 27 |
13 | ~B CP PB | BDP | 1 | 1 | 1 | 28 |
20 | =B CB UB | 1BB | 1 | 1 | 1 | 29 |
23 | =B CP UB | 1BP | 1 | 1 | 1 | 30 |
26 | =P PB MP | 1PP | 1 | 1 | 1 | 31 |
32 | ~P UP PB | 2LPB | 1 | 1 | 1 | 32 |
Conclusion
This research establishes a foundational framework for evaluating second-degree relationships in LogSeq, offering several key contributions:
- A quantitative baseline for determining correlations between second-degree relationships, enabling more efficient discovery of indirectly related topics
- A unified, succinct notation system for describing complex relationships between pages and blocks, providing a solid foundation for future research
- A novel approach to relationship metrics that considers both direct and indirect connections, allowing for more comprehensive topic analysis
These advances open new possibilities for knowledge graph analysis and relationship-based content organization in LogSeq and similar tools.
Research Notes and Methodology Insights
This initial research effort presented several interesting challenges and learning opportunities:
Notation Development
- The development of a concise notation system emerged as a crucial first step
- The concepts of “serial” and “parallel” relationships proved valuable, providing geometric equivalents based on directional attributes
- While the notation is efficient, future work should address additional geometric variants of relationship types
Evaluation Framework Design The evaluation methodology was developed through a systematic approach:
-
Relationship Grouping
- Similar relations were clustered to establish coherent categories
- Secondary factors were evaluated within group contexts (scale 1-5)
- Primary factors were assessed globally (scale 1-3)
-
Scoring System
- Implemented the formula
primary^3 * secondary^1
- This approach successfully prevents edge cases where high secondary scores (e.g., 1 primary, 5 secondary) might inappropriately outweigh more significant relationships (e.g., 2 primary, 1 secondary)
- Balances quantitative data with qualitative insights
- Implemented the formula
Future Research Directions
- Incorporate additional academic references to strengthen the theoretical foundation
- Expand quantitative analysis with formal data collection and validation
- Explore automated tools for relationship analysis based on this framework
- Develop standardized metrics for relationship evaluation across different knowledge management systems
This research represents a first step toward a more rigorous understanding of knowledge graph relationships, with significant potential for expansion and refinement in future work.