A tree-sitter grammar for the Simple Domain Modeling Language (SDML). For more information on the language, see the documentation.
``` sdml module Campaign is
import [xsd skos xml:base dc]
@xml:base = https://advertising.amazon.com/api-model
@skos:version = xsd:decimal(2)
datatype Name <- xsd:string is @xsd:minLength = 5 @xsd:maxLength = 25 end
datatype CampaignId <- xsd:string is @skos:prefLabel = [ "Campaign Identifier"@en "Identified de campagne"@fr ] end
structure Tag is key -> xsd:NMTOKEN value -> {0..} rdfs:langStrings end
entity campaign is identity campaignId -> CampaignId
name -> Name is
@skos:definition = ""
end
tag -> {0..} Tag
ref target {0..1} -> {0..} Target
end
entity Target
end ```
Version: 0.1.31
locals.scm
file with scopes for formal constraints.∅
(empty set) as a synonym for []
in constraints.Version: 0.1.30
Version: 0.1.29
simple_value
to value
. This changes it back.Version: 0.1.28
Version: 0.1.27
Version: 0.1.26
Version: 0.1.25
source_cardinality
has been removed.member_inverse_name
has been added.Version: 0.1.24
Version: 0.1.23
Version: 0.1.22
type_definition
to definition
to address the fact that property definitions aren't types.enum_variant
to value_variant
to align with type_variant
on unions.Version: 0.1.21
Version: 0.1.19/0.1.20
Version: 0.1.18
annotation
has been renamed annotation_property
constraint
has been added.annotation
is defined as a choice of annotation_property
or constraint
.``` sdml module example is
import tag
structure Thing is
inner -> {0..} InnerThing is
;; informal
assert same_tags = "All inner tags contain a tag value \"This\"."
;; formal
assert same_tags_formal is
forall self ( not_empty(self) and contains(self.tags "This") )
end
end
end
structure InnerThing is
tags -> {0..} tag:Tag
end
end ```
Version: 0.1.17
Version: 0.1.16
``` sdml module ddict is import account
property accountId is @skos:prefLabel = "accountId"@en @skos:altLabel = "account_id"@en
identifier -> {1} account:AccountId is
@skos:definition = "Used as an identifier for account-scoped things"@en
end
reference ref {1} -> {1} account:AccountId
end
structure Account is accountId as identifier name -> string end
end ```
Version: 0.1.15
``` sdml module ddict is import account
property accountId -> account:AccountId is @skos:prefLabel = "accountId"@en @skos:altLabel = "account_id"@en
identifier is
@skos:definition = "Used as ..."@en
end
default = {1..1}
end
structure Account is accountId as default name -> string end
end
```
Version: 0.1.14
builtin_simple_type
(choice of string
, double
, decimal
, integer
, boolean
, and iri
):
identifier_reference
with new rule data_type_base
for data_type_def
,type_reference
choice used for the member target
field.Allows both:
``` sdml module example is
datatype mystring <- string
structure Person is name -> string age -> integer end end ```
Where the keywords string
and integer
will be expanded into the qualified identifiers sdml:string
and
sdml:integer
respectively.
Version: 0.1.13
base
grammar for module rather than using xml:base
as an attribute.Identifier
to allow decimal digits in any position after the first.TypeVariant
.Introduces:
sdml
module example base <https://example.org/v/example> is
end
Which replaces the annotation form:
```sdml module example is import xml
@xml:base = https://example.org/v/example end ```
Version: 0.1.12
IdentifierReference
valuesTypeVariant
nameVersion: 0.1.11
TypeVariant
annotation
and language_tag
grammar rule conflictIntroduces:
```sdml module example is
union Example is Variant1 Variant1 as Alternative end end ```
This allows the use of the same type as a variant more than once if the new identifier is unique within the same union
.
Version: 0.1.10
Version: 0.1.9
UnionDef
type.Version: 0.1.8
UnionDef
type.Version: 0.1.7
sourceCardinality
into source_cardinality
.targetCardinality
into target_cardinality
.Version: 0.1.6
_simple_value
into simple_value
named rule._type_reference
into type_reference
named rule.