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.2.tar.gz (11.3 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.2-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sayou_assembler-0.1.2.tar.gz
  • Upload date:
  • Size: 11.3 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.2.tar.gz
Algorithm Hash digest
SHA256 1ba6365e9485a4f1af555540fc8cce399f8740b406b93c0158fbf919007593aa
MD5 cdfc1a6c474e87ff8aed36f50060ac7f
BLAKE2b-256 2c2651d5774a294c6786cf580ad42df3cd0b38dc7c8016f02142dcf88fc0b6a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sayou_assembler-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 feb1ee7e226e6cda9edf021d6b09b311c9bfcca67fa38d28e3eacb96346a5be7
MD5 542b204e988641436b58e78f10b30f08
BLAKE2b-256 dcb79fa0d4880a2411fa2ee1480ad948977aba2e4de21ab34e425503b7c5d3e6

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