Last active
February 13, 2022 12:31
-
-
Save aalexandrov/77e692a4f26c8a90345a312565e17e8d to your computer and use it in GitHub Desktop.
Exploration of a possible DSL for user-readable Query Graph Model (QGM) instances.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Model { | |
box B1 = Get { | |
id: GlobalId::User(0), | |
unique_keys: [[0], [1]], | |
columns: [ | |
base(0): INT NOT NULL, | |
base(1): INT NOT NULL, | |
base(2): INT NOT NULL, | |
] | |
} | |
box B2 = Get { | |
id: GlobalId::User(1), | |
unique_keys: [[0]], | |
columns: [ | |
base(0): INT NOT NULL, | |
base(1): INT NOT NULL, | |
base(2): INT NOT NULL, | |
] | |
} | |
box B3 = Select { | |
quantifier x = Foreach(B1) | |
quantifier y = Foreach(B2) | |
quantifier z = Exists({ | |
let B4 = Select { | |
quantifier u = Foreach(B1); | |
quantifier v = Foreach(B2); | |
if u#2 = v#0; | |
if u#2 = x#2; | |
columns: [ | |
base(0): INT NOT NULL, | |
base(1): INT NOT NULL, | |
base(2): INT NOT NULL, | |
] | |
} | |
let B5 = GroupBy { | |
quantifier x = Foreach(B4) | |
key: [x#0, x#1] | |
} | |
Select { | |
quantifier x = Foreach(B4) | |
key: [x#0, x#1] | |
} | |
}) | |
if rhs#2 = lhs#0 | |
if z > 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment