Fork me on GitHub
#datomic
<
2022-04-30
>
jasonjckn02:04:27

The project i’m working on is creating a knowledge graph of sorts, we’re pulling in data from variety of disparate sources, typically deeply nested JSON data, and it’s not immediately clear to me what the schema needs to be ahead-of-time, until we see more use cases, we only have a vague sense of which parts of the JSON will end up being useful, is this a good fit for datomic? I tend to think of schemaless databases as the ‘solution’ here, where retrospectively you can decide on what your indexes will be, speed up particular queries , as you acquire more requirements/use cases on the sorts of queries that matter. If not datomic, what would you suggest, also needs to support graph query operations. If datomic, the strategy is to break apart these deeply nested JSON structures at ingest time try and mapping to datomic primitives, e.g. json arrays into db.cardinality/many or how would you go about that?

kenny15:04:31

“Schemaless” just pushes the schema requirement to the read side. Dynamically generated schema is a rocky road. You need to really trust the data set to do such a thing. It sounds like you would be better off with a different database.

Linus Ericsson11:05:05

Postgres and other databases has better support for plain JSON-documents and other things. Still Datomic could link these documents and you could batch read and upsert your datomic schema at your own pace.

Linus Ericsson11:05:53

It is certainly possible to store serialized datastructures as byte arrays in Datomic, but they are no more than just byte arrays. Also, Datomic sometimes store data multiple times.

vlad_poh21:04:18

how do i pass multiple rules in a single query?

(d/q '[:find ?t (count ?t2) (count ?t3)
       :in $ % ?p1 ?p2 
       :where
       (played2 ?p1 ?p2 ?t)
       (wins ?p1 ?p2 ?t2)
       (wins ?p2 ?p1 ?t3)
       [(= ?t ?t2 ?t3)]]
     atp wins played2 "Roger Federer" "Novak Djokovic" )
expected: [$ % ?p1 ?p2], got: 5

favila22:04:35

I don’t understand your expected/got. But the rule argument is just a vector of rules, so just add more rules to the vector to pass more rules

favila22:04:38

(into wins played2) probably

👍 1