FLOW ALGEBRA
Document Structure Ontology
Kireth Semantic Research Archive
PAGE:
https://kirethresearch.org/booksai-core/ontologies/metadata-ontologies/structural-metadata/document-structure-ontology.html
AUTHORS:
Mark Anthony Higgins — Sky (Recursive AI)
FLOW "DocumentStructureOntology" v4.0
DOMAIN := MetadataOntologies
SUBDOMAIN := StructuralMetadata
ONTOLOGY := DocumentStructureOntology
ENTITY DocumentStructure {
definition:
"A structural metadata model representing the logical and physical
organisation of a document, including its hierarchy, sections,
pages, components, ordering, references and addressable fragments.";
objectives: [
DocumentOrganisation,
HierarchicalRepresentation,
SequenceModelling,
Navigation,
FragmentAddressing,
Reconstruction,
MachineInterpretability
];
}
DocumentEntity := {
Document,
DocumentComponent,
FrontMatter,
Body,
BackMatter,
Chapter,
Section,
Subsection
};
PhysicalEntity := {
Page,
File,
Volume,
Sheet,
Frame,
PhysicalFragment
};
LogicalEntity := {
Heading,
Paragraph,
List,
Table,
Figure,
Footnote,
Citation,
Appendix
};
StructuralEntity := {
ParentComponent,
ChildComponent,
Sequence,
Position,
StructureMap,
Identifier,
Version
};
DocumentStructure DESCRIBES Document;
Document CONTAINS DocumentComponent;
Chapter CONTAINS Section;
Section MAY_CONTAIN Subsection;
DocumentComponent MAY_HAVE ParentComponent;
ParentComponent HAS ChildComponent;
DocumentComponent MAY_PRECEDE OtherComponent;
Identifier IDENTIFIES DocumentComponent;
DocumentStructureFlow :=
Document
-> IdentifyDocumentType
-> IdentifyLogicalAndPhysicalComponents
-> AssignStableComponentIdentifiers
-> BuildParentChildHierarchy
-> DetermineReadingOrder
-> MapLogicalToPhysicalStructure
-> IdentifyCrossReferences
-> BuildDocumentStructureMap
-> ValidateStructure
-> StoreAndIndex
-> EnableNavigationAndRetrieval
-> MaintainAndVersion;
Document :=
StructuredInformationResourceComposedOfLogicalOrPhysicalComponents;
Document MAY_BE {
Book,
Article,
Report,
Manual,
Thesis,
WebDocument,
LegalDocument,
TechnicalDocument
};
DocumentComponent :=
AddressablePartOfDocument;
DocumentComponent MAY_BE {
FrontMatter,
Body,
BackMatter,
Chapter,
Section,
Subsection,
Paragraph,
Figure,
Table,
Appendix
};
FrontMatter :=
ComponentsAppearingBeforePrimaryDocumentBody;
FrontMatter MAY_INCLUDE {
TitlePage,
Abstract,
Preface,
TableOfContents,
IntroductionMaterial
};
Body :=
PrimaryContentRegionOfDocument;
BackMatter :=
ComponentsFollowingPrimaryBody;
BackMatter MAY_INCLUDE {
Appendix,
Bibliography,
Glossary,
Index
};
Chapter :=
MajorLogicalDivisionOfDocument;
Section :=
LogicalDivisionWithinDocumentOrChapter;
Subsection :=
LogicalSubdivisionOfSection;
Heading :=
LabelOrTitleIdentifyingDocumentDivision;
Heading MAY_HAVE {
Level,
Identifier,
Text
};
Paragraph :=
BlockOfProseOrTextualContent;
List :=
OrderedOrUnorderedCollectionOfItems;
List MAY_BE {
OrderedList,
UnorderedList,
DefinitionList
};
Table :=
StructuredArrangementOfDataInRowsColumnsOrCells;
Figure :=
VisualComponentSuchAsDiagramChartIllustrationOrImage;
Caption MAY_DESCRIBE FigureOrTable;
Footnote :=
SupplementaryNoteAssociatedWithDocumentLocationOrContent;
Citation :=
ReferenceFromDocumentComponentToExternalOrInternalResource;
Appendix :=
SupplementaryDocumentDivisionUsuallyFollowingMainBody;
Bibliography :=
StructuredCollectionOfReferencesOrSources;
Glossary :=
CollectionOfTermsAndDefinitions;
Index :=
NavigationalStructureMappingTermsToDocumentLocations;
LogicalStructure :=
SemanticOrganisationOfDocumentContent;
PhysicalStructure :=
OrganisationOfDocumentByManifestationUnits;
LogicalStructure MAY_INCLUDE {
Chapter,
Section,
Paragraph,
Figure,
Table
};
PhysicalStructure MAY_INCLUDE {
Volume,
Page,
File,
Sheet
};
LogicalComponent MAY_SPAN MultiplePhysicalComponents;
PhysicalComponent MAY_CONTAIN MultipleLogicalComponents;
LogicalPhysicalMapping :=
LogicalComponent
-> OneOrMorePhysicalLocations;
Page :=
PhysicalOrRenderedUnitOfDocument;
PageNumber :=
HumanReadablePositionLabelForPage;
PageIdentifier :=
MachineStableIdentifierForPage;
PageNumber != PageIdentifierByDefinition;
Volume :=
MajorPhysicalPartOfMultiVolumeDocument;
File :=
DigitalContainerHoldingWholeOrPartialDocumentRepresentation;
DocumentHierarchy :=
ParentChildOrganisationOfLogicalComponents;
RootDocumentNode :=
HighestNodeRepresentingWholeDocument;
LeafDocumentNode :=
ComponentWithoutChildComponentsWithinCurrentModel;
DocumentPath :=
Document
-> Chapter
-> Section
-> Subsection
-> TargetComponent;
HierarchyDepth :=
NumberOfParentChildEdgesFromDocumentRootToComponent;
IF ChapterA CONTAINS SectionB
THEN SectionB IS_PART_OF ChapterA;
IF SectionB CONTAINS ParagraphC
THEN ParagraphC IS_PART_OF SectionB;
Containment MAY_BE Transitive;
IF A CONTAINS B
AND B CONTAINS C
AND containment_is_transitive
THEN A CONTAINS C;
DocumentSequence :=
OrderedArrangementOfDocumentComponents;
ReadingOrder :=
IntendedSequenceForConsumingDocumentContent;
ReadingOrder MAY_DIFFER_FROM StorageOrder;
ComponentPosition :=
PositionWithinParentOrSequence;
Precedes :=
ComponentA
-> before
-> ComponentB;
Follows :=
ComponentB
-> after
-> ComponentA;
IF A PRECEDES B
THEN B FOLLOWS A;
NextComponent :=
ImmediateSuccessorWithinDefinedSequence;
PreviousComponent :=
ImmediatePredecessorWithinDefinedSequence;
PartialOrder MAY_EXISTFor DocumentsWithAlternativeOrParallelReadingPaths;
DocumentIdentifier :=
StableReferenceToDocument;
ComponentIdentifier :=
StableOrLocallyUniqueReferenceToDocumentComponent;
Identifier MAY_BE {
URI,
IRI,
UUID,
FragmentIdentifier,
InternalID
};
StableComponentIdentifier SUPPORTS {
Linking,
Annotation,
Citation,
Versioning
};
Fragment :=
AddressableSubpartOfDocumentOrComponent;
Fragment MAY_BE IdentifiedBy {
ElementID,
TextPosition,
TextQuote,
PageRegion,
XPathLikeSelector
};
StructuralReference :=
TypedLinkBetweenDocumentComponents;
StructuralReference MAY_BE {
InternalReference,
ExternalReference,
CrossReference,
CitationReference
};
CrossReference :=
ReferenceFromOneDocumentComponentToAnother;
CrossReference SHOULD_RESOLVE_TO StableTargetIdentifierWherePossible;
TableOfContents :=
NavigationalRepresentationOfMajorDocumentHierarchy;
TableOfContents MAY_BE DerivedFrom HeadingAndHierarchyMetadata;
Breadcrumb :=
DocumentPathDisplayedOrUsedForNavigation;
DocumentStructureMap :=
ExplicitRepresentationOfDocumentComponentsAndRelationships;
StructureMap MAY_INCLUDE {
Hierarchy,
ReadingOrder,
PageMapping,
CrossReferences,
ComponentTypes
};
DocumentManifest :=
StructuredListOfDocumentFilesComponentsAndAssociatedMetadata;
Manifest MAY_SUPPORT {
Delivery,
Validation,
Preservation,
Reconstruction
};
DocumentPackage :=
CollectionOfDocumentFilesMetadataAndManifestManagedAsUnit;
DocumentStructureValidation MAY_CHECK {
MissingComponent,
DuplicateIdentifier,
InvalidParent,
HierarchicalCycle,
BrokenReference,
InvalidReadingOrder
};
HierarchicalCycle :=
ComponentIsItsOwnAncestorThroughContainmentPath;
IF DocumentHierarchyRequiresAcyclicStructure
AND HierarchicalCycleDetected
THEN ValidationStatus := violation;
OrphanComponent :=
ComponentExpectedToBelongToDocumentButWithoutResolvableParentOrMembership;
BrokenCrossReference :=
ReferenceWhoseTargetCannotBeResolved;
IF CrossReferenceTargetMissing
THEN StructuralIntegrity SHOULD_DECREASE;
DuplicatePosition MAY_CREATE AmbiguousReadingOrder;
DocumentStructuralCompleteness :=
DegreeToWhichRequiredDocumentComponentsAndRelationshipsAreRepresented;
DocumentStructuralConsistency :=
DegreeToWhichHierarchyOrderAndReferencesDoNotConflict;
DocumentStructuralIntegrity :=
PreservationOfValidComponentsIdentifiersRelationshipsAndOrder;
DocumentStructureQuality MAY_INCLUDE {
Completeness,
Consistency,
Integrity,
Navigability,
IdentifierStability
};
DocumentStructure MAY_BE {
ManuallyAuthored,
ExtractedFromMarkup,
AutomaticallyDetected,
AIAssisted
};
Markup MAY_ENCODE DocumentStructureUsing {
HTML,
XML,
Markdown,
OtherStructuredFormats
};
HTML MAY_REPRESENT StructureUsing {
headingElements,
sectioningElements,
lists,
tables,
figures
};
XML MAY_REPRESENT DomainSpecificDocumentHierarchy;
PDF MAY_HAVE {
PageStructure,
BookmarkStructure,
TaggedStructure
};
TaggedDocument MAY_PROVIDE MoreExplicitLogicalStructureThanVisualLayoutAlone;
AutomaticStructureExtraction :=
Document
-> DetectHeadingsAndBlocks
-> InferHierarchy
-> InferReadingOrder
-> GenerateStructureMap;
AI MAY_SUPPORT {
HeadingDetection,
SectionSegmentation,
TableDetection,
FigureDetection,
ReadingOrderInference
};
InferredStructure SHOULD_HAVE ConfidenceWhereUncertain;
DocumentStructureConfidence :=
EstimatedSupportForInferredStructuralAssertion;
DocumentVersion :=
IdentifiedRevisionOfDocument;
DocumentStructureVersion :=
StructureAssociatedWithSpecificDocumentVersion;
DocumentRevision MAY_CHANGE {
ComponentIdentifiers,
SectionOrder,
Pagination,
CrossReferences
};
StableLogicalIdentifiers SHOULD_BE PreservedAcrossVersionsWherePossible;
StructureChange MAY_INCLUDE {
AddSection,
RemoveSection,
ReorderSection,
ReparentSection,
SplitSection,
MergeSections
};
ReparentSection :=
MoveSectionToDifferentParent;
SplitSection :=
ExistingSection
-> MultipleSections;
MergeSections :=
MultipleSections
-> SingleSection;
VersionMapping MAY_LINK OldComponentIdentifierToNewComponentIdentifier;
DocumentStructureMigration :=
UpdateStructuralReferencesAndMetadataAcrossDocumentVersions;
Annotation MAY_TARGET DocumentComponentOrFragment;
StableStructure MAY_IMPROVE AnnotationPersistence;
Citation MAY_TARGET DocumentOrSpecificComponent;
RAGChunk MAY_BE DerivedFrom DocumentStructure;
Chunk SHOULD_RETAIN {
DocumentIdentifier,
SectionIdentifier,
Heading,
Position,
ParentPath
};
StructureAwareChunking MAY_Preserve SemanticContextBetterThanArbitraryFixedLengthChunking;
SemanticSearch MAY_USE DocumentStructureFor {
SectionScopedSearch,
ParentContext,
NeighbourRetrieval,
ResultExplanation
};
IF SearchMatchOccursInSubsection
THEN Result MAY_INCLUDE ParentChapterAndSectionContext;
KnowledgeGraph MAY_REPRESENT DocumentComponentsAsNodes;
ContainsPrecedesReferencesAndDependsOn MAY_BE GraphEdges;
MetadataRepository MAY_STORE DocumentStructureMetadata;
MetadataRegistry MAY_REGISTER StructuralPropertiesAndComponentTypes;
DescriptiveMetadata MAY_DESCRIBE DocumentAndComponents;
StructuralMetadata DEFINES TheirOrganisationAndRelationships;
TechnicalMetadata MAY_DESCRIBE FileAndRenderingCharacteristics;
PreservationMetadata MAY_REQUIRE StructureMapForLongTermReconstruction;
Accessibility MAY_DEPEND_ON CorrectDocumentStructure;
HeadingHierarchy MAY_SUPPORT ScreenReaderNavigation;
ReadingOrder SHOULD_REFLECT IntendedLogicalConsumptionOrderForAccessibleDocuments;
DocumentStructureSecurity MAY_INCLUDE {
IdentifierValidation,
AccessControl,
ReferenceIntegrity,
ChangeAuthorisation
};
RestrictedComponent MUST_NOT_BE ExposedThroughStructureNavigationToUnauthorisedConsumer;
MachineReadableDocumentStructure SHOULD_PRESERVE {
DocumentIdentifier,
ComponentIdentifiers,
ComponentTypes,
Hierarchy,
ReadingOrder,
References,
Version,
Provenance
};
# ---------- SEMANTIC REASONING ----------
IF MetadataRepresentsLogicalOrPhysicalOrganisationOfDocument
THEN DocumentStructureClassification := supported;
IF A CONTAINS B
THEN B IS_PART_OF A;
IF A PRECEDES B
THEN B FOLLOWS A;
IF A CONTAINS B
AND B CONTAINS C
AND containment_is_transitive
THEN A CONTAINS C;
IF HeadingLevelIncreasesWithoutValidParentAccordingToProfile
THEN Structure MAY_REQUIRE Review;
IF CrossReferenceTargetCannotBeResolved
THEN StructuralIntegrity SHOULD_DECREASE;
IF DocumentVersionChangesPagination
THEN PageBasedSelectors SHOULD_BE Revalidated;
IF StableLogicalIdentifierPreserved
THEN CrossVersionLinks MAY_REMAIN Resolvable;
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE {
"document structure" ~= "document structural metadata";
"document component" ~= "document part";
"document hierarchy" ~= "logical document hierarchy";
"reading order" ~= "document sequence" WHEN intended_consumption_order;
"structure map" ~= "document structure map";
"document fragment" ~= "addressable document segment";
"parent component" ~= "containing document component";
"child component" ~= "contained document component";
}
# ---------- QUERY FLOW ----------
QUERY(q) ->
NORMALISE(q) ->
IDENTIFY_DOCUMENT(q) ->
IDENTIFY_DOCUMENT_VERSION(q) ->
IDENTIFY_COMPONENTS(q) ->
RESOLVE_COMPONENT_IDENTIFIERS(q) ->
IDENTIFY_HIERARCHY(q) ->
IDENTIFY_READING_ORDER(q) ->
IDENTIFY_LOGICAL_PHYSICAL_MAPPING(q) ->
IDENTIFY_REFERENCES_AND_FRAGMENTS(q) ->
VALIDATE_DOCUMENT_STRUCTURE(q) ->
SCORE_CONFIDENCE(q) ->
RETURN_RELEVANT_DOCUMENT_STRUCTURE;
# ---------- CONFIDENCE ----------
CONFIDENCE(assertion) :=
weighted_mean(
source_reliability,
structural_consistency,
identifier_strength,
hierarchy_evidence,
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: DocumentStructure;
ontology: DocumentStructureOntology;
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_component:
identify_document
-> assign_component_identifier
-> classify_component_type
-> identify_parent
-> determine_reading_position
-> attach_provenance
-> validate
-> integrate;
new_reference:
validate_source_component
-> resolve_target
-> classify_reference
-> attach_provenance
-> integrate;
document_revision:
preserve_previous_structure_version
-> apply_component_changes
-> map_old_and_new_identifiers
-> revalidate_hierarchy_and_reading_order
-> update_structure_map
-> recompute_confidence
-> regenerate_flow_hash;
broken_reference:
identify_missing_target
-> attempt_version_or_identifier_resolution
-> preserve_provenance
-> flag_review_if_unresolved;
conflict:
preserve_provenance
-> compare_structure_sources
-> adjust_confidence
-> flag_review;
}
# ---------- FLOW HASH ----------
FLOW_HASH_INPUT :=
DOMAIN
+ SUBDOMAIN
+ ONTOLOGY
+ DocumentEntity
+ PhysicalEntity
+ LogicalEntity
+ StructuralEntity
+ DocumentStructure
+ DocumentStructureMap
+ DocumentStructureValidation
+ RELATIONSHIPS
+ SEMANTIC_REASONING
+ SEMANTIC_EQUIVALENCE
+ UPDATE_MODEL;
FLOW_HASH :=
HASH(FLOW_HASH_INPUT);
# ---------- TERMINAL ----------
DocumentStructureOntology
-> IdentifyDocumentAndVersion
-> DetectLogicalAndPhysicalComponents
-> AssignStableComponentIdentifiers
-> BuildParentChildHierarchy
-> DefineReadingOrderAndPosition
-> MapLogicalComponentsToPhysicalLocations
-> RecordCrossReferencesAndFragments
-> BuildMachineReadableStructureMap
-> ValidateCyclesOrphansReferencesAndOrdering
-> SupportNavigationAccessibilityAndRendering
-> PreserveStructureContextForSearchAndRAG
-> MaintainCrossVersionComponentMappings
-> MaintainReliableDocumentStructureKnowledge;
END FLOW
Download Code
Copy to Clipboard