Catlab.jl icon indicating copy to clipboard operation
Catlab.jl copied to clipboard

Parameters in queries for attributes that are unions

Open slwu89 opened this issue 8 months ago • 3 comments

When an AttrType is being modeled with some union type, queries with a parameter for something pointing to that attribute type won't work (errors). I am not sure if its possible to make them work given how the spans are set up in oapply, but I am documenting it here.

using Catlab, DataFrames

@present TestSch(FreeSchema) begin
    X::Ob
    A::AttrType
    a::Attr(X,A)
end

@acset_type TestData(TestSch)

data = @acset TestData{Union{Int,Symbol}} begin
    X=5
    a=[1,2,3,:four,:five]
end

testquery = @relation (x=xid, a=attr) begin
    X(_id=xid, a=attr)
end

query(data, testquery)
query(data, testquery, (attr=3, ))

slwu89 avatar Jun 05 '24 23:06 slwu89