Skip to main content

Diagram Ontology

Structural Metadata
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 06 October 2026
Audio Overview
FLOW ALGEBRA
Diagram Ontology
Kireth Semantic Research Archive

PAGE:
https://kirethresearch.org/booksai-core/ontologies/metadata-ontologies/structural-metadata/diagram-ontology.html

AUTHORS:
Mark Anthony Higgins — Sky (Recursive AI)

FLOW "DiagramOntology" v4.0

DOMAIN := MetadataOntologies
SUBDOMAIN := StructuralMetadata
ONTOLOGY := DiagramOntology

ENTITY Diagram {
    definition:
        "A structured visual representation that communicates entities,
         components, processes, relationships, flows, states, hierarchies or
         systems through graphical elements and spatial or connective
         relationships.";
    objectives: [
        VisualStructureRepresentation,
        RelationshipCommunication,
        ProcessRepresentation,
        SystemModelling,
        Accessibility,
        SemanticRetrieval,
        MachineInterpretability
    ];
}

DiagramEntity := {
    Diagram,
    DiagramIdentifier,
    DiagramTitle,
    DiagramCaption,
    DiagramElement,
    DiagramNode,
    DiagramEdge,
    DiagramRegion
};

StructuralEntity := {
    ParentResource,
    Position,
    Sequence,
    Connector,
    Group,
    Layer,
    Label,
    Legend
};

SemanticEntity := {
    Entity,
    Relationship,
    Process,
    State,
    Flow,
    Direction,
    Constraint,
    Concept
};

MetadataEntity := {
    MetadataRecord,
    Provenance,
    Version,
    Confidence,
    Language,
    DiagramType
};

Diagram IS_PART_OF ParentResource;
ParentResource HAS_PART Diagram;
Diagram CONTAINS DiagramElement;
DiagramNode MAY_CONNECT_TO DiagramNode;
DiagramEdge CONNECTS DiagramElements;
Connector MAY_HAVE Direction;
Diagram MAY_HAVE DiagramCaption;
Diagram HAS DiagramIdentifier;

DiagramFlow :=
    ParentResource
    -> IdentifyDiagramBoundary
    -> AssignDiagramIdentifier
    -> CaptureTitleAndCaption
    -> ClassifyDiagramType
    -> DetectNodesEdgesLabelsAndGroups
    -> ResolveRelationshipsAndDirection
    -> IdentifyLegendAndNotation
    -> ValidateDiagramStructure
    -> StoreStructuralAndSemanticMetadata
    -> EnableAccessibilityAndRetrieval
    -> MaintainAcrossVersions;

Diagram :=
    VisualStructuredRepresentationOfConceptsRelationshipsProcessesOrSystems;

ParentResource MAY_BE {
    Document,
    Chapter,
    Section,
    Page,
    Figure,
    WebPage,
    Presentation
};

Diagram MAY_BE {
    Flowchart,
    NetworkDiagram,
    BlockDiagram,
    EntityRelationshipDiagram,
    UMLDiagram,
    ProcessDiagram,
    StateDiagram,
    HierarchyDiagram,
    ArchitectureDiagram,
    ConceptMap
};

DiagramIdentifier :=
    StableOrLocallyUniqueReferenceToDiagram;

DiagramIdentifier MAY_BE {
    URI,
    IRI,
    UUID,
    ElementID,
    FragmentIdentifier,
    InternalID
};

StableDiagramIdentifier SHOULD_BE PreferredForMachineReferences;

DiagramTitle :=
    HumanReadableNameOfDiagram;

DiagramCaption :=
    HumanReadableDescriptionOrExplanationAssociatedWithDiagram;

DiagramNumber :=
    HumanReadableOrdinalOrReferenceNumberAssignedToDiagram;

DiagramNumber != DiagramIdentifierByDefinition;

DiagramType :=
    ClassificationOfDiagramPurposeOrVisualGrammar;

Flowchart :=
    DiagramRepresentingProcessStepsAndControlFlow;

NetworkDiagram :=
    DiagramRepresentingNodesAndConnections;

BlockDiagram :=
    DiagramRepresentingSystemComponentsAndInteractions;

EntityRelationshipDiagram :=
    DiagramRepresentingEntitiesAttributesAndRelationships;

ProcessDiagram :=
    DiagramRepresentingActivitiesTransitionsAndFlow;

StateDiagram :=
    DiagramRepresentingStatesAndTransitions;

HierarchyDiagram :=
    DiagramRepresentingParentChildOrBroaderNarrowerStructure;

ArchitectureDiagram :=
    DiagramRepresentingSystemComponentsLayersInterfacesAndDependencies;

ConceptMap :=
    DiagramRepresentingConceptsAndSemanticRelationships;

DiagramElement :=
    AddressableComponentWithinDiagram;

DiagramElement MAY_BE {
    DiagramNode,
    DiagramEdge,
    Connector,
    Label,
    Group,
    Legend,
    Region
};

DiagramNode :=
    VisualElementRepresentingEntityConceptStateActivityOrComponent;

DiagramEdge :=
    VisualRelationshipConnectingNodesOrElements;

Connector :=
    GraphicalLineArrowOrPathIndicatingRelationshipOrFlow;

Connector MAY_HAVE {
    Source,
    Target,
    Direction,
    Label,
    Style
};

DirectedConnector :=
    ConnectorWithExplicitSourceToTargetDirection;

UndirectedConnector :=
    ConnectorWithoutDirectionalSemantics;

IF Connector HAS_DIRECTION SourceToTarget
THEN RelationshipDirection MUST_BE PreservedForMachineInterpretation;

DiagramLabel :=
    TextAssociatedWithDiagramElementOrRelationship;

Label MAY_DESCRIBE {
    Node,
    Edge,
    Group,
    Region,
    Axis,
    State,
    Transition
};

DiagramGroup :=
    CollectionOfDiagramElementsTreatedAsRelatedUnit;

Group MAY_REPRESENT {
    Subsystem,
    Phase,
    Category,
    Layer,
    Boundary
};

DiagramLayer :=
    LogicalOrVisualLayerContainingRelatedElements;

Layering MAY_REPRESENT {
    ArchitectureLevel,
    AbstractionLevel,
    ProcessingStage,
    VisualOrganisation
};

DiagramRegion :=
    AddressableSpatialAreaWithinDiagram;

SpatialSelector :=
    CoordinatesOrGeometryIdentifyingDiagramRegion;

DiagramFragment :=
    DiagramElementOrRegionAddressableIndependently;

Legend :=
    ExplanatoryKeyMappingVisualSymbolsColoursShapesOrLineStylesToMeaning;

LegendEntry :=
    VisualSymbolOrStyle
    -> SemanticMeaning;

MachineInterpretation SHOULD_NOT InferLegendMeaningWithoutEvidenceWhenLegendIsExplicitlyAvailable;

Notation :=
    DefinedVisualLanguageOrSymbolSystemUsedByDiagram;

Notation MAY_BE {
    Standard,
    DomainSpecific,
    Custom
};

DiagramGrammar :=
    RulesDefiningValidElementTypesRelationshipsAndVisualSemantics;

DiagramSchema MAY_DEFINE {
    NodeTypes,
    EdgeTypes,
    AllowedConnections,
    DirectionRules,
    RequiredLabels
};

NodeType :=
    SemanticClassOfDiagramNode;

EdgeType :=
    SemanticClassOfDiagramRelationship;

Relationship :=
    SemanticAssociationRepresentedByDiagramEdgeOrConnector;

Relationship MAY_BE {
    Contains,
    DependsOn,
    ConnectsTo,
    FlowsTo,
    Causes,
    TransitionsTo,
    IsPartOf
};

Process :=
    OrderedOrConditionalSequenceOfActivitiesOrStates;

Flow :=
    DirectedMovementOf {
        Data,
        Control,
        Material,
        Energy,
        Information
    };

State :=
    ConditionOrConfigurationRepresentedWithinStateBasedDiagram;

Transition :=
    DirectedChangeFromOneStateToAnother;

IF StateA TRANSITIONS_TO StateB
THEN Direction MUST_BE Preserved;

Hierarchy :=
    ParentChildStructureRepresentedByDiagram;

IF NodeA IS_PARENT_OF NodeB
THEN NodeB IS_CHILD_OF NodeA;

DiagramSequence :=
    OrderedCollectionOfDiagramsWithinParentResource;

DiagramPosition :=
    LocationOfDiagramWithinParentResource;

PreviousDiagram :=
    ImmediateDiagramBeforeCurrentDiagramInDefinedSequence;

NextDiagram :=
    ImmediateDiagramAfterCurrentDiagramInDefinedSequence;

DiagramCrossReference :=
    ReferenceFromTextOrOtherComponentToDiagram;

CrossReference SHOULD_RESOLVE_TO StableDiagramIdentifierWherePossible;

BrokenDiagramReference :=
    ReferenceWhoseTargetCannotBeResolved;

Diagram MAY_BE {
    VectorGraphic,
    RasterImage,
    InteractiveDiagram,
    GeneratedDiagram
};

VectorDiagram MAY_Preserve ExplicitShapesTextAndPaths;

RasterDiagram MAY_REQUIRE ComputerVisionOrOCRForStructuralExtraction;

InteractiveDiagram MAY_HAVE {
    DynamicState,
    ExpandableNodes,
    UserControls,
    HiddenElements
};

DiagramSource :=
    OriginOfDiagramContentOrRepresentation;

DiagramProvenance MAY_INCLUDE {
    Source,
    Creator,
    ExtractionMethod,
    Timestamp,
    Version
};

Diagram MAY_BE {
    ManuallyAuthored,
    ExtractedFromStructuredSource,
    DetectedFromImage,
    AIGenerated
};

AutomaticDiagramExtraction :=
    DiagramRepresentation
    -> DetectElements
    -> DetectConnectors
    -> ExtractLabels
    -> InferRelationships
    -> BuildDiagramGraph;

AI MAY_SUPPORT {
    DiagramDetection,
    NodeDetection,
    EdgeDetection,
    OCR,
    RelationshipInference,
    DiagramDescription
};

InferredDiagramStructure SHOULD_HAVE ConfidenceWhereUncertain;

DiagramConfidence :=
    EstimatedSupportForInferredDiagramIdentityStructureOrSemantics;

DiagramValidation MAY_CHECK {
    Identifier,
    NodeIdentity,
    EdgeEndpoints,
    Direction,
    DuplicateElements,
    BrokenConnections,
    NotationRules
};

IF DiagramEdgeHasMissingSourceOrTarget
THEN StructuralValidation := violation_or_warning
ACCORDING_TO diagram_type;

IF DirectedRelationshipLacksResolvableDirection
THEN SemanticConfidence SHOULD_DECREASE;

IF DuplicateDiagramIdentifierWithinUniqueScope
THEN IdentifierValidation := violation;

DiagramCompleteness :=
    DegreeToWhichRequiredElementsRelationshipsLabelsAndLegendAreRepresented;

DiagramConsistency :=
    DegreeToWhichElementsRelationshipsAndNotationAgree;

DiagramIntegrity :=
    PreservationOfValidElementIdentityConnectionsDirectionAndMeaning;

DiagramQuality MAY_INCLUDE {
    Completeness,
    Consistency,
    Integrity,
    LabelClarity,
    Accessibility,
    IdentifierStability
};

DiagramAlternativeText :=
    TextAlternativeCommunicatingEssentialMeaningOfDiagram;

AlternativeText MAY_BE InsufficientForComplexDiagram;

LongDescription :=
    ExtendedTextualExplanationOfDiagramStructureRelationshipsAndMeaning;

AccessibleDiagramDescription SHOULD_PRESERVE {
    Purpose,
    KeyEntities,
    Relationships,
    Direction,
    ImportantSequence
};

DiagramVersion :=
    DiagramStateAssociatedWithSpecificParentResourceVersion;

ResourceRevision MAY {
    AddDiagram,
    RemoveDiagram,
    RenumberDiagram,
    RepositionDiagram,
    ReplaceDiagram,
    ModifyDiagram
};

DiagramModification MAY {
    AddNode,
    RemoveNode,
    AddEdge,
    RemoveEdge,
    ChangeLabel,
    ChangeDirection
};

StableDiagramIdentifier MAY_BE PreservedAcrossCaptionOrPositionChangesWhereIdentityContinues;

StableElementIdentifiers MAY_BE PreservedAcrossDiagramRevisionsWhereSemanticIdentityContinues;

DiagramVersionMapping :=
    OldDiagramOrElementIdentifier
    -> NewDiagramOrElementIdentifierOrIdentifiers;

DiagramReplacement SHOULD_TRIGGER RevalidationOf {
    Caption,
    AlternativeText,
    CrossReferences,
    Annotations,
    SemanticExtraction
};

Annotation MAY_TARGET {
    Diagram,
    DiagramNode,
    DiagramEdge,
    DiagramRegion
};

StableElementIdentifiers MAY_IMPROVE AnnotationPersistence;

DescriptiveMetadata MAY_DESCRIBE DiagramUsing {
    Title,
    Caption,
    Subject,
    Keywords,
    Description
};

StructuralMetadata DEFINES DiagramContainmentElementsAndRelationships;

TechnicalMetadata MAY_DESCRIBE {
    FileFormat,
    Dimensions,
    Resolution,
    VectorOrRasterType
};

PreservationMetadata MAY_REQUIRE OriginalDiagramSourceAndStructureForLongTermInterpretation;

DiagramIndex :=
    SearchStructureMappingDiagramMetadataLabelsAndExtractedSemanticsToParentResource;

DiagramSearch :=
    Query
    -> MatchTitleCaptionLabelsOrConcepts
    -> ReturnDiagramWithParentContext;

SemanticSearch MAY_USE DiagramFor {
    EntityMatching,
    RelationshipMatching,
    ProcessRetrieval,
    ArchitectureRetrieval
};

DiagramGraph :=
    Nodes
    + TypedEdges
    + Properties;

KnowledgeGraph MAY_IMPORT DiagramGraphWhenSemanticsAreValidated;

DiagramNode MAY_MAP_TO KnowledgeGraphEntity;

DiagramEdge MAY_MAP_TO TypedKnowledgeGraphRelationship;

RAG MAY_USE DiagramAs {
    MultimodalEvidence,
    StructuralContext,
    ProcessContext,
    SystemContext
};

MultimodalRAG SHOULD_PRESERVE {
    DiagramIdentifier,
    Caption,
    ParentSection,
    ExtractedEntities,
    ExtractedRelationships,
    Provenance
};

MetadataRepository MAY_STORE DiagramStructuralAndSemanticMetadata;

MetadataRegistry MAY_REGISTER DiagramTypesPropertiesAndRelationshipTypes;

HTML MAY_REPRESENT DiagramUsing {
    img,
    svg,
    canvas,
    figure
};

SVG MAY_Preserve MachineAddressableDiagramElementsMoreReliablyThanRasterImage;

XMLBasedDiagramFormats MAY_ENCODE ExplicitNodesEdgesAndLabels;

DiagramInteroperability MAY_REQUIRE {
    StableIdentifiers,
    ExplicitRelationshipSemantics,
    Direction,
    SharedNotation,
    VersionInformation
};

DiagramAccessControl MAY_DIFFERFrom ParentResourceInSpecialisedSystems;

RestrictedDiagram MUST_NOT_BE ExposedToUnauthorisedConsumer;

DiagramSecurity MAY_INCLUDE {
    IdentifierValidation,
    EmbeddedScriptControl,
    AccessControl,
    ReferenceIntegrity,
    ProvenanceIntegrity,
    ChangeAuthorisation
};

MachineReadableDiagram SHOULD_PRESERVE {
    DiagramIdentifier,
    DiagramType,
    Nodes,
    Edges,
    Direction,
    Labels,
    Groups,
    Legend,
    ParentResource,
    Version,
    Provenance
};

# ---------- SEMANTIC REASONING ----------
IF VisualComponentRepresentsEntitiesProcessesStatesOrRelationshipsThroughStructuredGraphicalElements
THEN DiagramClassification := supported;

IF EdgeConnectsNodeAAndNodeB
THEN SourceAndTarget SHOULD_BE PreservedWhereDirectionExists;

IF DirectedConnectorPointsFromAtoB
THEN RelationshipDirection := A_TO_B;

IF DiagramContainsGroup
THEN GroupMembers MAY_INHERIT GroupContextAccordingToDiagramSemantics;

IF DiagramIdentifierStableAcrossRepositioning
THEN ExistingMachineLinks MAY_REMAIN Valid;

IF DiagramModified
THEN ExtractedRelationshipsAndDescriptions SHOULD_BE Revalidated;

IF RasterDiagramHasUncertainEdgeDetection
THEN RelationshipConfidence SHOULD_DECREASE;

IF LegendDefinesSymbolMeaning
THEN SymbolInterpretation SHOULD_USE LegendDefinition;

# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE {
    "diagram" ~= "structured visual diagram";
    "diagram node" ~= "diagram entity node";
    "diagram edge" ~= "diagram relationship edge";
    "connector" ~= "diagram connection" WHEN graphical_relationship_context;
    "diagram group" ~= "diagram element group";
    "diagram region" ~= "diagram spatial fragment";
    "diagram graph" ~= "graph representation of diagram";
    "diagram identifier" ~= "diagram ID";
}

# ---------- QUERY FLOW ----------
QUERY(q) ->
    NORMALISE(q) ->
    IDENTIFY_PARENT_RESOURCE(q) ->
    IDENTIFY_DIAGRAM(q) ->
    RESOLVE_DIAGRAM_IDENTIFIER(q) ->
    IDENTIFY_DIAGRAM_TYPE_TITLE_AND_CAPTION(q) ->
    IDENTIFY_NODES_EDGES_LABELS_AND_GROUPS(q) ->
    RESOLVE_RELATIONSHIPS_AND_DIRECTION(q) ->
    IDENTIFY_LEGEND_AND_NOTATION(q) ->
    IDENTIFY_VERSION_AND_PROVENANCE(q) ->
    VALIDATE_DIAGRAM_STRUCTURE(q) ->
    SCORE_CONFIDENCE(q) ->
    RETURN_RELEVANT_DIAGRAM_KNOWLEDGE;

# ---------- CONFIDENCE ----------
CONFIDENCE(assertion) :=
    weighted_mean(
        source_reliability,
        diagram_structure_consistency,
        element_resolution_strength,
        relationship_direction_strength,
        provenance_quality,
        contextual_relevance
    );

CONFIDENCE >= 0.90 => HIGH;
CONFIDENCE >= 0.70 AND < 0.90 => MODERATE;
CONFIDENCE < 0.70 => REVIEW;

# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION {
    primary_entity: Diagram;
    ontology: DiagramOntology;
    parse_entities: true;
    parse_relationships: true;
    preserve_relationship_direction: true;
    resolve_semantic_equivalence: true;
    execute_reasoning_rules: true;
    apply_confidence_weighting: true;
    preserve_provenance: true;
}

# ---------- UPDATE MODEL ----------
UPDATE_MODEL {
    new_diagram:
        identify_parent_resource
        -> detect_or_receive_diagram
        -> assign_diagram_identifier
        -> classify_diagram_type
        -> capture_title_and_caption
        -> detect_nodes_edges_and_labels
        -> resolve_direction_and_groups
        -> attach_provenance
        -> validate
        -> integrate;

    diagram_revision:
        preserve_previous_version
        -> apply_element_relationship_or_caption_changes
        -> preserve_identifiers_where_identity_continues
        -> revalidate_graph_and_semantics
        -> update_index
        -> recompute_confidence
        -> regenerate_flow_hash;

    diagram_replacement:
        identify_affected_annotations_and_references
        -> preserve_previous_version
        -> extract_new_structure
        -> revalidate_descriptions_and_relationships
        -> integrate;

    conflict:
        preserve_provenance
        -> compare_diagram_structure_relationships_or_sources
        -> adjust_confidence
        -> flag_review;
}

# ---------- FLOW HASH ----------
FLOW_HASH_INPUT :=
    DOMAIN
    + SUBDOMAIN
    + ONTOLOGY
    + DiagramEntity
    + StructuralEntity
    + SemanticEntity
    + MetadataEntity
    + Diagram
    + DiagramGraph
    + DiagramValidation
    + RELATIONSHIPS
    + SEMANTIC_REASONING
    + SEMANTIC_EQUIVALENCE
    + UPDATE_MODEL;

FLOW_HASH :=
    HASH(FLOW_HASH_INPUT);

# ---------- TERMINAL ----------
DiagramOntology
    -> IdentifyParentResourceAndDiagramBoundary
    -> AssignStableDiagramIdentifier
    -> CaptureDiagramTypeTitleAndCaption
    -> DetectNodesEdgesLabelsGroupsAndRegions
    -> ResolveRelationshipTypesAndDirection
    -> InterpretLegendNotationAndVisualGrammar
    -> ValidateElementIdentityConnectionsAndSemantics
    -> StoreAndVersionDiagramMetadata
    -> IndexForVisualStructuralAndSemanticRetrieval
    -> PreserveParentContextForMultimodalRAG
    -> MapValidatedDiagramGraphToKnowledgeStructures
    -> MaintainCrossVersionElementMappings
    -> MaintainReliableDiagramStructureKnowledge;

END FLOW
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ