Stratashape · proof of concept for a new project · CeramiX stratigraphic units · Oxigraph (SPARQL 1.1, WebAssembly) in the page

The Harris laws of stratigraphy, checked with SHACL

Célian Ringwald and Anaïs Guillem · source code on Codeberg · references

This page explains how a stratigraphic unit is described in RDF and how each SHACL shape turns a Harris law into a check. It then replays a full validation and the interface of the recording app. Every table, matrix and validation report below is read from one RDF dataset, loaded into a SPARQL engine running in your browser. Each block names the query that produced it, and the app's SPARQL tab lets you write your own.

Loading the RDF dataset…data/showcase.trig into Oxigraph
Part 1

What a stratigraphic unit is

A stratigraphic unit (SU, Italian unità stratigrafica, French unité stratigraphique) is the smallest event an archaeologist isolates in the ground: one layer of soil, one wall, one pit. Each unit gets a number and a recording sheet.

Units come in two natures. A deposit has volume: a layer, a fill, a wall. An interface has no volume: it is the surface left by removal, such as the edge of a pit or trench. CRMarchaeo calls them A2 Stratigraphic Volume Unit and A3 Stratigraphic Interface.

Units are tied by physical relations read off the section: a unit covers another, an interface cuts a unit, a deposit fills an interface. Each reads "the subject is later than the object". From them the Harris laws derive the relative chronology, drawn as a Harris matrix.

Schematic section

Section with a topsoil A covering a pit D filled by E, cut into layers B and C US A · deposit (topsoil) US B · deposit (silt) US C · deposit (natural) US E · fill US D · interface (pit cut) ground surface ↑ later ↓ earlier
  • US AcoversUS E, US B
  • US EfillsUS D
  • US DcutsUS B, US C
  • US BcoversUS C

From the CeramiX model to a vocabulary the laws can use

The first CeramiX representation had a class cer:StraigraphicUnit (spelling kept from the original diagram) and one undirected property cer:hasPhysicalRelation, the equivalent of CRMarchaeo AP11. An undirected relation cannot say which unit is on top, so it cannot drive Harris reasoning. The vocabulary specialises it and adds the descriptors each law needs. The table lists the properties of kg/harris_vocab.ttl. The last column is computed by walking the shapes graph to find the shapes that constrain each property.

Waiting for the store…

One unit, read from the store

US 12 of the hypothetical section is the backfill of a foundation trench: an architectural deposit, tilted because it follows the sides of the trench US 5 that it fills. Each statement is a field of the SU sheet, and each field is checked by a shape below.

…
Part 2 · graph kg/shapes ← kg/harris_shapes.ttl, kg/rules ← kg/harris_rules.ttl

The SHACL rules, one by one

One record shape fixes the structure of a unit, five shapes encode the five Harris laws, and a separate rule derives the temporal order. Only SHACL Core and SPARQL-based constraints are used, with no recursive shapes. A contradiction is a Violation. A breach that may be legitimate, or is merely redundant, is a Warning.

Waiting for the store…

Each test comes from kg/test_law_examples.py: a fictional ten-unit site per law, valid as written, then one recording error. The error and the pySHACL reports, before and after, are stored as named graphs and read here.

S0 · The SU record

Violation
hs:StratigraphicUnitShape · targets cer:StraigraphicUnit

Before any law, a unit must be a well-formed record: exactly one label, exactly one nature, at most one disposition, and relations that point to other units. cer:fills and cer:depositedInBasin must point to an interface, through hs:InterfaceShape. The closing sh:or states that only an interface can cut. Each constraint also gives a field of the data-entry form.

Waiting for the store…

hs:StratigraphicUnitShape a sh:NodeShape ;
  sh:targetClass cer:StraigraphicUnit ;
  sh:property [ sh:path rdfs:label ;
    sh:minCount 1 ; sh:maxCount 1 ; sh:datatype xsd:string ] ;
  sh:property [ sh:path cer:unitNature ;
    sh:minCount 1 ; sh:maxCount 1 ;
    sh:in ( cer:Deposit cer:Interface ) ] ;
  sh:property [ sh:path cer:disposition ;
    sh:maxCount 1 ; sh:in ( cer:Horizontal cer:Tilted ) ] ;
  sh:property [ sh:path cer:hasVerticalEdge ;
    sh:maxCount 1 ; sh:datatype xsd:boolean ] ;
  sh:property [ sh:path cer:covers ; sh:class cer:StraigraphicUnit ] ;
  sh:property [ sh:path cer:cuts   ; sh:class cer:StraigraphicUnit ] ;
  sh:property [ sh:path cer:fills  ; sh:node hs:InterfaceShape ] ;
  sh:property [ sh:path cer:depositedInBasin ;
                sh:node hs:InterfaceShape ] ;
  sh:property [ sh:path cer:isPosteriorTo ;
                sh:class cer:StraigraphicUnit ] ;
  # only an interface can cut
  sh:message "Only an interface (cut) can cut another unit." ;
  sh:or ( [ sh:path cer:cuts ; sh:maxCount 0 ]
          [ sh:path cer:unitNature ; sh:hasValue cer:Interface ] ) .

hs:InterfaceShape a sh:NodeShape ;
  sh:class cer:StraigraphicUnit ;
  sh:property [ sh:path cer:unitNature ; sh:hasValue cer:Interface ] .

L1 · Law of superposition

Violation
hs:L1_Superposition · two SPARQL constraints
Upper units are younger, lower units are older.

The order induced by covers, cuts and fills must be a strict partial order. The first constraint finds a unit that lies, through one or more relations, above itself: a cycle. The second compares a recorded isPosteriorTo with the physical sequence. A SPARQL property path replaces a recursive shape, so the result stays defined on cyclic data.

Waiting for the store…

hs:L1_Superposition a sh:NodeShape ;
  sh:targetClass cer:StraigraphicUnit ;
  sh:sparql [ a sh:SPARQLConstraint ;
    sh:message "Law of superposition: {$this} lies,
      directly or indirectly, above itself
      (cycle in the stratigraphic sequence)." ;
    sh:prefixes hs: ;
    sh:select """
      SELECT $this WHERE {
        $this (cer:covers|cer:cuts|cer:fills)+ $this .
      }""" ] ;
  sh:sparql [ a sh:SPARQLConstraint ;
    sh:message "Law of superposition: {$this} is recorded
      as later than {?value}, but lies below it." ;
    sh:prefixes hs: ;
    sh:select """
      SELECT $this ?value WHERE {
        $this cer:isPosteriorTo ?value .
        ?value (cer:covers|cer:cuts|cer:fills)+ $this .
      }""" ] .

L5 · Law of original consolidation

Violation
hs:L5_Consolidation · Core property shape
Architectural stratigraphy is distinguished from other types of stratigraphy.

Each unit is classified as soil or architectural stratigraphy, exactly once. It comes before L2 because L2 depends on it: hs:SoilDepositShape decides whether horizontality is expected at all. A wall can lean without breaking anything.

Waiting for the store…

hs:L5_Consolidation a sh:NodeShape ;
  sh:targetClass cer:StraigraphicUnit ;
  sh:property [
    sh:path cer:stratigraphyType ;
    sh:minCount 1 ; sh:maxCount 1 ;
    sh:in ( cer:Soil cer:Architectural ) ;
    sh:message "Law of original consolidation: each unit
      must be classified as soil or architectural
      stratigraphy." ] .

hs:SoilDepositShape a sh:NodeShape ;
  sh:property [ sh:path cer:stratigraphyType ;
                sh:hasValue cer:Soil ] ;
  sh:property [ sh:path cer:unitNature ;
                sh:hasValue cer:Deposit ] .

L2 · Law of original horizontality

Warning
hs:L2_Horizontality · Core sh:or
A layer deposited in an unconsolidated form tends towards a horizontal disposition. A tilted layer was either deposited that way or follows the contours of a pre-existing basin.

A unit passes if it is not a soil deposit, is not tilted, fills something, or has a recorded basin. A tilted soil deposit with none of these raises a warning, since the law allows it to have been laid down tilted: the warning asks for the basin to be recorded.

Waiting for the store…

hs:L2_Horizontality a sh:NodeShape ;
  sh:targetClass cer:StraigraphicUnit ;
  sh:severity sh:Warning ;
  sh:message "Law of original horizontality: tilted soil
    deposit with no recorded basin of deposition." ;
  sh:or (
    [ sh:not hs:SoilDepositShape ]
    [ sh:not [ sh:path cer:disposition ;
               sh:hasValue cer:Tilted ] ]
    [ sh:path cer:fills ; sh:minCount 1 ]
    [ sh:path cer:depositedInBasin ; sh:minCount 1 ]
  ) .

L3 · Law of original continuity

Violation
hs:L3_Continuity · Core sh:or with an inverse path
If any edge of the deposit is exposed in a vertical plane, part of its original extent has been removed: its continuity must be sought, or its absence explained.

A unit with a vertical edge needs an explanation: a recorded cut (some interface cuts it, found with sh:inversePath) or an explicit cer:continuityExplainedBy, such as the limit of excavation. Without either, the record is incomplete.

Waiting for the store…

hs:L3_Continuity a sh:NodeShape ;
  sh:targetClass cer:StraigraphicUnit ;
  sh:message "Law of original continuity: vertical edge
    with no cut or other explanation for the missing
    continuity." ;
  sh:or (
    [ sh:not [ sh:path cer:hasVerticalEdge ;
               sh:hasValue true ] ]
    [ sh:path [ sh:inversePath cer:cuts ] ;
      sh:minCount 1 ]
    [ sh:path cer:continuityExplainedBy ;
      sh:minCount 1 ]
  ) .

L4 · Law of stratigraphic succession

Warning
hs:L4_Succession · SPARQL constraint
A unit takes its place in the sequence from the undermost unit above it and the uppermost unit below it; all other superpositional relations are redundant.

A direct covers also reachable through a chain of two or more relations is redundant. It is not false, so the shape raises a warning. Removing such relations keeps the Harris matrix minimal.

Waiting for the store…

hs:L4_Succession a sh:NodeShape ;
  sh:targetClass cer:StraigraphicUnit ;
  sh:severity sh:Warning ;
  sh:sparql [ a sh:SPARQLConstraint ;
    sh:message "Law of stratigraphic succession: {$this}
      covers {?value} is redundant (implied by a longer
      sequence)." ;
    sh:prefixes hs: ;
    sh:select """
      SELECT $this ?value WHERE {
        $this cer:covers ?value .
        $this (cer:covers|cer:cuts|cer:fills)
              /(cer:covers|cer:cuts|cer:fills)+ ?value .
      }""" ] .

Inference · from physical to temporal order

SHACL-AF rule
hs:SuperpositionRules · graph kg/rules

The inference side of superposition lives in a separate shapes graph, so validation only checks what was recorded. The rule is the counterpart of the SWRL rule of Guillem et al. (2024), geo:ehCovers(?i, ?j) → time:after(?i, ?j). The app adds web/shapes/harris_inference.ttl (graph kg/inference-rules), which turns the order into time:after and closes it under transitivity and contemporaneity.

The Harris matrices on this page keep only the relations with no intermediate unit (the transitive reduction), computed by the query on the right.

hs:SuperpositionRules a sh:NodeShape ;
  sh:targetClass cer:StraigraphicUnit ;
  sh:rule [ a sh:SPARQLRule ;
    sh:prefixes hs: ;
    sh:construct """
      CONSTRUCT { $this cer:isPosteriorTo ?lower . }
      WHERE { $this (cer:covers|cer:cuts|cer:fills) ?lower . }
    """ ] .

    
Part 3 · graphs kg/fig3, scenario/S0…S5/* ← kg/test_harris.py

Complete validation example: the hypothetical section of Guillem et al. (2024), Fig. 3

Twelve units, after Mantegari et al. (2007), reconstructed from the text of Guillem et al. Validation ran in pySHACL with RDFS inference and advanced=True. Five scenarios replay typical post-excavation corrections, one law each. For every scenario the store holds the corrected data, the triples added and removed, and the SHACL report as pySHACL wrote it.

The record, from top to bottom

Waiting for the store…

The data file marks some relations as reconstructions with Turtle comments. Comments are not RDF, so they do not reach the store. Modelling that flag would make it queryable, for example with cer:uncertainRelationTo as the app already does.

Replay the scenarios

Harris matrix of the scenario data

Red: violationOrange: warningRed arrows: cycle

Change to the record


          

Validation report

    What the example shows, and what it does not

    • Every scenario triggers the shape of its target law, and the baseline has no violation. The single baseline warning (US 1 covers US 11, redundant given US 9) matches the example discussed by Guillem et al.
    • One error can produce several results: in S1 a single added relation gives one cycle violation per unit on the cycle, an order violation, and extra redundancy warnings.
    • Compared with the published matrix, the reconstructed data reproduces 49 of 64 ordered pairs. Two are reversed, both caused by the reconstructed su:10 cer:covers su:7, and thirteen are missing.
    • The shapes check the coherence of a record, not its faithfulness to the ground.
    Part 4 · web/ · graphs <survey>/state/N/* and the app's provenance

    The recording app, on the same data

    The Flask app Journal de fouille (web/app.py) records units on site, validates every save against the Harris shapes and keeps each state of the graph with OCDM provenance. Below is a static replica of its survey view. For each state, the export holds the observed graph, the triples inferred by the app's rules and the SHACL report, all computed by the app's own code. The labels and descriptions are the app's French data. As in the app, the spatial panel draws the observed relations: the Fig. 3 session on its schematic section, redrawn after Mantegari et al. (2007), and the other surveys as a network of RCC8 relations. Data entry is not replicated: this view is read-only.

    Journal de fouillestatic replica · Oxigraph in the browser
    Waiting for the store…

    SHACL report of each state: red, violations; orange, warnings; green, conforms.

    Spatial (observed) ·

    Temporal (inferred) · Harris matrix at this state

    Yellow: new unitRed / orange: unit named in the reportDashed: hypothesisDouble line: contemporary
    Previous work

    References

    This proof of concept builds directly on the formalisation of the Harris laws by Guillem et al. (2024) and reuses the hypothetical section of their Fig. 3, itself after Mantegari et al. (2007).

    1. Harris, E.C. (1979). The Laws of Archaeological Stratigraphy. World Archaeology, 11, 111–117. doi:10.1080/00438243.1979.9979753
    2. Mantegari, G., Mosca, A., Cattani, M. (2007). Formal Knowledge Representation and Automated Reasoning for the Study of Archaeological Stratigraphy.
    3. Nys, G.-A., Van Ruymbeke, M., Billen, R. (2018). Spatio-Temporal Reasoning in CIDOC CRM: A Hybrid Ontology with GeoSPARQL and OWL-Time. CEUR Workshop Proceedings, 2230. orbi.uliege.be/handle/2268/228461
    4. Guillem, A., Gros, A., Réby, K., Abergel, V., De Luca, L. (2023). RCC8 for CIDOC CRM: Semantic Modeling of Mereological and Topological Spatial Relations in Notre-Dame de Paris. SWODCH'23, Athens. hal-04275714
    5. Katsianis, M. et al. (2023). Semantic Modelling of Archaeological Excavation Data: A Review of the Current State of the Art and a Roadmap of Activities. Internet Archaeology. doi:10.11141/ia.64.12
    6. Guillem, A., van Ruymbeke, M., Eide, Ø., De Luca, L. (2024). Spatio-Temporal Reasoning on Stratigraphic Data in Archaeology: Formalization of the Harris Laws as Inferences Using CIDOC CRM. SWODCH'24, Tours. CEUR Workshop Proceedings, 3809. ceur-ws.org/Vol-3809/paper6.pdf
    7. Robaldo, L., Batsakis, S. (2026). On the Interplay Between Validation and Inference in Shapes Constraint Language: An Investigation on the Time Ontology. Semantic Web, 17(3). doi:10.1177/22104968261440710
    8. Knublauch, H., Kontokostas, D. (2017). Shapes Constraint Language (SHACL). W3C Recommendation. w3.org/TR/shacl
    9. Knublauch, H., Allemang, D., Steyskal, S. (2017). SHACL Advanced Features. W3C Working Group Note. w3.org/TR/shacl-af
    10. W3C Data Shapes Working Group. SHACL 1.2 User Interfaces (draft). w3c.github.io/data-shapes/shacl12-ui
    11. Massari, A., Peroni, S. (2025). HERITRACE: A User-Friendly Semantic Data Editor with Change Tracking and Provenance Management for Cultural Heritage Institutions. arXiv:2501.16197

    Software: Oxigraph 0.5.6 (MIT/Apache-2.0), pySHACL, rdflib, shacl-form (MIT).