Giter Site home page Giter Site logo

Comments (3)

epatters avatar epatters commented on July 3, 2024 1

Thanks for the report. If that code is failing, it's a bug.

from catlab.jl.

slwu89 avatar slwu89 commented on July 3, 2024

The error is as follows. I guess a possible fix would be to do something here

# Add an extra box and corresponding span for each parameter.
if !isempty(params)
diagram = copy(diagram)
spans = vcat(spans, map_pairs(params) do (key, value)
box = add_part!(diagram, :Box, name=:_const)
junction = key isa Integer ? key : only(incident(diagram, key, :variable))
add_part!(diagram, :Port, port_name=:_value,
box=box, junction=junction)
SMultispan{1}(ConstantFunction(value, FinSet(1)))
end)
end
to make sure the type sets are correct.

julia> query(data, testquery, (attr=3, ))
ERROR: Feet of spans are not equal: TypeSet(Int64) != TypeSet(Union{Int64, Symbol})
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] oapply(composite::Catlab.Programs.RelationalPrograms.UntypedNamedRelationDiagram{…}, spans::Vector{…}; Ob::Type, Hom::Type, return_limit::Bool)
   @ Catlab.WiringDiagrams.WiringDiagramAlgebras ~/.julia/packages/Catlab/YRhzN/src/wiring_diagrams/Algebras.jl:54
 [3] query(X::TestData{…}, diagram::Catlab.Programs.RelationalPrograms.UntypedNamedRelationDiagram{…}, params::@NamedTuple{}; table_type::Type)
   @ Catlab.WiringDiagrams.WiringDiagramAlgebras ~/.julia/packages/Catlab/YRhzN/src/wiring_diagrams/Algebras.jl:182
 [4] query(X::TestData{…}, diagram::Catlab.Programs.RelationalPrograms.UntypedNamedRelationDiagram{…}, params::@NamedTuple{})
   @ Catlab.WiringDiagrams.WiringDiagramAlgebras ~/.julia/packages/Catlab/YRhzN/src/wiring_diagrams/Algebras.jl:158
 [5] top-level scope
   @ ~/Desktop/misc/tmp.jl:21
Some type information was truncated. Use `show(err)` to see complete types.

from catlab.jl.

slwu89 avatar slwu89 commented on July 3, 2024

@epatters I thought about this a bit, there's some tricky issues (or maybe I'm not seeing something obvious). The issue is setting up the constant function in SMultispan{1}(ConstantFunction(value, FinSet(1))) . Obviously here the value given by the user will just be some atomic type and not a union, but the codom of the constant function will also be just that type. Hence the issue when comparing the feet of spans, because the type of the acset X passed at runtime will still be a union.

Even when calling the ConstantFunction constructor explicitly with the exact type of the attribute extracted from the acset at runtime with subpart_type, there will still be a problem because the type of the value will be one of the types in the union, but the constructor needs them to be exact, in the type signature ConstantFunction{T,Value<:T,Dom,Codom<:SetOb{T}}.

Any ideas? This may just be something to note and move on. Or insist that people use SumTypes.jl for these cases (kidding).

from catlab.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.