AlgebraicJulia / AlgebraicJulia/AlgebraicRewriting.jl

fix yoneda_cache support for DynamicACSets

Aperta
#27 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
41
Fork
9
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I created a DynamicAcset using the following code:

```
@present SchAi2Thor(FreeSchema) begin
## Objects
RoboGripper::Ob
Thing::Ob # all Null ∪ objects

## Attributes for Thing
Label::AttrType
IsOpen::AttrType
IsBroken::AttrType
IsCooked::AttrType
IsSliced::AttrType
IsToggled::AttrType
IsDirty::AttrType
IsFilledWithLiquid::AttrType
IsUsedUp::AttrType

thing_has_label::Attr(Thing, Label)
thing_is_open::Attr(Thing, IsOpen)
thing_is_broken::Attr(Thing, IsBroken)
thing_is_cooked::Attr(Thing, IsCooked)
thing_is_sliced::Attr(Thing, IsSliced)
thing_is_toggled::Attr(Thing, IsToggled)
thing_is_dirty::Attr(Thing, IsDirty)
thing_is_filled_with_liquid::Attr(Thing, IsFilledWithLiquid)
thing_is_used_up::Attr(Thing, IsUsedUp)

PositionX::AttrType
PositionY::AttrType
PositionZ::AttrType
thing_has_positionX::Attr(Thing, PositionX)
thing_has_positionY::Attr(Thing, PositionY)
thing_has_positionZ::Attr(Thing, PositionZ)

## Relations
PartOfRel::Ob
InRel::Ob # Q: How do I enforce that things of a particular type can only be inside other things of certain types?

is_holding::Hom(RoboGripper, Thing)
is_part_of_l::Hom(PartOfRel, Thing)
is_part_of_r::Hom(PartOfRel, Thing)
is_in_l::Hom(InRel, Thing)
is_in_r::Hom(InRel, Thing)
end

# specify types for attributes
const type_assignment = Dict(
:Label => String,
:IsOpen => Bool,
:IsBroken => Bool,
:IsCooked => Bool,
:IsSliced => Bool,
:IsToggled => Bool,
:IsDirty => Bool,
:IsFilledWithLiquid => Bool,
:IsUsedUp => Bool,
:PositionX => Float64,
:PositionY => Float64,
:PositionZ => Float64
)

# create dynamic acset object
const Ai2Thor = DynamicACSet("Ai2Thor", SchAi2Thor;
type_assignment=type_assignment)
```

When I attempt to compute the representables for that ACSet, I get the following error:

```julia> yoneda_cache(Ai2Thor)
ERROR: MethodError: no method matching yoneda_cache(::DynamicACSet)

Closest candidates are:
yoneda_cache(::Type)
@ AlgebraicRewriting ~/.julia/packages/AlgebraicRewriting/W29UX/src/rewrite/Representable.jl:41
yoneda_cache(::Type, ::Any; clear, cache)
@ AlgebraicRewriting ~/.julia/packages/AlgebraicRewriting/W29UX/src/rewrite/Representable.jl:41

Stacktrace:
[1] top-level scope
@ ~/Documents/Git/ai2thor-cset-experiments/julia/Ai2thorCsetProject/Ai2ThorWorld-Rules-CR.jl:114
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.