Simple utility to analyze a Logseq graph for basic information to assist with the upcoming database version.
Warning
Only supports Markdown (.md) graphs.
-
Ensure Python 3 is installed
-
Install requirements with:
pip install -r requirements.txt
-
To run:
py -m logseq_analyzer -g path_to_your_graph_folder -
For help:
py -m logseq_analyzer -h -
To run from CLI:
py -m logseq_analyzer --cli
-
--move-unlinked-assetswill move unlinked assets out of your graph to this projects folder for review -
--move-bakwill move the contents of Logseq'slogseq/bakfolder similar to above -
--move-recyclesame thing as the above but withlogseq/.recycle -
--move-allwill move all of the above
Logseq currenty runs with two definitions of an "Orphan" page.
- The
All pagesview: Page that is not backlinked and has no content - The
Graphview: Page that is not backlinked and has no backlinks
Anybody with a sizeable number of pages will tell you that the Graph view in Logseq becomes unwieldly very quickly. While the All pages orphans can be removed with the "Remove orphaned pages?" action from All pages, the Graph orphans are only accessible via the Graph view. The Graph orphans may contain lots of content, but since they aren't don't link to or from anything, they have high chance of not surfacing again. This analyzer will show each type of orphan in the graph for further review.
Note: While Logseq doesn't count namespace hierarchies as backlinks, this program does, as it reflects how the Graph view interprets backlinks, otherwise many pages may potentially be considered orphans, depending on the complexity of some namespaces.
Read more here: logseq/db-test#7
Essentially two issues arise:
- The split namespace parts may conflict with existing, non-namespace pages
- Some parents may appear across multiple namespaces at different depths
This analyzer will output all conflicts for review in the /namespace output folder.
Text files with information in the default output folder.
- True Orphans - Not backlinked, has no backlinks, and has no content.
- Graph Orphans - Not backlinked, and has no backlinks.
- Leaf Node - Backlinked, and has no backlinks.
- Root Node - Not backlinked, and has backlinks.
- Branch Node - Backlinked, and has backlinks.
- Dangling Link - Backlinked, and does not exist as a file in the system.
| Node Type | Backlinked ✅ | Has Backlinks ✅ | Has Content ✅ | Exists as File ✅ |
|---|---|---|---|---|
| True Orphans | ❌ | ❌ | ❌ | ✅ |
| Graph Orphans | ❌ | ❌ | ✅ | ✅ |
| Leaf Node | ✅ | ❌ | 🟡 | ✅ |
| Root Node | ❌ | ✅ | ✅ | ✅ |
| Branch Node | ✅ | ✅ | ✅ | ✅ |
| Dangling Link | ✅ | ❌ | ❌ | ❌ |
