RFC001: Support versioning of modules
Status: Draft
Table of Contents
Introduction
TBD
Document Status History
Date | Status | Comment | Grammar Version |
---|---|---|---|
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
Without a base
module provider is end
@base <file:///users/me/sdml/modules/provider#> . @prefix : <file:///users/me/sdml/modules/provider#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix sdml: <https://sdml.io/sdml-owl.ttl#> . : rdf:type owl:Ontology, sdml:Module ; rdfs:label "provider" .
With a base
module provider base <https://example.org/projects/provider#> is end
@base <https://example.org/projects/provider#> . @prefix : <https://example.org/projects/provider#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix sdml: <https://sdml.io/sdml-owl.ttl#> . : rdf:type owl:Ontology, sdml:Module ; rdfs:label "provider" .
With an Owl version info
module provider base <https://example.org/projects/provider#> is @owl:versionInfo "v0.3.2" end
@base <https://example.org/projects/provider#> . @prefix : <https://example.org/projects/provider#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix sdml: <https://sdml.io/sdml-owl.ttl#> . : rdf:type owl:Ontology, sdml:Module ; rdfs:label "provider" ; owl:versionInfo "v0.3.2" .
With an Owl version IRI
module provider base <https://example.org/projects/provider#> is @owl:versionIRI <https://example.org/projects/v3/provider#> end
@base <https://example.org/projects/provider#> . @prefix : <https://example.org/projects/provider#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix sdml: <https://sdml.io/sdml-owl.ttl#> . : rdf:type owl:Ontology, sdml:Module ; rdfs:label "provider" ; owl:versionIRI <https://example.org/projects/v3/provider#> .
Consumer
module consumer is import provider end
@base <file:///users/me/sdml/modules/consumer#> . @prefix : <file:///users/me/sdml/modules/consumer#> . @prefix provider: <https://example.org/projects/provider#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix sdml: <https://sdml.io/sdml-owl.ttl#> . : rdf:type owl:Ontology, sdml:Module ; rdfs:label "consumer" ; owl:imports provider: .
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" } } } }
Using version IRIs
module provider base <https://example.org/projects/provider#> version <https://example.org/projects/v3/provider#> is end
module consumer is import provider <https://example.org/projects/v3/provider#> end
Proposed Change
TBD
Surface Syntax
module provider <https://example.org/projects/provider#> version <https://example.org/projects/v3/provider#> is end
module consumer is import provider <https://example.org/projects/v3/provider#> end
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" } } } }