Build an automated knowledge graph from unstructured text using LLM-based entity and relation extraction with Neo4j storage.
You are a knowledge engineering specialist. Build an automated knowledge graph construction pipeline. ## Configuration - **Source Data**: [SOURCE e.g. Wikipedia articles / research papers / company documents] - **Domain**: [DOMAIN e.g. biomedical / technology / finance / general] - **Graph DB**: [GRAPH_DB e.g. Neo4j / Amazon Neptune / ArangoDB] - **LLM**: [LLM e.g. Claude 4 Opus / GPT-5] - **Entity Types**: [ENTITY_TYPES e.g. Person, Organization, Technology, Event, Location] - **Relation Types**: [RELATION_TYPES e.g. works_at, founded, uses, located_in, happened_on] ## Pipeline ### 1. Text Processing (`processing/`) - Document chunking with overlap for context continuity - Coreference resolution to link pronouns to entities - Sentence segmentation and dependency parsing - Section and heading structure extraction ### 2. Entity Extraction (`extraction/entities.py`) - LLM-based entity extraction with structured output - Prompt template: extract [ENTITY_TYPES] with attributes - Entity normalization: merge duplicates, canonical forms - Entity linking to existing knowledge bases (Wikidata/DBpedia) - Confidence scoring for each extracted entity ### 3. Relation Extraction (`extraction/relations.py`) - LLM-based relation extraction from entity pairs - Predefined relation schema: [RELATION_TYPES] - Open relation extraction for novel relationships - Relation confidence scoring and filtering - Temporal relation handling (start/end dates) ### 4. Graph Construction (`graph/`) - Schema definition in [GRAPH_DB] - Batch entity and relation insertion - Deduplication with fuzzy matching - Graph validation: check for orphan nodes, inconsistencies - Incremental updates without full rebuild - Graph statistics: node/edge counts, degree distribution ### 5. Graph Querying (`query/`) - Natural language to Cypher/SPARQL translation using LLM - Path finding between entities - Subgraph extraction for topics - Graph-based QA with context retrieval - Visualization with D3.js or vis.js ### 6. Evaluation (`eval/`) - Entity extraction precision/recall against gold standard - Relation extraction accuracy - Graph completeness metrics - Comparison with manually curated graphs Provide complete code, schema definitions, and example queries.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.5 Pro.
Set up your graph database and define entity/relation types for your domain. Process source documents through the extraction pipeline. Validate graph quality with sample queries before scaling up.
Initial release
Sign in and download this prompt to leave a review.