does asami support reverse lookups of attributes?
Entities are just built out of triples, and you can look up triples in any direction, so yes. Maybe you're looking for a different type of API though?
didn't see it in the query docs
trying to figure out how I ought to structure my data. I'm going to want to do a lot of back references - "this entity refers to that one, and these are all of the entities that refer it" - which in some dbs I could use reverse lookups. I could just transact those relations explicitly though I think
another question: I'd like to use a tuple [:foo "bar"] as a :db/ident. this doesn't seem to work when I try to do (d/entity db [:foo "bar"]). haven't tried it any other way yet but, are complex data types like that allowed as idents?
I’m nearly there. I can store them and retrieve them, but searching for them isn’t working. Will try again in the morning
Asami can store it, but I haven’t put it into the API yet because without a schema it's just looks like a nested structure that needs to be converted to triples
yeah I see it ends up in the (in-memory) structure as
{:graph {:spo {:node-19455 {:db/ident #:tg{:node-19456 {:t 2, :id 16}},which makes it unable to be used with entity it seems
What I need is some way to get it through the asami.entities.writer/map->triples operation without descending into the ID attributes.
Actually, that may not be hard at all, since they’re well known, and there is not reason to every have a triple-based structure on those attributes.
I’ll have to change that and see if it works.
If they’re not converted into triples, then then in memory, they just get stored as the data for the node, and on disk then end up going straight to the Data Pool, and represented with a number (that is a pointed into the data pool).
Encoding happens in asami.durable.encoder/FlatFile which is a protocol for storing things in the file that encodes the data pool. That protocol is extended onto ISeq on line 282, onto IPersistentVector on line 329, and IPersistentMap on line 333.
Still in the middle of writing other code, but I guess I could try making a branch that does this, so it can happen sooner
https://clojurians.slack.com/archives/C015AL9QYH1/p1645591820279359?thread_ts=1645588521.416369&channel=C015AL9QYH1&message_ts=1645591820.279359 It was mostly done already.
This is what I mean when I keep saying that I have “plans”. I have lots of nearly-done features that I need to connect up 🙂
I also do not understand this line in the docs about identity > However, using these ident values in `:db/add` statements has greater potential to interfere with tuples that should not be modified, so the use is discouraged.
I think I need to see that in context
last paragraph under this heading https://github.com/threatgrid/asami/wiki/4.-Transactions#identity-values
Apparently I was on a roll that day… I don’t know what I meant either!