Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kddl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Claude Brisson
kddl
Commits
a96adb40
Commit
a96adb40
authored
4 years ago
by
Claude Brisson
Browse files
Options
Downloads
Patches
Plain Diff
Improve syntax, comment example
parent
42a534ac
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#446
failed
4 years ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
src/commonMain/resources/com/republicate/kddl/grammar.agl
+4
-1
4 additions, 1 deletion
src/commonMain/resources/com/republicate/kddl/grammar.agl
src/commonTest/resources/model.kddl
+18
-11
18 additions, 11 deletions
src/commonTest/resources/model.kddl
with
23 additions
and
12 deletions
.gitignore
+
1
−
0
View file @
a96adb40
.gradle
.idea
build
This diff is collapsed.
Click to expand it.
src/commonMain/resources/com/republicate/kddl/grammar.agl
+
4
−
1
View file @
a96adb40
...
...
@@ -9,10 +9,12 @@ grammar KDDL {
schema = 'schema' NAME ( '{' ( table | link )* '}' )? ;
table = 'table' NAME ( ':' parent )? ( '{' field* '}' )? ;
parent = NAME ;
field = primary_key? NAME ( ':' type optional? | arrow NAME direction? ) ;
field = primary_key? NAME ( ':' type optional?
default?
| arrow NAME direction? ) ;
type = 'boolean' | 'integer' | 'float' | 'double' | 'varchar' '(' INTEGER ')' | 'text' ;
primary_key = '*' ;
optional = '?' ;
default = '=' expression ;
expression = NULL | BOOLEAN | NUMBER | STRING ;
link = NAME '*'? arrow (NAME '.')? NAME direction? ;
arrow = ( '-' | '.' )+ '>' ;
direction = '(' ( 'up' | 'down' | 'left' | 'right' ) ')' ;
...
...
@@ -22,5 +24,6 @@ grammar KDDL {
INTEGER = "[0-9]+" ;
NUMBER = "[0-9]+([.][0-9]+)?" ;
STRING = "'(?:\\?.)*?'" ;
NULL = 'null' ;
}
This diff is collapsed.
Click to expand it.
src/commonTest/resources/model.kddl
+
18
−
11
View file @
a96adb40
database easytarif {
// Definition for database geo
// a database contains schemas
database geo {
// a schema contains tables and links
schema infra {
// a table contains fields, either given a type or a destination table
table zone {
*code : varchar(10)
name : varchar(50)
description : text?
*code : varchar(10) // '*' stands for 'part of pk', otherwise pk is generated as needed
name : varchar(50) // not null by default
description : text? // '?' stands for nullable field
active : boolean = false // default value
}
table department : zone
table department : zone
// inherit a table from another (for engines which support table inheritance like PostgresQL)
table city : zone
table link {
distance : integer
src_id --> zone
dst_id --> zone
distance : integer // standard field
src_id --> zone // mandatory foreign key field
dst_id --> zone // idem
hub_id ..> zone // nullable foreign key field
}
city *--> department (up)
}
schema c
arrier
{
schema c
lient
{
table
hub { tension : float
}
table
location { address : text?
}
hub *--> infra.zone
location *..> infra.zone // foreign key referencing a table in another schema
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment