how can I retract an entity?
At this point, you need to delete all of its triples. Yes, I appreciate that isn't a great answer. I can certainly do something without a huge effort. But it doesn't exist because: • Asami is based on the OWA. This makes entity removal an unusual thing to do. Instead, removing individual statements usually makes more sense • Datomic (which introduced entities in this context) didn't have this function (I’m guessing it probably does now)
This is easier than what I've been working on, so I could try it
I have 2 use cases that I think need retraction/deletion.
I'm trying to model links between documents. right now, a document is keyed by the location on disk. e.g. {:db/ident "file:///Users/lilactown/note.md"}
the operations I think I need retraction for are:
• moving, which would delete the old node and create the new node
• deletion, which would delete the node
What do you mean by “moving”? Is it just changing the ident? If so, then that's just a special property for referring to the entity… you can update that property if you want
I am literally watching the file system and get events like
{:type :delete :path "/Users/lilactown/Code/dex/notes/foo"}
{:type :create :path "/Users/lilactown/Code/dex/notes/bar"}
when I rename a file. instead of trying to relate the two events, it's simpler for me to delete the entity that represented the foo doc and ingest the bar doc as a new entityAre these objects that show up in a stream, or are they things that you’re inserting into the database, and you’re seeing them as entities?
they're things that show up in a stream. I then load some metadata about them into the database related to their location and content
unrelated to deletion, I'm trying to add the links to each document as a vector. a link inside that vector would be an ident, e.g
{:db/ident "file:///Users/lilactown/Code/dex/notes/test-link.md"
:uri "/Users/lilactown/Code/dex/notes/test-link.md",
:type :local-file,
:format "markdown",
:links ["file:///Users/lilactown/Code/dex/notes/test.md"]}
however this doesn't seem to work well w.r.t. querying for "return the entities this document links to" etc.Is this because it's a linked list? The :tg/contains property was introduced to make that easy. Or you could make it a set instead of a vector (assuming you have the data in edn and not json)
I think I transact it as a seq. I'll see if changing the type makes it work better
yeah, changing it to a set worked. thanks!
Yes, that’s a different structure. Data that is provided in a vector is treated as an “array”. You can see how these work and how to query the data https://github.com/threatgrid/asami/wiki/5.-Entity-Structure#arrays.
But if you don’t care about the order, then sets are better
i don't think i need the order
Then sets are the way to go.
Once I get the optional schema in place, then I can make the presumption that an array is represented as a set when the associated attribute is single-cardinality
but until then, I work on the datatypes