Skip to main content

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.

Project description

cjm-graph-domains

Install

pip install cjm_graph_domains

Project 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."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cjm_graph_domains-0.0.13.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cjm_graph_domains-0.0.13-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file cjm_graph_domains-0.0.13.tar.gz.

File metadata

  • Download URL: cjm_graph_domains-0.0.13.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for cjm_graph_domains-0.0.13.tar.gz
Algorithm Hash digest
SHA256 77cbd7e56d733e7faa74f5a9c694ca20688cc143fb958efc7586af87c07d29f3
MD5 a9869459a901da6bb2cabf3b635c2bd4
BLAKE2b-256 d09d582c7c2000a479b4e5a95003290501f97423ef33d4eeadc00050c59b2c36

See more details on using hashes here.

File details

Details for the file cjm_graph_domains-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for cjm_graph_domains-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 605a2bf71f99bd2b7c3c109737aa72001931451b1e9b8d1fe61577592ed2b59e
MD5 6cd7fb9898dedec0ebf51c0947334918
BLAKE2b-256 aeea6789a8eb14b0b98b7c873ca6239a89c26863f5430a479e62fe53f2699e6a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page