Graph projection

python -m scripts.export_graph
python -m scripts.sync_graph
python -m pip install -e '.[graph]'
# Set NEO4J_URI, NEO4J_USERNAME, NEO4J_PASSWORD in the process environment.
python -m scripts.sync_graph --apply

Export writes dist/graph.json. The dry run validates the entire graph without a Neo4j dependency. Applying creates a unique OpenEmotions.id constraint, upserts nodes and relationships, and removes obsolete project-owned edges in one data transaction. Obsolete nodes with external edges are retained, rather than detach-deleting another project's relationships. Concurrent graph writers should be prohibited operationally.

Labels include Emotion, Trigger, Appraisal, Response, Modifier, Transition, IntensityDescriptor, Source, Evidence, Contributor and ExpertReview. Every node also has the OpenEmotions label and namespace=openemotions. Namespaced public IDs are shared with the API.

TRIGGERS is directed from a trigger toward an emotion as an association, not a causal guarantee. APPRAISED_AS connects interpreted concepts; MAY_LEAD_TO connects emotions to response tendencies; MAY_TRANSITION_TO projects transition records between emotions. MODIFIED_BY, ESCALATED_BY, DEESCALATED_BY, SUPPORTED_BY and DISPUTED_BY retain their field predicate. Other explicit references use ASSOCIATED_WITH plus the original predicate. Transition nodes preserve appraisal, trigger and contextual detail alongside the convenient emotion-to-emotion edge.

Each edge has a stable UUID, dataset version, status and qualitative association strength. Claim IDs, claim statuses and source counts appear on structural relationships. Statuses are not aggregated into a truth score. Source support applies to the claim node rather than to every property of its emotion.

MATCH (a:Emotion)-[r:MAY_TRANSITION_TO]->(b:Emotion)
WHERE a.id = 'openemotions:emotion:frustration'
RETURN a.name, b.name, r.evidence_status, r.transition_id;

External references remain in node payloads; the exporter does not invent nodes owned by OpenSensation or fetch another project's graph. A future AI Attributes federation layer can resolve namespace/entity_type/slug triples with independently versioned provenance.