example Denormalize
typeside Ty = literal {
external_types
String -> "java.lang.String"
external_parsers
String -> "x => x"
}
schema NormalizedSchema = literal : Ty {
entities
Male
Female
foreign_keys
mother : Male -> Female
attributes
female_name : Female -> String
male_name : Male -> String
}
instance NormalizedData = literal : NormalizedSchema {
generators
Al Bob Charlie : Male
Ellie Fran : Female
equations
Al.male_name = Albert
Al.mother = Ellie
Bob.male_name = George
Bob.mother = Ellie
Charlie.male_name = Charles
Charlie.mother = Fran
Ellie.female_name = Elaine
Fran.female_name = Francine
}
schema DeNormalizedSchema = literal : Ty {
imports
NormalizedSchema
attributes
mother_name : Male -> String
observation_equations
forall m:Male. mother_name(m) = female_name(mother(m))
}
instance DeNormalizedData = literal : DeNormalizedSchema {
imports
NormalizedData
}
Keywords:
typeside_literal
instance_literal
schema_literal
Options:
instance NormalizedData
FemaleID | female_name |
---|
0 | Elaine |
1 | Francine |
MaleID | male_name | mother |
---|
2 | Albert | 0 |
3 | George | 0 |
4 | Charles | 1 |
instance DeNormalizedData
FemaleID | female_name |
---|
0 | Elaine |
1 | Francine |
MaleID | male_name | mother_name | mother |
---|
2 | Albert | Elaine | 0 |
3 | George | Elaine | 0 |
4 | Charles | Francine | 1 |