This specification details a model for representing Intervals.

Introduction

This document describes a simple Web vocabulary for representing ordered sets of values with optional lower and upper boundaries. The concept of an Interval used herein is generally identical to that used in mathematics to represent a totally ordered set of values that lie between a lower boundary limit and an upper boundary limit. Each Interval MAY be defined such that either or both of the boundary limits are included ("closed") or excluded ("open") from the actual set of values represented.

For instance, using standard mathematical notation, the range of non-negative integer values between 0 and 10, including the 0 and the 10 itself, can be represented as [0,10], while the a range that excludes those boundaries can be represented as (0,10).

Using the vocabulary defined here, the same value ranges can be represented within Linked Data applications respectively as:

{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "ClosedInterval",
  "lower": 0,
  "upper": 10
}

and,

{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "OpenInterval",
  "lower": 0,
  "upper": 10
}

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [[!RFC2119]].

Examples

Example 1

A simple closed xsd:dateTime interval:
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "ClosedInterval",
  "lower": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  },
  "upper": {
    "@value": "2015-01-03T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}

Example 2

A simple open stepped xsd:Integer interval:
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "OpenInterval",
  "lower": 0,
  "upper": 10,
  "step": 1
}

Classes

Class Description Example
Interval URI: http://ns.jasnell.me/interval#Interval
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "ClosedInterval",
  "lower": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  },
  "upper": {
    "@value": "2015-01-03T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}
Microformats Class: h-interval
Notes:

Represents an interval (or range) of values with optional upper and lower bounds. The lower or upper bounds may each be "closed" or "open". A "closed" (inclusive) bound indicates that the given value is part of the interval while an "open" (exclusive) bound does not include the value. The Interval class is considered abstract and is not intended to serve as a base class for the other more specific Interval subclasses defined by this specification. It is not intended to be used directly by implementations.

The value types of an Interval's upper and lower boundaries MUST be identical and SHOULD be ordered as defined by [[!XMLSCHEMA-2]]. The definition of Intervals that use non-ordered value types is undefined by this specification.

Properties: upper | lower | step
OpenInterval URI: http://ns.jasnell.me/interval#OpenInterval
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "OpenInterval",
  "lower": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  },
  "upper": {
    "@value": "2015-01-03T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}
Microformats Class: h-interval-open
Notes:

A subclass of Interval whose upper and lower boundaries are "open" (exclusive). That is, the Interval includes all values that are strictly greater than the boundary specified by the lower property and strictly less than the boundary specified by the upper property.

Properties: upper | lower | step
ClosedInterval URI: http://ns.jasnell.me/interval#ClosedInterval
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "ClosedInterval",
  "lower": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  },
  "upper": {
    "@value": "2015-01-03T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}
Microformats Class: h-interval-closed
Notes:

A subclass of Interval whose upper and lower boundaries are "closed" (inclusive). That is, the Interval includes all values that are strictly greater than or equal to the boundary specified by the lower property and strictly less than or equal to the boundary specified by the upper property.

Properties: upper | lower | step
OpenClosedInterval URI: http://ns.jasnell.me/interval#OpenClosedInterval
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "OpenClosedInterval",
  "lower": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  },
  "upper": {
    "@value": "2015-01-03T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}
Microformats Class: h-interval-open-closed
Notes:

A subclass of Interval with an "open" lower bound and "closed" upper bound. That is, the Interval includes all values that are strictly greater than the boundary specified by the lower property and strictly less than or equal to the boundary specified by the upper property.

Properties: upper | lower | step
ClosedOpenInterval URI: http://ns.jasnell.me/interval#ClosedOpenInterval
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "ClosedOpenInterval",
  "lower": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  },
  "upper": {
    "@value": "2015-01-03T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}
Microformats Class: h-interval-closed-open
Notes:

A subclass of Interval with a "closed" lower bound and "open" upper bound. That is, the Interval includes all values that are strictly greater than or equal to the boundary specified by the lower property and strictly less than the boundary specified by the upper property.

Properties: upper | lower | step
LeftOpenInterval URI: http://ns.jasnell.me/interval#LeftOpenInterval
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "LeftOpenInterval",
  "lower": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}
Microformats Class: h-interval-left-open
Notes:

A subclass of Interval with an "open" lower bound no "upper" bound. That is, the Interval includes all values that are strictly greater than the boundary specified by the lower property.

Properties: lower | step
LeftClosedInterval URI: http://ns.jasnell.me/interval#LeftClosedInterval
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "LeftClosedInterval",
  "lower": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}
Microformats Class: h-interval-left-closed
Notes:

A subclass of Interval with an "closed" lower bound no "upper" bound. That is, the Interval includes all values that are strictly greater than or equal to the boundary specified by the lower property.

Properties: lower | step
RightOpenInterval URI: http://ns.jasnell.me/interval#RightOpenInterval
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "RightOpenInterval",
  "upper": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}
Microformats Class: h-interval-right-open
Notes:

A subclass of Interval with an "open" upper bound no "lower" bound. That is, the Interval includes all values that are strictly less than the boundary specified by the upper property.

Properties: upper | step
RightClosedInterval URI: http://ns.jasnell.me/interval#RightClosedInterval
{
  "@context": "http://ns.jasnell.me/interval#",
  "@type": "RightClosedInterval",
  "upper": {
    "@value": "2015-01-02T12:34:56Z",
    "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
  }
}
Microformats Class: h-interval-right-closed
Notes:

A subclass of Interval with a "closed" upper bound no "lower" bound. That is, the Interval includes all values that are strictly less than or equal to the boundary specified by the upper property.

Properties: upper | step
EmptyInterval URI: http://ns.jasnell.me/interval#EmptyInterval
Microformats Class: h-interval-empty
Notes:

An instance of Interval that represents an empty, or zero-length interval.

UnboundedInterval URI: http://ns.jasnell.me/interval#UnboundedInterval
Microformats Class: h-interval-unbounded
Notes:

An instance of Interval that represents an unbounded range (i.e. represents all possible values).

Properties

Term Description
upper URI: http://ns.jasnell.me/interval#upper
Microformats Class: {prefix}-upper (e.g. dt-upper, p-upper, etc)
Notes:

Specifies the upper boundary of an Interval. Depending on the type of Interval, the boundary can be "closed" or "open". A "closed" upper boundary means that the Interval covers all values strictly less than or equal to the boundary. An "open" upper boundary means that the Interval covers all values strictly less than the boundary. The value type of the upper property MUST be identical to the value type of the lower property.

Domain: Interval
Range: any
Functional: True
lower URI: http://ns.jasnell.me/interval#lower
Microformats Class: {prefix}-lower (e.g. dt-lower, p-lower, etc)
Notes:

Specifies the lower boundary of an Interval. Depending on the type of Interval, the boundary can be "closed" or "open". A "closed" lower boundary means that the Interval covers all values strictly greater than or equal to the boundary. An "open" lower boundary means that the Interval covers all values strictly greater than the boundary. The value type of the lower property MUST be identical to the value type of the upper property.

Domain: Interval
Range: any
Functional: True
step URI: http://ns.jasnell.me/interval#step
Microformats Class: {prefix}-step (e.g. p-step, etc)
Notes:

By default, an Interval includes all possible values that exist between the lower and upper boundaries. The step property can be used to further refine an interval by specifying a significant interval or skip between values within the specified range. For instance, a numeric closed interval with a lower boundary of 0, an upper boundary of 10, and a step of 1 would contain only the non-decimal integer values [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].

The value of the step property MUST be consistent with the values of the upper and lower properties. For instance, when the upper and lower boundaries specify number values, the step, if specified at all, MUST specify a non-negative numeric value whose value space is consistent. Implementations MUST ignore the step property if it's value is not consistent with the values of the upper and lower boundaries.

Domain: Interval
Range: any
Functional: True

The following table identifies the appropriate XML Schema data type values for step for a selected range of Interval boundary types. Wherever a specific data type is identified, all derived types MAY also be used.

upper/lower Boundary Type step Type
xsd:duration xsd:duration
xsd:dateTime xsd:duration
xsd:nonNegativeInteger Interpreted as number of seconds.
xsd:time xsd:duration
xsd:nonNegativeInteger Interpreted as number of seconds.
xsd:date xsd:duration
xsd:nonNegativeInteger Interpreted as number of seconds.
xsd:gYearMonth xsd:duration Limited to durations of year and month only
xsd:nonNegativeInteger Interpreted as number of months.
xsd:gYear xsd:duration Limited to durations of year only
xsd:nonNegativeInteger Interpreted as number of years.
xsd:gMonthYear xsd:duration Limited to durations of year and month only
xsd:nonNegativeInteger Interpreted as number of months.
xsd:gDay xsd:duration Limited to durations of days only
xsd:nonNegativeInteger Interpreted as number of days.
xsd:gMonth xsd:duration Limited to durations of months only
xsd:nonNegativeInteger Interpreted as number of months.
xsd:float xsd:float >= 0
xsd:nonNegativeInteger
xsd:double xsd:double >= 0
xsd:nonNegativeInteger
xsd:decimal xsd:decimal >= 0
xsd:nonNegativeInteger
@prefix : <http://ns.jasnell.me/interval#> .
@prefix r: <http://ns.jasnell.me/interval#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://ns.jasnell.me/interval#> .

<http://ns.jasnell.me/interval#> a owl:Ontology;
  rdfs:comment "A vocabulary for representing intervals"@en .

:lower a owl:DatatypeProperty, owl:FunctionalProperty ;       
  rdfs:comment "The lower bound of an interval"@en;
  rdfs:domain :Interval .

:upper a owl:DatatypeProperty, owl:FunctionalProperty ;
  rdfs:comment "The upper bound of an interval"@en;
  rdfs:domain :Interval .

:step a owl:DatatypeProperty, owl:FunctionalProperty ;
  rdfs:comment "Specifies the significant step between values in the interval."@en;
  rdfs:domain :Interval .

:Interval a owl:Class ;
  rdfs:comment "Represents an interval of values with optional upper and lower bounds"@en .

:OpenInterval a owl:Class ;
  rdfs:comment "An interval open at both ends"@en ;
  rdfs:subClassOf :Interval .

:ClosedInterval a owl:Class ;
  rdfs:comment "An interval closed at both ends"@en ;
  rdfs:subClassOf :Interval .

:OpenClosedInterval a owl:Class ;
  rdfs:comment "An interval open at the lower bound, closed at the upper "@en ;
  rdfs:subClassOf :Interval .

:ClosedOpenInterval a owl:Class ;
  rdfs:comment "An interval open at the upper bound, closed at the lower "@en ;
  rdfs:subClassOf :Interval.

:LeftOpenInterval a owl:Class ;
  rdfs:comment "An interval open on the lower bound, with no upper bound"@en ;
  rdfs:subClassOf :Interval, 
    [
      a owl:Restriction ;
        owl:onProperty :upper ;
        owl:cardinality "0"^^xsd:nonNegativeInteger .
    ] .

:LeftClosedInterval a owl:Class ;
  rdfs:comment "An interval closed on the lower bound, with no upper bound"@en ;
  rdfs:subClassOf :Interval, 
    [
      a owl:Restriction ;
        owl:onProperty :upper ;
        owl:cardinality "0"^^xsd:nonNegativeInteger .
    ] .

:RightOpenInterval a owl:Class ;
  rdfs:comment "An interval open on the upper bound, with no lower bound"@en ;
  rdfs:subClassOf :Interval, 
    [
      a owl:Restriction ;
        owl:onProperty :lower ;
        owl:cardinality "0"^^xsd:nonNegativeInteger .
    ] .

:RightClosedInterval a owl:Class ;
  rdfs:comment "An interval closed on the upper bound, with no lower bound"@en ;
  rdfs:subClassOf :Interval, 
    [
      a owl:Restriction ;
        owl:onProperty :lower ;
        owl:cardinality "0"^^xsd:nonNegativeInteger .
    ] .

:EmptyInterval a :Interval ;
  rdfs:comment "The empty interval" .

:UnboundedInterval a :Interval ;
  rdfs:comment "An interval that is unbound at either end (contains all possible values)" .

:PositiveIntegers a :LeftOpenInterval ;
  rdfs:comment "Represents all positive integers greater than zero" ;
  :lower "0"^^xsd:nonNegativeInteger ;
  :step "1"^^xsd:nonNegativeInteger .

:NonNegativeIntegers a :LeftClosedInterval ;
  rdfs:comment "Represents all non-negative integers greater than or equal to zero" ;
  :lower "0"^^xsd:nonNegativeInteger ;
  :step "1"^^xsd:nonNegativeInteger .

:NegativeIntegers a :RightClosedInterval ;
  rdfs:comment "Represents all negative integers" ;
  :upper "0"^^xsd:nonPositiveInteger ;
  :step "1"^^xsd:nonNegativeInteger .

:PositiveFloats a :LeftOpenInterval ;
  rdfs:comment "Represents all positive floating point numbers greater than zero" ;
  :lower "0"^^xsd:float.

:NonNegativeFloats a :LeftClosedInterval ;
  rdfs:comment "Represents all positive floating point numbers greater than or equal to zero" ;
  :lower "0"^^xsd:float .

:NegativeFloats a :RightClosedInterval ;
  rdfs:comment "Represents all negative floating point numbers" ;
  :upper "0"^^xsd:float .

:PositiveDoubles a :LeftOpenInterval ;
  rdfs:comment "Represents all positive double precision numbers greater than zero" ;
  :lower "0"^^xsd:double.

:NonNegativeDoubles a :LeftClosedInterval ;
  rdfs:comment "Represents all positive double precision numbers greater than or equal to zero" ;
  :lower "0"^^xsd:double .

:NegativeDoubles a :RightClosedInterval ;
  rdfs:comment "Represents all negative double precision numbers" ;
  :upper "0"^^xsd:double .

:PositiveDecimals a :LeftOpenInterval ;
  rdfs:comment "Represents all positive xsd:decimal numbers greater than zero" ;
  :lower "0"^^xsd:decimal.

:NonNegativeDecimals a :LeftClosedInterval ;
  rdfs:comment "Represents all positive xsd:decimal numbers greater than or equal to zero" ;
  :lower "0"^^xsd:decimal .

:NegativeDecimals a :RightClosedInterval ;
  rdfs:comment "Represents all negative xsd:decimal numbers" ;
  :upper "0"^^xsd:decimal .