Skip to content

Instantly share code, notes, and snippets.

@cldwalker
cldwalker / explore_datafy_nav.clj
Created August 11, 2020 06:03 — forked from sashton/explore_datafy_nav.clj
Clojure datafy/nav exploration
(ns explore-datafy-nav
"Sample code demonstrating naving around a random graph of data.
The graph very likely will have circular references, which is not a problem.
To see the results, execute the entire file.
Each step in the nav process will be printed out, as well as the initial db.
Subsequent executions will generate a new random db."
(:require [clojure.datafy :refer [datafy nav]]
[clojure.pprint]))
(defn generate-db
@cldwalker
cldwalker / logseq-join-query.md
Last active January 31, 2022 00:09
Example logseq queries of joining across blocks by user defined properties

This gist demonstrates joining across user defined block properties. To start, paste the following 3 blocks in Logseq:

- type:: person
  name:: foo
- type:: comment
  author:: foo
  text:: bar
- #+BEGIN_QUERY
  {:title "Query joining blocks by user defined properties"
@cldwalker
cldwalker / page-property-join-example-query
Created January 31, 2022 00:11
logseq page-property-join-example-query
- #+BEGIN_QUERY
{:title "Query joining page properties with a rule"
:query [:find (pull ?things [*])
:in $ ?region %
:where
(page-name-property ?_b ?country :region ?region)
(page-name-property ?_b2 ?author :country-of-origin ?country)
(page-name-property ?things ?_name :authored-by ?author)]
:inputs ["Middle East"
[[(page-name-property ?b ?block-name ?property-name ?property-value)