@base <https://periodo.github.io/edtf-ontology/> .

@prefix : <cases/level-2/all-of-set-3.ttl#> .
@prefix edtfo: <edtfo.ttl#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix time: <http://www.w3.org/2006/time#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<> a owl:Ontology ;
  owl:imports <edtfo.ttl>
  .

:When a owl:Class ;
  # The year 1984 and all earlier years.
  # Elements immediately preceeding and/or following as well as the elements
  # represented by a double-dot, all have the same precision.
  edtfo:hasEDTFDateTimeSetDescription "{..1984}" ;
  owl:disjointUnionOf (
    :TimeIn1984
    :TimeInSomeYearBefore1984
    )
  .

:TimeIn1984 a owl:Class ;
  rdfs:subClassOf time:Instant ;
  owl:equivalentClass [
    a owl:Restriction ;
    owl:onProperty time:inDateTime ;
    owl:someValuesFrom :1984
    ]
  .

:TimeInSomeYearBefore1984 a owl:Class ;
  rdfs:subClassOf time:Instant ;
  owl:unionOf (
    [ a owl:Restriction ;
      owl:onProperty time:inDateTime ;
      owl:someValuesFrom :SomeYearBefore1984
      ]
    [ a owl:Restriction ;
      owl:onProperty time:before ;
      owl:someValuesFrom :TimeIn1984
      ]
    )
  .

:YearPrecisionDescription a owl:Class ;
  owl:intersectionOf (
    time:DateTimeDescription
    [ a owl:Restriction ;
      owl:onProperty time:unitType ;
      owl:hasValue time:unitYear
      ]
    )
  .

:1984 a owl:Class ;
  owl:intersectionOf (
    :YearPrecisionDescription
    [ a owl:Restriction ;
      owl:onProperty time:year ;
      owl:hasValue 1984
      ]
    )
  .

:SomeYearBefore1984 a owl:Class ;
  owl:intersectionOf (
    :YearPrecisionDescription
    # year before 1984
    [ a owl:Restriction ;
      owl:onProperty time:year ;
      owl:someValuesFrom [
        a rdfs:Datatype ;
        owl:onDatatype xsd:integer ;
        owl:withRestrictions ([ xsd:maxExclusive 1984 ])
        ]
      ]
    )
  .
