cjm-graph-domains
A shared library of Pydantic models and standard schemas for the cjm-graph-plugin-system ecosystem, enabling type-safe domain definitions across plugins and UIs.
Install
pip install cjm_graph_domainsProject Structure
nbs/
├── domains/ (3)
│ ├── knowledge.ipynb # Domain schemas for knowledge management (Person, Work, Concept, Topic, Quote)
│ ├── relations.ipynb # Standard relationship types for knowledge and structure graphs
│ └── structure.ipynb # Domain schemas for content structure (Document, Segment)
└── core.ipynb # Base Pydantic models and conversion logic for domain-specific graph schemas
Total: 4 notebooks across 1 directory
Module Dependencies
graph LR
core[core<br/>Core]
domains_knowledge[domains.knowledge<br/>Knowledge Domain]
domains_relations[domains.relations<br/>Domain Relations]
domains_structure[domains.structure<br/>Content Structure]
domains_knowledge --> core
domains_relations --> domains_knowledge
domains_relations --> domains_structure
domains_structure --> core
4 cross-module dependencies detected
CLI Reference
No CLI commands found in this project.
Module Overview
Detailed documentation for each module in the project:
Core (core.ipynb)
Base Pydantic models and conversion logic for domain-specific graph schemas
Import
from cjm_graph_domains.core import (
DomainNode
)Classes
class DomainNode(BaseModel):
"Base Pydantic model for domain-specific graph nodes."
def get_label(self) -> str: # Node label for the graph (defaults to class name)
"""Return the node label."""
return self.__class__.__name__
def to_graph_node(
self,
sources: List[SourceRef] = [] # External data references for provenance
) -> GraphNode: # Generic GraphNode for storage in graph plugins
"Return the node label."
def to_graph_node(
self,
sources: List[SourceRef] = [] # External data references for provenance
) -> GraphNode: # Generic GraphNode for storage in graph plugins
"Convert this domain model to a generic GraphNode."Knowledge Domain (knowledge.ipynb)
Domain schemas for knowledge management (Person, Work, Concept, Topic, Quote)
Import
from cjm_graph_domains.domains.knowledge import (
Person,
Work,
Concept,
Topic,
Quote
)Classes
class Person(DomainNode):
"A human being, historical figure, or speaker."class Work(DomainNode):
"A creative work (book, speech, article, etc.)."class Concept(DomainNode):
"An abstract idea, theory, or framework."class Topic(DomainNode):
"A subject or theme discussed in content."class Quote(DomainNode):
"A verbatim segment of notable text."Domain Relations (relations.ipynb)
Standard relationship types for knowledge and structure graphs
Import
from cjm_graph_domains.domains.relations import (
KnowledgeRelations,
StructureRelations
)Classes
class KnowledgeRelations:
"Registry of standard edge types for knowledge graphs."
def all(cls) -> list: # List of all relation type strings
"Return all defined relation types."class StructureRelations:
"Registry of standard edge types for content structure graphs."
def all(cls) -> list: # List of all relation type strings
"Return all defined relation types."Content Structure (structure.ipynb)
Domain schemas for content structure (Document, Segment)
Import
from cjm_graph_domains.domains.structure import (
Document,
Segment
)Classes
class Document(DomainNode):
"A logical container for structured content."class Segment(DomainNode):
"An atomic unit of text within a document."