{"id":28485316,"url":"https://github.com/bdr-pro/graphyml","last_synced_at":"2025-07-23T09:33:40.265Z","repository":{"id":295753918,"uuid":"990886476","full_name":"BDR-Pro/GraphYML","owner":"BDR-Pro","description":"A powerful, interactive Streamlit application to explore, edit, visualize, and query a graph-based database of YAML nodes — ideal for movie metadata, research articles, or structured knowledge graphs.","archived":false,"fork":false,"pushed_at":"2025-05-28T17:49:37.000Z","size":3471,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-02T04:37:05.289Z","etag":null,"topics":["data","database","yaml","yml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BDR-Pro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-26T19:47:24.000Z","updated_at":"2025-05-28T17:49:41.000Z","dependencies_parsed_at":"2025-07-02T04:41:36.775Z","dependency_job_id":null,"html_url":"https://github.com/BDR-Pro/GraphYML","commit_stats":null,"previous_names":["bdr-pro/graphyml"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BDR-Pro/GraphYML","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BDR-Pro%2FGraphYML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BDR-Pro%2FGraphYML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BDR-Pro%2FGraphYML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BDR-Pro%2FGraphYML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BDR-Pro","download_url":"https://codeload.github.com/BDR-Pro/GraphYML/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BDR-Pro%2FGraphYML/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266655329,"owners_count":23963552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data","database","yaml","yml"],"created_at":"2025-06-08T00:09:45.068Z","updated_at":"2025-07-23T09:33:40.234Z","avatar_url":"https://github.com/BDR-Pro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphYML with Dash\n\nA graph-based data management system for YAML files with embedding and querying capabilities, now with a Dash web interface.\n\n## Features\n\n- Store and manage graph data in YAML files\n- Index data for fast querying\n- Generate embeddings for semantic search\n- Query data using a simple query language\n- Automatically link related nodes\n- Find similar nodes using embeddings\n- Comprehensive logging system for debugging\n- Web interface for managing nodes and relationships\n- User authentication and permission management\n- Backup and restore functionality\n\n## Modules\n\n### 1. Indexing Module\n\nThe indexing module provides classes for indexing and searching graph data:\n\n- `BaseIndex`: Base class for all indexes\n- `HashIndex`: Hash-based index for exact matches\n- `BTreeIndex`: B-tree index for range queries\n- `FullTextIndex`: Full-text index for text search\n- `VectorIndex`: Vector index for embedding similarity search\n- `IndexManager`: Manager for multiple indexes\n\n### 2. Embeddings Module\n\nThe embeddings module provides classes and functions for generating and working with embeddings:\n\n- `EmbeddingGenerator`: Class for generating embeddings\n- `embedding_similarity`: Function for calculating cosine similarity between embeddings\n- `batch_generate_embeddings`: Function for generating embeddings for all nodes in a graph\n\n### 3. Graph Operations Module\n\nThe graph operations module provides functions for working with graph data:\n\n- `auto_link_nodes`: Function for automatically linking related nodes\n- `tag_similarity`: Function for calculating similarity between tag lists\n- `a_star`: Function for finding the shortest path between nodes\n- `reconstruct_path`: Function for reconstructing a path from a search\n- `find_similar_nodes`: Function for finding nodes similar to a given node\n\n### 4. Query Engine Module\n\nThe query engine module provides classes and functions for querying graph data:\n\n- `Condition`: Class for representing a query condition\n- `Query`: Class for representing a query\n- `QueryParser`: Class for parsing query strings\n- `query_graph`: Function for querying a graph using a query string\n\n### 5. Data Handler Module\n\nThe data handler module provides functions for loading and saving graph data:\n\n- `validate_node_schema`: Function for validating a node against a schema\n- `load_graph_from_folder`: Function for loading graph data from a folder of YAML files\n- `save_node_to_yaml`: Function for saving a node to a YAML file\n- `create_zip`: Function for creating a ZIP file from a folder\n- `flatten_node`: Function for flattening a node by combining text fields\n- `query_by_tag`: Function for querying a graph by tag\n\n## Installation\n\n### Prerequisites\n\n- Python 3.9 or higher\n- Docker and Docker Compose (optional, for containerized deployment)\n\n### Option 1: Local Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/yourusername/GraphYML.git\n   cd GraphYML\n   ```\n\n2. Install dependencies:\n   ```bash\n   pip install -r requirements_dash.txt\n   ```\n\n3. Run the application:\n   ```bash\n   python run_dash_app.py\n   ```\n\n4. Open your browser and navigate to `http://localhost:8050`\n\n### Option 2: Docker Deployment\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/yourusername/GraphYML.git\n   cd GraphYML\n   ```\n\n2. Build and run with Docker Compose:\n   ```bash\n   docker-compose up -d\n   ```\n\n3. Open your browser and navigate to `http://localhost:8050`\n\n## Usage\n\n### Authentication\n\n- Default admin credentials: username `admin`, password `admin`\n- Create new users through the User Management interface\n\n### Managing Nodes\n\n1. Navigate to the Node Editor to edit existing nodes\n2. Use the Create Node interface to add new nodes\n3. Link nodes by adding references in the node content\n\n### Querying\n\n1. Use the Query Interface to search for nodes\n2. Perform text search, criteria-based search, or similarity search\n\n### Visualization\n\n1. Navigate to the Visualization tab\n2. Choose between clustering or interactive network visualization\n\n### Backup and Restore\n\n1. Navigate to the Management tab\n2. Use the Backup \u0026 Restore interface to create or restore backups\n\n## Embedding LLMs\n\n### Overview\n\nThe embedding module supports multiple embedding providers:\n\n1. **Ollama**: Local embedding generation using Ollama API\n2. **OpenAI**: Cloud-based embedding generation using OpenAI API\n3. **Sentence Transformers**: Local embedding generation using Sentence Transformers library\n4. **Fallback**: Random embedding generation as a last resort\n\n### Configuration\n\nYou can configure the embedding generator using environment variables or a configuration dictionary:\n\n```python\n# Using environment variables\nos.environ[\"OLLAMA_URL\"] = \"http://localhost:11434\"\nos.environ[\"OLLAMA_MODEL\"] = \"all-minilm-l6-v2\"\nos.environ[\"OPENAI_API_KEY\"] = \"your-api-key\"\nos.environ[\"OPENAI_EMBEDDING_MODEL\"] = \"text-embedding-3-small\"\nos.environ[\"ST_MODEL\"] = \"all-MiniLM-L6-v2\"\n\n# Using configuration dictionary\nconfig = {\n    \"ollama_url\": \"http://localhost:11434\",\n    \"ollama_model\": \"all-minilm-l6-v2\",\n    \"openai_api_key\": \"your-api-key\",\n    \"openai_embedding_model\": \"text-embedding-3-small\",\n    \"st_model\": \"all-MiniLM-L6-v2\",\n    \"embedding_dimension\": 384,\n    \"allow_fallback\": True\n}\n\nembedding_generator = EmbeddingGenerator(config)\n```\n\n### Generating Embeddings\n\n```python\n# Generate embedding for a single text\ntext = \"This is a test text for embedding generation.\"\nembedding, error = embedding_generator.generate_embedding(text)\n\n# Generate embeddings for all nodes in a graph\nupdated_graph, errors = batch_generate_embeddings(\n    graph,\n    embedding_generator,\n    text_fields=[\"title\", \"overview\", \"description\"],\n    force_update=False\n)\n```\n\n### Embedding Models\n\n#### Ollama Models\n\n- **all-minilm-l6-v2**: Fast and efficient embedding model\n- **nomic-embed-text**: High-quality text embeddings\n- **mxbai-embed-large**: Multilingual embedding model\n\n#### OpenAI Models\n\n- **text-embedding-3-small**: Fast and cost-effective embeddings (1536 dimensions)\n- **text-embedding-3-large**: High-quality embeddings (3072 dimensions)\n- **text-embedding-ada-002**: Legacy model (1536 dimensions)\n\n#### Sentence Transformers Models\n\n- **all-MiniLM-L6-v2**: Fast and efficient embedding model (384 dimensions)\n- **all-mpnet-base-v2**: High-quality embeddings (768 dimensions)\n- **paraphrase-multilingual-MiniLM-L12-v2**: Multilingual embedding model (384 dimensions)\n\n### Embedding Similarity Search\n\n```python\n# Create a vector index\nindex = VectorIndex(\"embedding_index\", \"embedding\")\n\n# Build the index\nindex.build(graph)\n\n# Search for similar embeddings\nresults = index.search(query_embedding, threshold=0.7, limit=10)\n\n# Find similar nodes\nsimilar_nodes = find_similar_nodes(\n    graph,\n    node_id,\n    similarity_threshold=0.7,\n    max_results=10\n)\n```\n\n## Development\n\n### Project Structure\n\n- `src/dash_app.py`: Main Dash application\n- `src/models/`: Core data models\n- `src/visualization/`: Graph visualization utilities\n- `src/config/`: Configuration management\n- `src/utils/`: Utility functions\n\n### Running Tests\n\n```bash\npytest\n```\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdr-pro%2Fgraphyml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdr-pro%2Fgraphyml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdr-pro%2Fgraphyml/lists"}