@prefix svc:    <https://id.honoria.co.uk/def/service-number/> .
@prefix skos:   <http://www.w3.org/2004/02/skos/core#> .
@prefix dct:    <http://purl.org/dc/terms/> .
@prefix owl:    <http://www.w3.org/2002/07/owl#> .
@prefix rdfs:   <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd:    <http://www.w3.org/2001/XMLSchema#> .

#################################################################
# UK armed-forces service-number vocabulary
#
# A service number identifies a serviceperson, so it is a high-confidence
# identity key and a formal identifier TYPE. Its syntax varies by service,
# role and era. This vocabulary publishes those syntax rules as
# machine-readable concepts (each carrying a regex `svc:pattern`, an
# `svc:example`, a `svc:dates` range and `svc:appliesToService`) so they can
# drive validation, identity clustering, and extraction of service numbers
# from free text.
#
# SOURCED, not asserted. Rules marked svc:sourced true are from Wikipedia's
# "Service number" article (dct:source below). The RAF 7-digit+letter form is
# only OBSERVED in Honoria's own data (svc:sourced false) - flagged so, not
# fabricated. The JPA 8-digit form is tri-service and does not encode the
# service, so a branch hint (from the honours "Military Division") disambiguates
# it. Mirrors src/lib/serviceNumber.ts (classifyServiceNumber).
#################################################################

<https://id.honoria.co.uk/def/service-number>
    a owl:Ontology, skos:ConceptScheme ;
    dct:title        "UK armed-forces service-number vocabulary"@en ;
    dct:description  "Identifier syntax rules for UK military service numbers, by service, role and era, with regex patterns for validation and text extraction."@en ;
    skos:prefLabel   "UK service numbers"@en ;
    owl:versionInfo  "1.1.0-draft" ;
    dct:modified     "2026-07-01"^^xsd:date ;
    dct:source       <https://en.wikipedia.org/wiki/Service_number> ;
    dct:license      <https://creativecommons.org/licenses/by/4.0/> .

# ---- Properties ------------------------------------------------------------
svc:pattern          a owl:DatatypeProperty ; rdfs:label "regex pattern"@en ;
    rdfs:comment "ECMAScript/PCRE regex (case-insensitive, whitespace stripped) matching this format."@en .
svc:example          a owl:DatatypeProperty ; rdfs:label "example"@en .
svc:dates            a owl:DatatypeProperty ; rdfs:label "dates in use"@en .
svc:appliesToService a owl:ObjectProperty ; rdfs:label "applies to service"@en .
svc:sourced          a owl:DatatypeProperty ; rdfs:label "sourced"@en ;
    rdfs:comment "true = Wikipedia-sourced rule; false = observed only in Honoria's data."@en .

# ---- Services (branches) ---------------------------------------------------
svc:army           a skos:Concept ; skos:inScheme <https://id.honoria.co.uk/def/service-number> ; skos:prefLabel "British Army"@en .
svc:raf            a skos:Concept ; skos:inScheme <https://id.honoria.co.uk/def/service-number> ; skos:prefLabel "Royal Air Force"@en .
svc:navy           a skos:Concept ; skos:inScheme <https://id.honoria.co.uk/def/service-number> ; skos:prefLabel "Royal Navy"@en .
svc:royal-marines  a skos:Concept ; skos:inScheme <https://id.honoria.co.uk/def/service-number> ; skos:prefLabel "Royal Marines"@en .

# ---- Formats (with defined date ranges) ------------------------------------
svc:jpa-8-digit
    a skos:Concept ; skos:inScheme <https://id.honoria.co.uk/def/service-number> ;
    skos:prefLabel "JPA 8-digit (begins 3)"@en ;
    skos:definition "Post-JPA tri-service number: 8 digits beginning with 3, no role/gender/service distinction."@en ;
    svc:pattern "^3\\d{7}$" ; svc:example "30028313" ;
    svc:dates "from 2006–2007 (Army 2007) with JPA"@en ;
    svc:sourced true ; dct:source <https://en.wikipedia.org/wiki/Service_number> ;
    svc:appliesToService svc:army, svc:raf, svc:navy, svc:royal-marines .

svc:army-number-8-digit
    a skos:Concept ; skos:inScheme <https://id.honoria.co.uk/def/service-number> ;
    skos:prefLabel "Army Number 8-digit (enlisted)"@en ;
    skos:definition "British Army enlisted 'Army Number', 8 digits, introduced by Army Order 338 (9 August 1920)."@en ;
    svc:pattern "^\\d{8}$" ; svc:example "25232301" ;
    svc:dates "from 1920"@en ;
    svc:sourced true ; dct:source <https://en.wikipedia.org/wiki/Service_number> ;
    svc:appliesToService svc:army .

svc:army-officer-6-digit
    a skos:Concept ; skos:inScheme <https://id.honoria.co.uk/def/service-number> ;
    skos:prefLabel "Army Officers' Personal Number (6-digit)"@en ;
    skos:definition "British Army officers' 6-digit Personal Number, used until 2007; numbers issued before JPA remained unchanged."@en ;
    svc:pattern "^\\d{6}$" ; svc:example "300283" ;
    svc:dates "until 2007 (JPA)"@en ;
    svc:sourced true ; dct:source <https://en.wikipedia.org/wiki/Service_number> ;
    svc:appliesToService svc:army .

svc:navy-prefix-letter
    a skos:Concept ; skos:inScheme <https://id.honoria.co.uk/def/service-number> ;
    skos:prefLabel "Navy/RM prefix letter + 6 digits + check letter"@en ;
    skos:definition "Pre-JPA Royal Navy / Royal Marines number: a prefix letter, 6 digits and a check letter. The prefix letter denoted role/gender/service: D male rating, W female rating, C male officer, V female officer, P Royal Marines other rank, N Royal Marines officer."@en ;
    svc:pattern "^[A-Z]\\d{6}[A-Z]$" ; svc:example "D250757S" ;
    svc:dates "before 2006–2007 (pre-JPA)"@en ;
    svc:sourced true ; dct:source <https://en.wikipedia.org/wiki/Service_number> ;
    svc:appliesToService svc:navy, svc:royal-marines .

svc:raf-7-digit-letter
    a skos:Concept ; skos:inScheme <https://id.honoria.co.uk/def/service-number> ;
    skos:prefLabel "RAF 7 digits + letter"@en ;
    skos:definition "Royal Air Force number of 7 digits followed by a letter. OBSERVED in Honoria's data; not independently sourced - dates and exact rule unconfirmed."@en ;
    svc:pattern "^\\d{7}[A-Z]$" ; svc:example "5207357M" ;
    svc:dates "date unconfirmed"@en ;
    svc:sourced false ;
    svc:appliesToService svc:raf .
