___ _____ ___
/ /\ / /::\ /__/\
/ /:/_ / /:/\:\ | |::\
/ /:/ /\ / /:/ \:\ | |:|:\ ___ ___
/ /:/ /::\ /__/:/ \__\:| __|__|:|\:\ /__/\ / /\
/__/:/ /:/\:\ \ \:\ / /:/ /__/::::| \:\ \ \:\ / /:/
\ \:\/:/~/:/ \ \:\ /:/ \ \:\~~\__\/ \ \:\ /:/
\ \::/ /:/ \ \:\/:/ \ \:\ \ \:\/:/
\__\/ /:/ \ \::/ \ \:\ \ \::/
/__/:/ \__\/ \ \:\ \__\/
\__\/ Domain \__\/ Language
Simple Modeling
A tree-sitter grammar for the Simple Domain Modeling Language (SDML). For more information on the language, see the documentation.
```sdml module Campaign base https://advertising.amazon.com/api-model is
import [dc skos xsd]
@skos:prefLabel = "Campaign sub-domain"@en @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 id -> CampaignId
name -> Name is
@skos:definition = "the name of the campaign"@en
end
tag -> {0..} Tag
target -> {1..} Target
end
entity Target
end ```
Version: 0.2.2
optional
for the operator "?" to allow for optional values. Also added to type reference rules.parameters
to the rule reference type_class_parameters
in rule type_class_def
.type_variable_subtype
to type_variable_restriction
.type_variable_restriction
.Version: 0.2.1
This release is primarily to implement type classes that allow a better description of the standard library for constraints. Adding this support identified some simplifications in functional terms and sequence builders.
``` sdml module example is class Typed(T) is def hastype(v -> T) → Type is @skos:definition = "Returns the SDML type of the passed value."@en @skos:example = "~typeof(rentals:Customer) = sdml:Entity~" end end end
```
type_class_def
and list it as an alternative in definition
.method_def
and include as member of type_class_def
.wildcard
from rule function_type_reference
, wildcards are only allowed on type class parameters.quantified_sentence
to only have a single quantified variable binding.
binding
in quantified_sentence
to remove the repeat.body
from _quantified_body
to constraint_sentence
.quantifier_bound_names
to quantified_variable
to denote singular.source
in quantified_variable
to use existing term
.type_iterator
and sequence_iterator
.quantified_sentence
as body.
body
in rule sequence_builder
from _variable_binding
to sequence_builder_body
._variable_binding
.sequence_builder_body
which is simply a reference to rule quantified_sentence
.actual_aruments
for use in rules atomic_sentence
and functional_term
._boolean_true
to boolean_truth
._boolean_false
to boolean_falsity
.Version: 0.2.0
This is a significant refactor intended to simplify the grammar, and reduce the number of constructs used where the differentiation is not as significant as it looked previously.
member_by_value
and role_by_value
.member_by_reference
to member
and role_by_reference
to member_role
.ref
from rules member
and member_role
.identity_member
to entity_identity
.structure_body
to structured_body
.structure_group
to member_group
._structured_body_inner
rule.feature_set_def
, and update definition
accordingly.features
into the rule _type_expression_to
.opaque
to datatype definition.:=
throughout for assignment /by definition/.
_by_definition
.value_variant
, function_def
, and constant_def
to use _by_definition
._property_member
to _property_reference
.Version: 0.1.42
features
definition to be or/xor only.
UnionBody
.ebnf
FeatureSetDef
::= "features" Identifier Cardinality? UnionBody?
Version: 0.1.41
feature_set_def
to rule definition
.feature_set_def
.unsigned
.binary
.iri_reference
to iri
.Version: 0.1.40
↦
to the rule _has_type
which works better for some typesetting.inequation
alongside equation
.
inequation
and make it a choice within simple_sentence
.not_equal
, less_than
, less_than_or_equal
, greater_than
, and greater_than_or_equal
.boolean_sentence
into a choice of unary_boolean_sentence
and binary_boolean_sentence
.
unary_boolean_sentence
for negation only.binary_boolean_sentence
for logical connectives.variable_binding
to `binding
in rule quantieid_sentence
._function_type_expression_to
to _function_type
._has_type
and _type_restriction
and allow both ascii and Unicode arrows.
_has_type
for values ->
and →
._type_restriction
for values <-
and ←
.quantified_variable_binding
.quantifier_binding
to quantifier_bound_names
.Version: 0.1.39
_constant_def
to constant_def
.name_path
to function_composition
.quantified_sentence
and sequence_builder
.
quantifier_binding
(along with _bound_name_set
) now used in both sentence and builder.expression
into a field named body
of type constraint_sentence
.expression
and conjunctive_expression
.predicate_value
to match value
and corresponding sequences.Version: 0.1.38
iterator_target
to iterator_source
.from
in type_iterator
to source
.from
in sequence_iterator
to source
.Version: 0.1.37
function_cardinality_expression
to allow sequence constraints.
any_type
to wildcard
.any_cardinality
and replace with wildcard
.list_of_predicate_values
to sequence_of_predicate_values
.list_of_values
to sequence_of_values
.property_role
private as _property_role
._sequence_value_constraints
._sequence_value_constraints
to rule sequence_of_predicate_values
._sequence_value_constraints
to rule sequence_of_values
.Version: 0.1.36
sequence_comprehension
to be more flexible.
sequence_comprehension
to sequence_builder
.returned_value
to variables
and re-write as a choice of:tuple_variable
to return distinct variables.sequence_variable
to return distinct variables as a sequence.mapping_variable
to return two variables as a mapping.Version: 0.1.35
_property_member
to allow property names to be identifier_reference
.
name
in a member will be the name of a role.in
, not as
.role
to property
and made it's type identifier_reference
.Version: 0.1.34
property_role
to be a choice of three new rules.identity_role
which is a subset of identity_member
.role_by_value
which is a subset of member_by_value
.role_by_reference
which is a subset of member_by_reference
.Version: 0.1.33
binding_target
to iterator_target
.binding_type_reference
to type_iterator
and field name from_type
to from
.binding_seq_iterator
to sequence_iterator
and field name from_sequence
to from
.environment_definition
and made naming more consistent.
signature
fieldrhs
to body
and change to a choice of function_def
or _value_def
.function_def
to hold the signature and operators removed from the environment definition.fn_parameter
to function_parameter
._fn_type
to _function_type_expression_to
.function_cardinality_expression
and any_cardinality
to capture cardinality or wildcard.function_type_reference
to allow wildcards.highlights
, locals
, and tags
for all changes above.Version: 0.1.32
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.