{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"https://abstractopedia.org/schemas/typed-dag/relation.v2.schema.json","title":"Encyclopedia of Abstractions typed DAG logical relation v2","description":"One logical typed relation. Directed relations use child -> parent. A composition/part_of relation means the parent is an internal constituent of the child. Mutual pairs are normalized to one record outside directed topology.","type":"object","additionalProperties":false,"required":["relation_id","child_id","child_kind","child_slug","parent_id","parent_kind","parent_slug","edge_type","flavor","qualifier","reason_short","reason","condition_or_exception"],"properties":{"relation_id":{"type":"string","pattern":"^relation-[a-f0-9]{20}$"},"child_id":{"type":"string","pattern":"^(prime|domain_specific):[a-z0-9]+(?:_[a-z0-9]+)*$"},"child_kind":{"type":"string","enum":["prime","domain_specific"]},"child_slug":{"type":"string","pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"parent_id":{"type":"string","pattern":"^(prime|domain_specific):[a-z0-9]+(?:_[a-z0-9]+)*$"},"parent_kind":{"type":"string","enum":["prime","domain_specific"]},"parent_slug":{"type":"string","pattern":"^[a-z0-9]+(?:_[a-z0-9]+)*$"},"edge_type":{"type":"string","enum":["subsumption","composition","decompose","mutual"]},"flavor":{"type":"string","enum":["","presupposes","part_of"]},"qualifier":{"type":"string","enum":["strict","typical","conditional"]},"reason_short":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"condition_or_exception":{"type":"string"},"legacy_flavor_compatibility":{"const":true,"description":"Present only when preserving an inherited flavored non-composition relation. New relations may not use this exception."},"mutual_endpoint_explanations":{"type":"array","description":"The two endpoint-oriented canonical explanation payloads retained when a mirrored mutual source pair is normalized to one logical relation.","minItems":2,"maxItems":2,"items":{"type":"object","additionalProperties":false,"required":["source_node_id","counterpart_node_id","reason_short","reason","condition_or_exception"],"properties":{"source_node_id":{"type":"string","pattern":"^(prime|domain_specific):[a-z0-9]+(?:_[a-z0-9]+)*$"},"counterpart_node_id":{"type":"string","pattern":"^(prime|domain_specific):[a-z0-9]+(?:_[a-z0-9]+)*$"},"reason_short":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"condition_or_exception":{"type":"string"}}}}},"allOf":[{"if":{"properties":{"child_kind":{"const":"prime"}},"required":["child_kind"]},"then":{"properties":{"child_id":{"pattern":"^prime:"}}}},{"if":{"properties":{"child_kind":{"const":"domain_specific"}},"required":["child_kind"]},"then":{"properties":{"child_id":{"pattern":"^domain_specific:"}}}},{"if":{"properties":{"parent_kind":{"const":"prime"}},"required":["parent_kind"]},"then":{"properties":{"parent_id":{"pattern":"^prime:"}}}},{"if":{"properties":{"parent_kind":{"const":"domain_specific"}},"required":["parent_kind"]},"then":{"properties":{"parent_id":{"pattern":"^domain_specific:"}}}},{"if":{"properties":{"edge_type":{"const":"composition"}},"required":["edge_type"]},"then":{"properties":{"flavor":{"enum":["presupposes","part_of"]}},"not":{"required":["legacy_flavor_compatibility"]}},"else":{"oneOf":[{"properties":{"flavor":{"const":""}},"not":{"required":["legacy_flavor_compatibility"]}},{"required":["legacy_flavor_compatibility"],"properties":{"flavor":{"enum":["presupposes","part_of"]},"legacy_flavor_compatibility":{"const":true}}}]}},{"if":{"properties":{"edge_type":{"not":{"const":"mutual"}}},"required":["edge_type"]},"then":{"not":{"properties":{"child_kind":{"const":"prime"},"parent_kind":{"const":"domain_specific"}},"required":["child_kind","parent_kind"]}}},{"if":{"properties":{"edge_type":{"const":"mutual"}},"required":["edge_type"]},"then":{"required":["mutual_endpoint_explanations"]},"else":{"not":{"required":["mutual_endpoint_explanations"]}}}]}
