Skip to main content

Assembler components for the Sayou Data Platform

Project description

sayou-assembler

Build Status License: Apache 2.0 Docs

sayou-assembler is the graph construction engine of the Sayou Data Platform. It takes standardized nodes from sayou-wrapper and assembles them into a logical In-Memory Knowledge Graph.

It is responsible for interpreting relationships (like Parent-Child), generating reverse edges, and ensuring the graph's topological integrity before it is persisted by sayou-loader.

Philosophy

"Structure before Storage." A database is just a container. The value of a Knowledge Graph comes from its structure. sayou-assembler focuses on the logic of connecting dots (Nodes) to create meaning (Context), independent of the underlying database technology (Neo4j, SQL, NetworkX).

🚀 Key Features

  • In-Memory Graph Model: Manages GraphNode and GraphEdge objects efficiently in Python.
  • Hierarchy Strategy: Automatically builds tree-like structures using parent_id attributes.
  • Bi-directional Linking: Automatically generates reverse edges (e.g., hasChild from hasParent) to enable bidirectional graph traversal.
  • Strategy Pattern: Supports pluggable assembly strategies (Hierarchy, Semantic, Chronological).

📦 Installation

pip install sayou-assembler

⚡ Quickstart

The AssemblerPipeline creates the graph using a specified strategy (default: hierarchy).

import json
from sayou.assembler.pipeline import AssemblerPipeline

def run_demo():
    # 1. Load Standard Nodes (Output from sayou-wrapper)
    input_file = "wrapped_nodes.json"
    with open(input_file, "r", encoding="utf-8") as f:
        wrapper_output = json.load(f)

    # 2. Initialize Pipeline
    # Uses 'HierarchyBuilder' to link parent-child nodes
    pipeline = AssemblerPipeline(strategy="hierarchy")
    pipeline.initialize()

    # 3. Run Assembly
    kg_result = pipeline.run(wrapper_output)

    # 4. Inspect Graph
    print(f"Nodes: {kg_result['summary']['node_count']}")
    print(f"Edges: {kg_result['summary']['edge_count']}")
    
    for edge in kg_result['edges'][:3]:
        print(f"{edge['source']} --[{edge['type']}]--> {edge['target']}")

if __name__ == "__main__":
    run_demo()

🤝 Contributing

Contributions for new assembly strategies (e.g., constructing graphs based on keyword co-occurrence) are welcome.

📜 License

Apache 2.0 License © 2025 Sayouzone

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

sayou_assembler-0.1.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

sayou_assembler-0.1.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file sayou_assembler-0.1.1.tar.gz.

File metadata

  • Download URL: sayou_assembler-0.1.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sayou_assembler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4ae331e808eea8d558f570c9ccadaff044c7cc0d83064cc7b565f14e53c4ebd5
MD5 822d830590a4362b95af23d300c8a0cb
BLAKE2b-256 a79b4e74c6fbfa9f8063db9d839c7554f58a7e5c9094bac68ff6c365a4a8faf9

See more details on using hashes here.

File details

Details for the file sayou_assembler-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sayou_assembler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78d668d0bb8ee6df342442886bb6432d6ec781a77448238811c9a1d2f8301f6e
MD5 8426f2f924432e7a1933914d932b7246
BLAKE2b-256 7c9eb859da15bd206e3550d9b1f8eb482bb378b2aeaf9e0602531ad1da8a01bc

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