Namespaces¶
Module containing functions for processing and analyzing namespace data in Logseq.
What are the problems trying to be solved?
Logseq's move to a database system from a markdown one. Currently, namespace pages are full and valid, so root/parent/child is a name. The proposed migration by Logseq is to split each part and tag the children with their parents. Now we have three pages of root, parent, and child.
Problems
- The split namespace parts may conflict with existing, non-namespace pages.
- Some parents may appear across multiple namespaces at different depths.
- There is no easy way to get data about namespaces.
Classes:
| Name | Description |
|---|---|
NamespaceConflicts |
Class to hold namespace conflict data. |
NamespaceStructure |
Class to hold namespace structure data. |
LogseqNamespaces |
Class for analyzing namespace data in Logseq. |
NamespaceConflicts(dangling: dict[str, list[str]] = (lambda: defaultdict(list))(), non_namespace: dict[str, list[str]] = (lambda: defaultdict(list))(), parent_depth: dict[tuple[str, int], list[str]] = (lambda: defaultdict(list))(), parent_unique: dict[tuple[str, int], set[str]] = (lambda: defaultdict(set))())
dataclass
¶
Class to hold namespace conflict data.
NamespaceStructure(data: dict[str, Any] = dict(), details: dict[str, Any] = dict(), parts: dict[str, Any] = dict(), tree: dict[str, Any] = dict(), unique_ns_per_level: dict[str, set[str]] = (lambda: defaultdict(set))(), unique_parts: set[str] = set())
dataclass
¶
Class to hold namespace structure data.
LogseqNamespaces(index: FileIndex, dangling_links: set[str], _part_levels: defaultdict[str, set[int]] = (lambda: defaultdict(set))(), _part_entries: defaultdict[str, list[dict[str, Any]]] = (lambda: defaultdict(list))(), conflicts: NamespaceConflicts = NamespaceConflicts(), structure: NamespaceStructure = NamespaceStructure(), queries: dict[str, dict[str, Any]] = dict())
dataclass
¶
Class for analyzing namespace data in Logseq.
Methods:
| Name | Description |
|---|---|
__post_init__ |
Initialize the LogseqNamespaces instance. |
process |
Process the namespace data from the index. |
init_ns_parts |
Create namespace parts from the data. |
analyze_ns_queries |
Analyze namespace queries. |
detect_non_ns_conflicts |
Check for conflicts between split namespace parts and existing non-namespace page names. |
detect_parent_depth_conflicts |
Identify namespace parts that appear at different depths (levels) across entries. |
Attributes:
| Name | Type | Description |
|---|---|---|
report |
dict[str, Any]
|
Generate a report of the namespace analysis. |
report: dict[str, Any]
property
¶
Generate a report of the namespace analysis.
__post_init__() -> None
¶
Initialize the LogseqNamespaces instance.
process() -> None
¶
Process the namespace data from the index.
init_ns_parts() -> None
¶
Create namespace parts from the data.
analyze_ns_queries() -> None
¶
Analyze namespace queries.
detect_non_ns_conflicts() -> None
¶
Check for conflicts between split namespace parts and existing non-namespace page names.
detect_parent_depth_conflicts() -> None
¶
Identify namespace parts that appear at different depths (levels) across entries.