/* ============================================================ Bundled demo fixture. Shape matches exactly what POST /api/diff returns from app.py, so renderResults() in app.js doesn't care whether the data came from the live Flask backend or from here. Derived directly from this repo's own data/doc_v1.txt and data/doc_v2.txt, applying the same extraction rules used in semantic_diff.py's EXTRACT_PROMPT and the same set-diff logic used in compute_diff(). ============================================================ */ const DEMO_FIXTURE = (() => { const kg1 = { entities: [ "Acme Corporation", "San Francisco", "John Smith", "Board of Directors", "Cloud Division", "Legacy Systems Department", "AWS", "Google Cloud", "Engineering Team", "Legal Department", "DataSync Platform", "United States", "Europe" ], relations: [ ["Acme Corporation", "headquartered_in", "San Francisco"], ["Acme Corporation", "led_by", "John Smith"], ["John Smith", "reports_to", "Board of Directors"], ["Acme Corporation", "operates", "Cloud Division"], ["Acme Corporation", "operates", "Legacy Systems Department"], ["Cloud Division", "partners_with", "AWS"], ["Cloud Division", "partners_with", "Google Cloud"], ["Engineering Team", "manages", "DataSync Platform"], ["Acme Corporation", "produces", "DataSync Platform"], ["DataSync Platform", "used_in", "United States"], ["DataSync Platform", "used_in", "Europe"] ] }; const kg2 = { entities: [ "Acme Corporation", "New York", "Jane Doe", "John Smith", "Board of Directors", "AI Research Division", "Data Science Team", "Cloud Division", "AWS", "Engineering Team", "Legal Department", "Operations Group", "Chief Technology Officer", "AcmeSync", "Asia-Pacific" ], relations: [ ["Acme Corporation", "headquartered_in", "New York"], ["Acme Corporation", "led_by", "Jane Doe"], ["Jane Doe", "replaced", "John Smith"], ["Acme Corporation", "operates", "Cloud Division"], ["Acme Corporation", "launched", "AI Research Division"], ["Acme Corporation", "launched", "Data Science Team"], ["Cloud Division", "partners_with", "AWS"], ["Engineering Team", "manages", "AI Research Division"], ["Legal Department", "merged_into", "Operations Group"], ["Chief Technology Officer", "reports_to", "Board of Directors"], ["Acme Corporation", "produces", "AcmeSync"], ["AcmeSync", "expanded_to", "Asia-Pacific"] ] }; function diffOf(a, b) { const oldEnts = new Set(a.entities); const newEnts = new Set(b.entities); const key = r => r.join("\u0001"); const oldRels = new Map(a.relations.map(r => [key(r), r])); const newRels = new Map(b.relations.map(r => [key(r), r])); const added_entities = [...newEnts].filter(e => !oldEnts.has(e)).sort(); const removed_entities = [...oldEnts].filter(e => !newEnts.has(e)).sort(); const unchanged_entities = [...oldEnts].filter(e => newEnts.has(e)).sort(); const added_relations = [...newRels.keys()].filter(k => !oldRels.has(k)).map(k => newRels.get(k)); const removed_relations = [...oldRels.keys()].filter(k => !newRels.has(k)).map(k => oldRels.get(k)); const unchanged_relations = [...oldRels.keys()].filter(k => newRels.has(k)).map(k => oldRels.get(k)); return { added_entities, removed_entities, unchanged_entities, added_relations, removed_relations, unchanged_relations }; } const diff = diffOf(kg1, kg2); const summary = "Acme Corporation underwent significant restructuring between the two versions. " + "Leadership changed hands as Jane Doe succeeded John Smith as CEO, and the company relocated its headquarters from San Francisco to New York. " + "Two new units were launched \u2014 the AI Research Division and the Data Science Team \u2014 while the Legacy Systems Department was dissolved and the Legal Department was absorbed into a newly formed Operations Group. " + "The Cloud Division narrowed its partnerships to AWS only, dropping Google Cloud, and the flagship DataSync Platform was rebranded as AcmeSync with expansion into the Asia-Pacific market."; function graphJson(kg) { return { nodes: kg.entities.map(id => ({ id })), links: kg.relations.map(([source, label, target]) => ({ source, target, label })) }; } return { kg1, kg2, diff, summary, graph_json: { v1: graphJson(kg1), v2: graphJson(kg2) }, doc_v1: `Acme Corporation is a technology company headquartered in San Francisco. It is led by CEO John Smith, who reports to the Board of Directors. Acme operates a Cloud Division and a Legacy Systems Department. The Cloud Division maintains partnerships with AWS and Google Cloud. The Engineering Team manages the product infrastructure. The Legal Department oversees compliance and regulatory matters. Acme's main product is the DataSync Platform, which is used by enterprise clients across the United States and Europe.`, doc_v2: `Acme Corporation is a technology company headquartered in New York. It is now led by CEO Jane Doe, who replaced John Smith after his retirement. Acme launched an AI Research Division and a Data Science Team this year. The Cloud Division now partners exclusively with AWS, ending its relationship with Google Cloud. The Engineering Team manages product infrastructure and the new AI Research Division. The Legal Department was merged into the newly formed Operations Group. A Chief Technology Officer role was created, reporting to the Board of Directors. The DataSync Platform was rebranded as AcmeSync and expanded to clients in Asia-Pacific.` }; })();