example NewDemoPsuedo
options
require_consistency=false
dont_validate_unsafe=true
always_reload=true
timeout = 60
# prover=monoidal
typeside Ty = literal {
external_types
Integer -> "java.lang.Integer"
Float -> "java.math.BigDecimal"
String -> "java.lang.String"
external_parsers
Float -> "x => java.math.BigDecimal.valueOf(java.lang.Double.parseDouble(x))"
Integer -> "x => java.lang.Integer.parseInt(x)"
String -> "x => x"
external_functions
"+" : Float,Float->Float = "(x, y) => x.add(y)"
"*" : Float,Float->Float = "(x, y) => x.multiply(y)"
"-" : Float,Float->Float = "(x, y) => x.subtract(y)"
"/" : Float,Float->Float = "(x, y) => x.divide(y)"
"MAX" : Float,Float->Float = "(x, y) => x.max(y)"
"MIN" : Float,Float->Float = "(x, y) => x.min(y)"
equations
}
#schema S1 = importFromJDBC <url>
schema Olog1Schema = literal : Ty {
entity Patient
attributes ID first_name last_name birthdate create_date : String
entity Visit
attributes ID patient_id visit_date : String
entity Observation
attributes ID visit_id clinician_id obs_type observation : String
}
constraints Olog1Constraints = literal : Olog1Schema {
forall x y : Observation where x.ID = y.ID -> where x = y
forall x y : Visit where x.ID = y.ID -> where x = y
forall x y : Patient where x.ID = y.ID -> where x = y
forall x : Observation -> exists y : Visit where x.visit_id = y.ID
forall x : Visit -> exists y : Patient where x.patient_id = y.ID
}
schema Olog2Schema = literal : Ty {
entity Prescription
attributes ID patient_id date details : String
entity Patient
attributes ID fname lname dob : String
entity Observation
attributes ID patient_id clinician_id obs_type obs_date observation : String
}
constraints Olog2Constraints = literal : Olog2Schema {
forall x y : Observation where x.ID = y.ID -> where x = y
forall x y : Prescription where x.ID = y.ID -> where x = y
forall x y : Patient where x.ID = y.ID -> where x = y
forall x : Prescription -> exists y : Patient where x.patient_id = y.ID
forall x : Observation -> exists y : Patient where x.patient_id = y.ID
}
#instance O1 = importJdbc <url>
instance Olog1Data = literal : Olog1Schema {
generators
p1 p2 p3 : Patient
v1 v2 v3 : Visit
o1 o2 o3 : Observation
equations
p1.ID = 937189 p1.first_name = john p1.last_name = doe
p1.birthdate = 340465020 p1.create_date = 1187438212
p2.ID = 937190 p2.first_name = amrit p2.last_name = kumar
p2.birthdate = 246222505 p2.create_date = 1187444008
p3.ID = 937191 p3.first_name = alexandra p3.last_name = grant
p3.birthdate = 121408849 p3.create_date = 1187445155
v1.ID = 1237827 v1.patient_id = 937189 v1.visit_date = 1187438212
v2.ID = 1237828 v2.patient_id = 937190 v2.visit_date = 1187444008
v3.ID = 1237829 v3.patient_id = 937191 v3.visit_date = 1187445155
o1.ID = 487298329 o1.visit_id = 1237827 o1.clinician_id = 562
o1.obs_type = HR o1.observation = 114
o2.ID = 487298330 o2.visit_id = 1237827 o2.clinician_id = 562
o2.obs_type = WT o2.observation = 180
o3.ID = 487298331 o3.visit_id = 1237827 o3.clinician_id = 562
o3.obs_type = BP o3.observation = "130/82"
}
instance Olog2Data = literal : Olog2Schema {
generators
p1 p2 p3 : Patient
v1 v2 v3 : Prescription
o1 o2 o3 : Observation
equations
p1.ID = 25234 p1.fname = alexandra p1.lname = grant
p1.dob = 121408849
p2.ID = 25235 p2.fname = vincent p2.lname = "von hoff"
p2.dob = 409235232
p3.ID = 25236 p3.fname = brian p3.lname = tsai
p3.dob = 380665171
v1.ID = 675345 v1.patient_id = 25234 v1.date = 1639676732
v1.details = Enalapril
v2.ID = 675346 v2.patient_id = 25234 v2.date = 1639696544
v2.details = chlorothiazide
v3.ID = 675347 v3.patient_id = 25235 v3.date = 1639704522
v3.details = lisinopril
o1.ID = 154298449 o1.patient_id = 25234 o1.clinician_id = 132
o1.obs_type = HR o1.obs_date = 1639676732 o1.observation=116
o2.ID = 154298450 o2.patient_id = 25234 o2.clinician_id = 132
o2.obs_type = WT o2.obs_date = 1639676732 o2.observation=220
o3.ID = 154298451 o3.patient_id = 25234 o3.clinician_id = 132
o3.obs_type = BP o3.obs_date = 1639676732 o3.observation="132/82"
}
command check1 = check Olog1Constraints Olog1Data
command check2 = check Olog2Constraints Olog2Data
schema_colimit C = pseudo_quotient Olog1Schema + Olog2Schema : Ty {
entity_isomorphisms
p : Olog1Schema.Patient -> Olog2Schema.Patient
o : Olog1Schema.Observation -> Olog2Schema.Observation
equations
forall x:Olog1Schema.Patient, x.first_name = x.p.fname #x.first_name = uppercase(x.fname)
forall x:Olog1Schema.Patient, x.last_name = x.p.lname
forall x:Olog1Schema.Patient, x.birthdate = x.p.dob #x.bd = x.dob+1
forall x:Olog1Schema.Observation, x.ID = x.o.ID
forall x:Olog1Schema.Observation, x.observation = x.o.observation
forall x:Olog1Schema.Observation, x.clinician_id = x.o.clinician_id
forall x:Olog1Schema.Observation, x.obs_type = x.o.obs_type
}
instance Olog1DataFwd = sigma (getMapping C Olog1Schema) Olog1Data
instance Olog2DataFwd = sigma (getMapping C Olog2Schema) Olog2Data
constraints Olog1ConstraintsFwd = sigma (getMapping C Olog1Schema) Olog1Constraints
constraints Olog2ConstraintsFwd = sigma (getMapping C Olog2Schema) Olog2Constraints
instance CoProd = coproduct Olog1DataFwd + Olog2DataFwd : getSchema C
constraints Rules = literal : getSchema C {
imports Olog1ConstraintsFwd Olog2ConstraintsFwd
forall x y : Olog1Schema_Patient where x.first_name=y.first_name x.last_name=y.last_name
-> where x=y
forall x y : Olog2Schema_Observation where x.obs_date = y.obs_date
-> where x.o_inv.visit_id = y.o_inv.visit_id
forall x y : Olog1Schema_Observation where x.visit_id = y.visit_id
-> where x.o.patient_id = y.o.patient_id
forall x : Olog1Schema_Observation y : Olog1Schema_Visit z : Olog1Schema_Patient z2 : Olog2Schema_Patient
where x.visit_id = y.ID z.ID = y.patient_id x.o.patient_id = z2.ID
-> where z = z2.p_inv
forall x y : Olog1Schema_Observation where x.visit_id = y.visit_id
-> where x.o.obs_date = y.o.obs_date
forall x : Olog1Schema_Observation y : Olog1Schema_Visit where x.visit_id = y.ID
-> where y.visit_date = x.o.obs_date
}
instance Colim = chase Rules CoProd
mapping M = getPseudo C
instance L = sigma M Colim
instance Olog1DataBkwd = delta (getMapping C Olog1Schema) Colim
instance Olog2DataBkwd = delta (getMapping C Olog2Schema) Colim
Keywords:
typeside_literal
chase
getPseudo
constraints_literal
sigma
delta
schema_literal
sigma
instance_literal
check
pseudo_quotient
coproduct
Options:
instance Olog2Data
ObservationID | ID | patient_id | clinician_id | obs_type | obs_date | observation |
---|
0 | 154298449 | 25234 | 132 | HR | 1639676732 | 116 |
1 | 154298450 | 25234 | 132 | WT | 1639676732 | 220 |
2 | 154298451 | 25234 | 132 | BP | 1639676732 | 132/82 |
PatientID | ID | fname | lname | dob |
---|
3 | 25234 | alexandra | grant | 121408849 |
4 | 25235 | vincent | von hoff | 409235232 |
5 | 25236 | brian | tsai | 380665171 |
PrescriptionID | ID | patient_id | date | details |
---|
6 | 675345 | 25234 | 1639676732 | Enalapril |
7 | 675346 | 25234 | 1639696544 | chlorothiazide |
8 | 675347 | 25235 | 1639704522 | lisinopril |
instance Olog1Data
ObservationID | ID | visit_id | clinician_id | obs_type | observation |
---|
0 | 487298329 | 1237827 | 562 | HR | 114 |
1 | 487298330 | 1237827 | 562 | WT | 180 |
2 | 487298331 | 1237827 | 562 | BP | 130/82 |
PatientID | ID | first_name | last_name | birthdate | create_date |
---|
3 | 937189 | john | doe | 340465020 | 1187438212 |
4 | 937190 | amrit | kumar | 246222505 | 1187444008 |
5 | 937191 | alexandra | grant | 121408849 | 1187445155 |
VisitID | ID | patient_id | visit_date |
---|
6 | 1237827 | 937189 | 1187438212 |
7 | 1237828 | 937190 | 1187444008 |
8 | 1237829 | 937191 | 1187445155 |
instance Olog1DataFwd
Olog1Schema_ObservationID | ID | visit_id | clinician_id | obs_type | observation | o |
---|
0 | 487298329 | 1237827 | 562 | HR | 114 | 9 |
1 | 487298330 | 1237827 | 562 | WT | 180 | 10 |
2 | 487298331 | 1237827 | 562 | BP | 130/82 | 11 |
Olog1Schema_PatientID | ID | first_name | last_name | birthdate | create_date | p |
---|
3 | 937189 | john | doe | 340465020 | 1187438212 | 12 |
4 | 937190 | amrit | kumar | 246222505 | 1187444008 | 13 |
5 | 937191 | alexandra | grant | 121408849 | 1187445155 | 14 |
Olog1Schema_VisitID | ID | patient_id | visit_date |
---|
6 | 1237827 | 937189 | 1187438212 |
7 | 1237828 | 937190 | 1187444008 |
8 | 1237829 | 937191 | 1187445155 |
Olog2Schema_ObservationID | ID | patient_id | clinician_id | obs_type | obs_date | observation | o_inv |
---|
9 | 487298329 | ?0 | 562 | HR | ?1 | 114 | 0 |
10 | 487298330 | ?2 | 562 | WT | ?3 | 180 | 1 |
11 | 487298331 | ?4 | 562 | BP | ?5 | 130/82 | 2 |
Olog2Schema_PatientID | ID | fname | lname | dob | p_inv |
---|
12 | ?6 | john | doe | 340465020 | 3 |
13 | ?7 | amrit | kumar | 246222505 | 4 |
14 | ?8 | alexandra | grant | 121408849 | 5 |
Olog2Schema_PrescriptionID | ID | patient_id | date | details |
---|
instance Olog2DataFwd
Olog1Schema_ObservationID | ID | visit_id | clinician_id | obs_type | observation | o |
---|
0 | 154298449 | ?0 | 132 | HR | 116 | 6 |
1 | 154298450 | ?1 | 132 | WT | 220 | 7 |
2 | 154298451 | ?2 | 132 | BP | 132/82 | 8 |
Olog1Schema_PatientID | ID | first_name | last_name | birthdate | create_date | p |
---|
3 | ?3 | alexandra | grant | 121408849 | ?4 | 9 |
4 | ?5 | vincent | von hoff | 409235232 | ?6 | 10 |
5 | ?7 | brian | tsai | 380665171 | ?8 | 11 |
Olog1Schema_VisitID | ID | patient_id | visit_date |
---|
Olog2Schema_ObservationID | ID | patient_id | clinician_id | obs_type | obs_date | observation | o_inv |
---|
6 | 154298449 | 25234 | 132 | HR | 1639676732 | 116 | 0 |
7 | 154298450 | 25234 | 132 | WT | 1639676732 | 220 | 1 |
8 | 154298451 | 25234 | 132 | BP | 1639676732 | 132/82 | 2 |
Olog2Schema_PatientID | ID | fname | lname | dob | p_inv |
---|
9 | 25234 | alexandra | grant | 121408849 | 3 |
10 | 25235 | vincent | von hoff | 409235232 | 4 |
11 | 25236 | brian | tsai | 380665171 | 5 |
Olog2Schema_PrescriptionID | ID | patient_id | date | details |
---|
12 | 675345 | 25234 | 1639676732 | Enalapril |
13 | 675346 | 25234 | 1639696544 | chlorothiazide |
14 | 675347 | 25235 | 1639704522 | lisinopril |
instance CoProd
Olog1Schema_ObservationID | ID | visit_id | clinician_id | obs_type | observation | o |
---|
0 | 487298329 | 1237827 | 562 | HR | 114 | 15 |
1 | 487298330 | 1237827 | 562 | WT | 180 | 16 |
2 | 487298331 | 1237827 | 562 | BP | 130/82 | 17 |
3 | 154298449 | ?0 | 132 | HR | 116 | 18 |
4 | 154298450 | ?1 | 132 | WT | 220 | 19 |
5 | 154298451 | ?2 | 132 | BP | 132/82 | 20 |
Olog1Schema_PatientID | ID | first_name | last_name | birthdate | create_date | p |
---|
6 | 937189 | john | doe | 340465020 | 1187438212 | 21 |
7 | 937190 | amrit | kumar | 246222505 | 1187444008 | 22 |
8 | 937191 | alexandra | grant | 121408849 | 1187445155 | 23 |
9 | ?3 | alexandra | grant | 121408849 | ?4 | 24 |
10 | ?5 | vincent | von hoff | 409235232 | ?6 | 25 |
11 | ?7 | brian | tsai | 380665171 | ?8 | 26 |
Olog1Schema_VisitID | ID | patient_id | visit_date |
---|
12 | 1237827 | 937189 | 1187438212 |
13 | 1237828 | 937190 | 1187444008 |
14 | 1237829 | 937191 | 1187445155 |
Olog2Schema_ObservationID | ID | patient_id | clinician_id | obs_type | obs_date | observation | o_inv |
---|
15 | 487298329 | ?9 | 562 | HR | ?10 | 114 | 0 |
16 | 487298330 | ?11 | 562 | WT | ?12 | 180 | 1 |
17 | 487298331 | ?13 | 562 | BP | ?14 | 130/82 | 2 |
18 | 154298449 | 25234 | 132 | HR | 1639676732 | 116 | 3 |
19 | 154298450 | 25234 | 132 | WT | 1639676732 | 220 | 4 |
20 | 154298451 | 25234 | 132 | BP | 1639676732 | 132/82 | 5 |
Olog2Schema_PatientID | ID | fname | lname | dob | p_inv |
---|
21 | ?15 | john | doe | 340465020 | 6 |
22 | ?16 | amrit | kumar | 246222505 | 7 |
23 | ?17 | alexandra | grant | 121408849 | 8 |
24 | 25234 | alexandra | grant | 121408849 | 9 |
25 | 25235 | vincent | von hoff | 409235232 | 10 |
26 | 25236 | brian | tsai | 380665171 | 11 |
Olog2Schema_PrescriptionID | ID | patient_id | date | details |
---|
27 | 675345 | 25234 | 1639676732 | Enalapril |
28 | 675346 | 25234 | 1639696544 | chlorothiazide |
29 | 675347 | 25235 | 1639704522 | lisinopril |
instance Colim
Olog1Schema_ObservationID | ID | visit_id | clinician_id | obs_type | observation | o |
---|
0 | 154298451 | ?0 | 132 | BP | 132/82 | 15 |
1 | 154298450 | ?0 | 132 | WT | 220 | 16 |
2 | 154298449 | ?0 | 132 | HR | 116 | 17 |
3 | 487298329 | 1237827 | 562 | HR | 114 | 18 |
4 | 487298330 | 1237827 | 562 | WT | 180 | 19 |
5 | 487298331 | 1237827 | 562 | BP | 130/82 | 20 |
Olog1Schema_PatientID | ID | first_name | last_name | birthdate | create_date | p |
---|
6 | 937191 | alexandra | grant | 121408849 | 1187445155 | 21 |
7 | 937189 | john | doe | 340465020 | 1187438212 | 22 |
8 | ?1 | vincent | von hoff | 409235232 | ?2 | 23 |
9 | ?3 | brian | tsai | 380665171 | ?4 | 24 |
10 | 937190 | amrit | kumar | 246222505 | 1187444008 | 25 |
Olog1Schema_VisitID | ID | patient_id | visit_date |
---|
11 | ?0 | 937191 | 1639676732 |
12 | 1237827 | 937189 | 1187438212 |
13 | 1237828 | 937190 | 1187444008 |
14 | 1237829 | 937191 | 1187445155 |
Olog2Schema_ObservationID | ID | patient_id | clinician_id | obs_type | obs_date | observation | o_inv |
---|
15 | 154298451 | 25234 | 132 | BP | 1639676732 | 132/82 | 0 |
16 | 154298450 | 25234 | 132 | WT | 1639676732 | 220 | 1 |
17 | 154298449 | 25234 | 132 | HR | 1639676732 | 116 | 2 |
18 | 487298329 | ?5 | 562 | HR | 1187438212 | 114 | 3 |
19 | 487298330 | ?5 | 562 | WT | 1187438212 | 180 | 4 |
20 | 487298331 | ?5 | 562 | BP | 1187438212 | 130/82 | 5 |
Olog2Schema_PatientID | ID | fname | lname | dob | p_inv |
---|
21 | 25234 | alexandra | grant | 121408849 | 6 |
22 | ?5 | john | doe | 340465020 | 7 |
23 | 25235 | vincent | von hoff | 409235232 | 8 |
24 | 25236 | brian | tsai | 380665171 | 9 |
25 | ?6 | amrit | kumar | 246222505 | 10 |
Olog2Schema_PrescriptionID | ID | patient_id | date | details |
---|
26 | 675345 | 25234 | 1639676732 | Enalapril |
27 | 675346 | 25234 | 1639696544 | chlorothiazide |
28 | 675347 | 25235 | 1639704522 | lisinopril |
instance Olog1DataBkwd
ObservationID | ID | visit_id | clinician_id | obs_type | observation |
---|
0 | 154298451 | ?0 | 132 | BP | 132/82 |
1 | 154298450 | ?0 | 132 | WT | 220 |
2 | 154298449 | ?0 | 132 | HR | 116 |
3 | 487298329 | 1237827 | 562 | HR | 114 |
4 | 487298330 | 1237827 | 562 | WT | 180 |
5 | 487298331 | 1237827 | 562 | BP | 130/82 |
PatientID | ID | first_name | last_name | birthdate | create_date |
---|
6 | 937191 | alexandra | grant | 121408849 | 1187445155 |
7 | 937189 | john | doe | 340465020 | 1187438212 |
8 | ?1 | vincent | von hoff | 409235232 | ?2 |
9 | ?3 | brian | tsai | 380665171 | ?4 |
10 | 937190 | amrit | kumar | 246222505 | 1187444008 |
VisitID | ID | patient_id | visit_date |
---|
11 | ?0 | 937191 | 1639676732 |
12 | 1237827 | 937189 | 1187438212 |
13 | 1237828 | 937190 | 1187444008 |
14 | 1237829 | 937191 | 1187445155 |
instance Olog2DataBkwd
ObservationID | ID | patient_id | clinician_id | obs_type | obs_date | observation |
---|
0 | 154298451 | 25234 | 132 | BP | 1639676732 | 132/82 |
1 | 154298450 | 25234 | 132 | WT | 1639676732 | 220 |
2 | 154298449 | 25234 | 132 | HR | 1639676732 | 116 |
3 | 487298329 | ?0 | 562 | HR | 1187438212 | 114 |
4 | 487298330 | ?0 | 562 | WT | 1187438212 | 180 |
5 | 487298331 | ?0 | 562 | BP | 1187438212 | 130/82 |
PatientID | ID | fname | lname | dob |
---|
6 | 25234 | alexandra | grant | 121408849 |
7 | ?0 | john | doe | 340465020 |
8 | 25235 | vincent | von hoff | 409235232 |
9 | 25236 | brian | tsai | 380665171 |
10 | ?1 | amrit | kumar | 246222505 |
PrescriptionID | ID | patient_id | date | details |
---|
11 | 675345 | 25234 | 1639676732 | Enalapril |
12 | 675346 | 25234 | 1639696544 | chlorothiazide |
13 | 675347 | 25235 | 1639704522 | lisinopril |
instance L
ObservationID | obs_date | clinician_id | patient_id | ID | visit_id | observation | obs_type |
---|
0 | 1639676732 | 132 | 25234 | 154298451 | ?0 | 132/82 | BP |
1 | 1639676732 | 132 | 25234 | 154298450 | ?0 | 220 | WT |
2 | 1639676732 | 132 | 25234 | 154298449 | ?0 | 116 | HR |
3 | 1187438212 | 562 | ?1 | 487298329 | 1237827 | 114 | HR |
4 | 1187438212 | 562 | ?1 | 487298330 | 1237827 | 180 | WT |
5 | 1187438212 | 562 | ?1 | 487298331 | 1237827 | 130/82 | BP |
PatientID | create_date | birthdate | first_name | ID | Olog2Schema_Patient_ID | last_name |
---|
6 | 1187445155 | 121408849 | alexandra | 937191 | 25234 | grant |
7 | 1187438212 | 340465020 | john | 937189 | ?1 | doe |
8 | ?2 | 409235232 | vincent | ?3 | 25235 | von hoff |
9 | ?4 | 380665171 | brian | ?5 | 25236 | tsai |
10 | 1187444008 | 246222505 | amrit | 937190 | ?6 | kumar |
PrescriptionID | date | ID | details | patient_id |
---|
11 | 1639676732 | 675345 | Enalapril | 25234 |
12 | 1639696544 | 675346 | chlorothiazide | 25234 |
13 | 1639704522 | 675347 | lisinopril | 25235 |
VisitID | patient_id | ID | visit_date |
---|
14 | 937191 | ?0 | 1639676732 |
15 | 937189 | 1237827 | 1187438212 |
16 | 937190 | 1237828 | 1187444008 |
17 | 937191 | 1237829 | 1187445155 |
command check1
Satisfies
command check2
Satisfies