example Delta

typeside Ty = literal {
	types
		int
	constants
		"100" "150" "200" "250" "300" : int
	external_types
		string -> "java.lang.String"
	external_parsers
		string -> "x => x"
}

schema C = literal : Ty {
 	entities
		T1 T2
 	attributes
		ssn first last : T1 -> string
		first last : T2 -> string
		salary : T2 -> int
}

schema D = literal : Ty {
 	entities
		T
 	attributes
		ssn0 first0 last0 : T -> string
		salary0 : T -> int
}

mapping F = literal : C -> D {
 	entity
		T1 -> T
	attributes
		ssn    -> lambda x:T. ssn0(x) #lambda syntax
		first  -> lambda x. first0(x) #shorter lambda syntax
		last   -> last0

	entity
		T2 -> T
 	attributes
		last   -> last0
		salary -> salary0
		first  -> first0 #path syntax
}

instance J = literal : D {
	generators
		XF667 XF891 XF221 : T
	equations
		XF667.ssn0 = "115-234" XF891.ssn0 = "112-988" XF221.ssn0 = "198-887"
#		XF667.first0 = Bob XF891.first0 = Sue XF221.first0 = Alice
		XF667.last0 = Smith XF891.last0 = Smith XF221.last0 = Jones
		XF667.salary0 = 250 XF891.salary0 = 300 XF221.salary0 = 100
}

instance J2 = random : D {
	generators
		T -> 10
	#options
	#	random_seed = 2
}

instance deltaFJ = delta F J
instance deltaFJ_alt1 = eval (toQuery F) J
instance deltaFJ_alt2 = coeval (toCoQuery F) J

instance J0 = literal : D {
 generators
	XF22 aXF66 XF89  xxx : T
 equations
	aXF66.ssn0 = "115-234" XF89.ssn0 = "112-988" XF22.ssn0 = "198-887"
	# aXF66.first0 = Bob XF89.first0 = Sue 
	XF22.first0 = Alice
	aXF66.last0 = Smith XF89.last0 = Smith XF22.last0 = Jones
	aXF66.salary0 = 250 XF89.salary0 = 300 XF22.salary0 = 100
}

transform h = literal : J -> J0 {
 generators
	 XF667 -> aXF66
	 XF891 -> XF89
	 XF221 -> XF22
}

transform h0 = delta F h

instance sigmadeltaFJ = sigma F deltaFJ

transform u = counit F J
Keywords:

typeside_literal
counit
random
instance_literal
delta
delta
mapping_literal
schema_literal
sigma
coeval
eval
transform_literal

Options:




instance J

T
IDfirst0last0salary0ssn0
0?0Smith250115-234
1?1Smith300112-988
2?2Jones100198-887


instance J0

T
IDfirst0last0salary0ssn0
0AliceJones100198-887
1?0Smith250115-234
2?1Smith300112-988
3?2?3?4?5


instance J2

T
IDfirst0last0salary0ssn0
0?0?0?1?0
1?0?0?1?0
2?0?0?1?0
3?0?0?1?0
4?0?0?1?0
5?0?0?1?0
6?0?0?1?0
7?0?0?1?0
8?0?0?1?0
9?0?0?1?0


instance deltaFJ_alt1

T1
IDfirstlastssn
0?0Smith115-234
1?1Smith112-988
2?2Jones198-887
T2
IDfirstlastsalary
3?0Smith250
4?1Smith300
5?2Jones100


instance deltaFJ

T1
IDfirstlastssn
0?0Smith115-234
1?1Smith112-988
2?2Jones198-887
T2
IDfirstlastsalary
3?0Smith250
4?1Smith300
5?2Jones100


instance sigmadeltaFJ

T
IDfirst0last0salary0ssn0
0?0Jones?1198-887
1?2Smith?3112-988
2?4Smith?5115-234
3?0Jones100?6
4?2Smith300?7
5?4Smith250?8


instance deltaFJ_alt2

T1
IDfirstlastssn
0?0Jones198-887
1?1Smith112-988
2?2Smith115-234
T2
IDfirstlastsalary
3?0Jones100
4?1Smith300
5?2Smith250