datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
2018-03-05T00:57:01.000182Z

When transacting how do you go about referencing an entity that doesn’t yet have an id? I thought the docs implied if you used the :db/id key it would use the supplied value as a temp id: I thought it was something like this:

[{:db/id -1
  :person/name "sally"}
  {:person/name "joe"
    :person/spouse -1}
]

2018-03-05T01:22:13.000133Z

I’m very confused, the code here doesn’t work:

(def schema {:car/maker {:db/type :db.type/ref}
             :car/colors {:db/cardinality :db.cardinality/many}}

(def conn (d/create-conn schema))

(d/transact! conn [{:db/id -1
                    :maker/name "BMW"
                    :maker/country "Germany"}
                    {:car/maker -1
                    :car/name "i525"
                    :car/colors ["red" "green" "blue"]}])

(d/q '[:find ?name
        :where
        [?e :maker/name "BMW"]
        [?c :car/maker ?e]
        [?c :car/name ?name]]
      @conn)
From this blog post: http://udayv.com/clojurescript/clojure/2016/04/28/datascript101-chapter1-initializing-inserting-and-querying-records/

2018-03-05T02:36:31.000095Z

i guess its supposed to be valueType not type

2018-03-05T02:36:58.000133Z

i’m learning the goto place is tests not blogs 🙂

devn 2018-03-05T03:54:14.000166Z

@carocad I’ve used datascript with way more than 100k datoms

devn 2018-03-05T03:56:01.000146Z

We used it with an order of magnitude or more datoms in production

1
2018-03-05T17:19:01.000680Z

Is there a limit to how far down a graph you can walk with the pull api? e.g to get the great grandson of person/entity 1. (d/pull db [{:son {:son {:son [:db/id]}}} 1])

2018-03-05T17:56:14.000665Z

I know you can easily walk one relationship.