Skip to content
Snippets Groups Projects
Commit 42cf1b36 authored by Mario Wenzel's avatar Mario Wenzel
Browse files

fixed datascript

parent 6aa259c3
No related branches found
No related tags found
No related merge requests found
......@@ -4,8 +4,7 @@ const d = require('datascript');
var src = process.argv[2];
var data = JSON.parse(fs.readFileSync(src));
var par_db = d.db_with(d.empty_db({"par": {":db/index": true}}),
var par_db = d.db_with(d.empty_db({"par": {":db/index": true, ":db/cardinality": ":db.cardinality/many"}}),
data);
console.log(data.length);
console.log("Starting Query");
......@@ -13,10 +12,8 @@ var res = d.q('[:find ?e1 ?e2 \
:in $ % \
:where (tc ?e1 ?e2)]',
par_db,
'[ [(tc ?e1 ?e2) [?e1 par ?e2] ] \
[(tc ?e1 ?e2) [?e1 par ?ex] (tc ?ex ?e2) ] \
'[ [(tc ?e1 ?e2) [?e1 "par" ?e2] ] \
[(tc ?e1 ?e2) [?e1 "par" ?ex] (tc ?ex ?e2) ] \
]'
);
var c = 0;
res.forEach(function(i){c++; console.log(i);});
console.log(c);
console.log(res.length);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment