Questions tagged [datascript]

Immutable database and Datalog query engine for Clojure, ClojureScript and JS

Datascript is immutable in-memory database and Datalog query engine written in Clojure and ClojureScript for Clojure, ClojureScript and JavaScript.

24 questions
9
votes
2 answers

How to construct a query that matches exactly a vector of refs in DataScript?

Setup Consider the following DataScript database of films and cast, with data stolen from learndatalogtoday.org: the following code can be executed in a JVM/Clojure REPL or a ClojureScript REPL, as long as project.clj contains [datascript "0.15.0"]…
Ahmed Fasih
  • 6,458
  • 7
  • 54
  • 95
3
votes
1 answer

Datomic - Get all datoms relevant to an arbitrary query

Given an arbitrary datomic query q on database d, is it possible to derive a query x from q that when run against d would return all relevant datums r required to produce the result of q on d? The results of q on d should equal the results of q on…
Scott Klarenbach
  • 37,171
  • 15
  • 62
  • 91
3
votes
1 answer

Slow Datascript query

I'm using Datascript to query a tree structure for the last common ancestor of 2 nodes having given names, here's what I've got so far, but it's really slow -- any idea why (or is there a better way)? (defn lca "Last common ancestor" [db name1…
Hendekagon
  • 4,565
  • 2
  • 28
  • 43
3
votes
1 answer

Why does this query return no results?

Given these definitions of a datascript db, (def schema {:tag/name { :db/unique :db.unique/identity } :item/tag {:db/valueType :db.type/ref :db/cardinality :db.cardinality/many} :outfit/item {:db/valueType :db.type/ref …
Lyn Headley
  • 11,368
  • 3
  • 33
  • 35
2
votes
1 answer

What is the quickest and dirtiest way to store a ratom on a server?

Periodically, on my super simple web app, I will want to reset my app state (which is in a reagent atom) back to a pristine default. Before I do, however, I want to send my sullied app state off to a server for hoarding purposes. It will have data…
THX1137
  • 903
  • 6
  • 15
2
votes
1 answer

Why does this datalog query aggregate?

From https://github.com/tonsky/datascript (-> (d/q '[:find ?color (max ?amount ?x) (min ?amount ?x) :in [[?color ?x]] ?amount] [[:red 10] [:red 20] [:red 30] [:red 40] [:red 50] [:blue 7] [:blue 8]] 4) pr-str …
Stephen Cagle
  • 14,124
  • 16
  • 55
  • 86
1
vote
1 answer

Selenium click is not working with this one "document.getElementById("submitMe").click()"

I'm facing issue while click on the submit button using selenium webdriver also unable to click on the the web page button dynamically. I'm using selenium chrome webdriver, have tried below options as…
1
vote
1 answer

datomic / datascript beginner - can we have multiple schemas

very basic question to get me started. Suppose I have a database of sales by country: [{:sales/country "CN" :sales/amount 1000 :sales/account "XYZ"} ...] I would like to also have a list of facts about each country something…
alex314159
  • 3,159
  • 2
  • 20
  • 28
1
vote
1 answer

Datomic ids in datascript

I'm using datomic on the server side, with multiple reagent atoms on the client, and now looking at trying datascript on the client. Currently, I'm passing across a nested structure via an initial api load, which contains the result of a datomic…
mwal
  • 2,803
  • 26
  • 34
1
vote
1 answer

How to sum values including entities with missing attributes on Datalog/DataScript/Datomic

I'm learning Datalog/DataScript/Datomic. For this I've setup a simple ledger database on DataScript to play with. By now it basically consists of a set of accounts and a list of records with the attributes :entry.record/account and…
Peluko
  • 35
  • 3
1
vote
1 answer

How can I get cookies from Puppeteer chrome session C#?

I need to get cookies of particular website from puppeteer chrome session and add these cookies to script.Here is code I am doing to get cookies form page: page.GetCookiesAsync(); But it return: Id = 7315, Status = WaitingForActivation, Method =…
Mobeen
  • 45
  • 1
  • 8
1
vote
1 answer

How can I find whether a many cardinality attribute in Datascript contains an element?

I have a Datascript db that's like this: {:block/id {:db/unique :db.unique/identity} :block/children {:db/cardinality :db.cardinality/many} } :block/children contains :block/id of other blocks I've been trying to write a query to find which block…
TomLisankie
  • 3,785
  • 7
  • 28
  • 32
1
vote
1 answer

DataScript / datahike rules returning nothing

I try to search for a string in more than one field of a database in datahike. So far without success. Here is my best effort approach so far: (ns my.ns (:require [clojure.string :as st] [datahike.api :as dh])) (def card-db [[1…
tidecrudra
  • 11
  • 2
1
vote
2 answers

One to Many relation in datomic

Let's say I have a datomic data that looks like this - Author (id: 5) { name: "Mercy", blogs: [1, 2] } Blog (id: 1) { title: "Hello blog" } Blog (id: 2) { title: "Hello blog second" } I want to find a author by name and all the title of their…
Lordking
  • 1,413
  • 1
  • 13
  • 31
1
vote
1 answer

Does Datomic's tempid provide unique entity id?

I have some doubts about datomic.api/tempid fn that provides entity id. It produces some long value, not UUID String and long is 64 bit which makes me think about it's uniqueness after some point I might reach long's limit. It would be harder with…
Ertuğrul Çetin
  • 5,131
  • 5
  • 37
  • 76
1
2