datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
2021-01-25T14:49:19.033500Z

If I have an entity with a composite tuple containing a ref to some ident (‘enum style’), say, I have a person entity for which name + gender are unique. Is it intended that I can’t pull entities by [name, gender] when gender is still an ident? (ex in thread)

2021-01-25T14:49:40.033600Z

;; Pull with ident
(d/pull (d/db conn) '[*] [:person/name+gender ["Lennart" :gender/male]])
=> #:db{:id nil}

;; Resolve ident first
(:db/id (d/pull (d/db conn) '[*] :gender/male))
=> 17592186045417

;; Pull with eid of ident
(d/pull (d/db conn) '[*] [:person/name+gender ["Lennart" 17592186045417]])
=>
{:db/id 17592186045421,
 :person/name "Lennart",
 :person/gender #:db{:id 17592186045417},
 :person/name+gender ["Lennart" 17592186045417]}

2021-01-25T14:53:19.033800Z

(Also, majorly bad example, don’t assume name + gender are unique, but you know, example :’) )

favila 2021-01-25T17:22:33.034300Z

Yes, datomic does not attempt to resolve anything in the “value” slot of a lookup ref. You must provide exactly the value that would be found in the datom’s :v, which for refs is the entity id

👍 1
favila 2021-01-25T17:23:07.034500Z

At least, that’s the way it behaves now. It seems conceivable that it could act differently.

Nassin 2021-01-25T20:55:02.034800Z

Rigidity arises in systems to the extent that the schema pervades the storage representation or application access patterns, making changes to your tables or documents difficult.

Nassin 2021-01-25T20:55:42.035400Z

Is this referring to be able to do row-shaped, column-shaped, graph-like, and document-like data modeling more freely with less constraints?

Nassin 2021-01-25T21:04:26.035800Z

Was taken from here BTW https://ask.datomic.com/index.php/225/does-datomic-support-schema-less-data