UP | HOME

RFC001: Support versioning of modules
Status: Draft

Table of Contents

Introduction

TBD

Document Status History

Date Status Comment Grammar Version
[2023-12-07 Thu] Draft   0.2.6

Motivation

module provider is end
module consumer is
  import provider
end
module provider_v3 is end
module consumer is
  import [
    provider
    provider_v3
  ]
end

Constructing an Ontology

Alternatives Considered

Using version identifiers

module provider
  base <https://example.org/projects/provider#>
  version "0.3.2"
is
end
module consumer is
  import provider "0.3.2"
end

Using version identifiers and resolver

{
  "base": "https://example.org/projects/",
  "entries": {
    "provider": {
      "item": {
        "relative_uri": "provider#",
        "relative_path": "src/provider.sdm"
      },
      "item": {
        "relative_uri": "provider#",
        "version": "0.3.2",
        "relative_path": "src/provider-v3.sdm"
      }
    }
  }
}

Proposed Change

TBD

Grammar

From

Module
    ::= "module" Identifier ModuleBase? ModuleBody

ModuleBase
    ::= "base" Iri

ModuleBody
    ::= "is"
        ImportStatement* Annotation* Definition*
        "end"

ImportStatement
    ::= "import" ( Import | "[" Import+ "]" )

Import
    ::= MemberImport | ModuleImport

ModuleImport
    ::= Identifer

To

Module
    ::= "module" Identifier ModuleIri? ModuleBody

ModuleIri
    ::= Iri ( "version" Iri )?

ModuleImport
    ::= Identifer ( "=" Iri )?

Resolver File

{
  "uri": "https://example.org/projects/",
  "entries": {
    "provider": {
      "item": {
        "relative_uri": "provider#",
        "relative_path": "src/provider.sdm"
      },
      "item": {
        "relative_uri": "v3/provider#",
        "relative_path": "src/provider-v3.sdm"
      }
    }
  }
}

Created: 2023-12-21 Thu 11:13