Copairings

32 views
Skip to first unread message

Richard Samuelson

unread,
Jul 29, 2024, 5:28:10 PM7/29/24
to Categorical Data
Dear CQL maintainers,

Given queries
    q1: A -> B1
    q2: A -> B2,
there is a natural query (the copairing?)
   q : A -> B1 + B2,
where B1 + B2 is the coproduct of B1 and B2. Does CQL allow me to form this query?

I tried to do this using prefixes and imports, but the IDE returned an error:

schema U = unit : empty

schema S = literal : empty {
entities
A
B
foreign_keys
f: A -> B
g: B -> A
}


query I = identity S
query Q = literal : S -> U {entity "" -> {from a : A}}


# ERROR
query Copair = literal : S -> getSchema (coproduct S + U : empty) {
imports
[Q ; toQuery from_prefix U "U_"]
[I ; toQuery from_prefix S "S_"]
}

The error returned was
Error in query Copair: java.lang.NullPointerException: Cannot invoke "java.util.Map.size()" because "map" is null

Ryan Wisnesky

unread,
Jul 29, 2024, 5:43:41 PM7/29/24
to categor...@googlegroups.com
I think you have found an error in the CQL implementation, and an error in the error message handling. The “map” referred to is an internal data structure backing the desired query. Your CQL seems fine; clever, in fact. I’ll look into a fix and get back to you shortly.
> --
> You received this message because you are subscribed to the Google Groups "Categorical Data" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to categoricalda...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/categoricaldata/ec97ae23-d22c-4f47-9dc3-23f5f022de79n%40googlegroups.com.

Ryan Wisnesky

unread,
Jul 29, 2024, 9:49:38 PM7/29/24
to categor...@googlegroups.com
Hi Richard,

I uploaded a new version of CQL that fixes this error, which was related to functionality not present in your example. The result given by CQL is shown below. David Spivak points out that what is being computed isn’t really the co-pairing, which would be of maps A1->B and A2->B (pairing would be A-> B1*B2).

entity S_B -> {from vv0:B where
foreign_keys g -> {vv0 -> vv0.g}}

entity S_A -> {from vv0:A where
foreign_keys f -> {vv0 -> vv0.f}}

entity U_ -> {from vv0:A where}

-Ryan

> On Jul 29, 2024, at 2:28 PM, Richard Samuelson <richard.h...@gmail.com> wrote:
>

Richard Samuelson

unread,
Jul 30, 2024, 8:00:06 PM7/30/24
to Categorical Data
Thank you! This was very helpful :).
Reply all
Reply to author
Forward
0 new messages