❓ How does relationship validation happen on definition and on insert in application? #1239
-
Let's say we define RELATION, or insert POPULATION. // 1 -> 0..1
def univalent<T>(relationsCount: (a: T, b: T) => number) => (a: T, b: T) =>
relationsCount(a, b) in [1,0]; And in stages it happens like: 1) insert population <(X,Y)> to relation[X,Y] table (loaded from db) in memory
2) validate constraints like: univalent(count in relation[X,Y])(x, y) where x,y in <(X,Y)>
3) insert population <(X,Y)> to relation[X,Y] table in db or signal about violation
4) drop in memory relation[X,Y] table after all constraints checked Or is there some more efficient way to test relationships? I tried to understand how this is implemented in the code, but I don't have enough experience with Haskell to see the full picture of what's going on. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi Nikita, Sorry to be late in reacting. You define RELATION or insert POPULATION in a script (a UTF-8 file). All verification is done in the compiler by the type checker. Let us assume the static type checking has succeeded. Then the question remains whether the population violates any of the rules. The compiler checks this too. No code is generated until all these checks are passed. So let us say that relation I'm not sure this answers your question. Feel free to react if it doesn't. |
Beta Was this translation helpful? Give feedback.
Hi Nikita,
Sorry to be late in reacting. You define RELATION or insert POPULATION in a script (a UTF-8 file). All verification is done in the compiler by the type checker. Let us assume the static type checking has succeeded. Then the question remains whether the population violates any of the rules. The compiler checks this too. No code is generated until all these checks are passed. So let us say that relation
r
is univalent, and you have specified that the population ofr
contains both(2, "foo")
and(2, "bar")
, the compiler will complain about violating the univalence ofr
.I'm not sure this answers your question. Feel free to react if it doesn't.