I am wondering how to permanently store a custom entity using EntityRegister and EntityStore.
I have figured out how to make it work in a local session, but restarting Mathematica resets my entity and I have to reload it.
How can I permanently store a custom Entity type that is not a Resource Data object?
Using PersistentSymbol
fruit = EntityStore[
"fruit" -> <|
"Entities" -> <|
"banana" -> <|"color" -> Yellow|>,
"strawberry" -> <|"color" -> Red|>
|>
|>]
PersistentSymbol["fruit"] = fruit
Quit[]
Add this to init.m
EntityRegister[PersistentSymbol["fruit"]]
Then this should work
EntityList["fruit"]
Thank you!
I have found this helpful.
I have two questions.
If I wanted to add more entities to my custom entity type, how would I do it?
Is there a way to add an entity type to the autocomplete menu?
If I wanted to add more entities to my custom entity type, how would
I do it?
Using the fruit example above, assuming it has been registered then to add a new entity
Entity["fruit", "orange"]["color"] = Orange
Orange has been added
EntityList["fruit"]
There is no need to register/unregister, but the PersistentSymbol will have to be updated.
Is there a way to add an entity type to the autocomplete menu?
There may be, but I don’t know how.