Gabriel Horner 22d1cb54c5 fix: schema.org classes missing from tree 2 years ago
..
resources 34248736c7 First pass at a script that creates a db graph with schema.org ontology 2 years ago
src 22d1cb54c5 fix: schema.org classes missing from tree 2 years ago
.gitignore 5186070248 Finish migration of publishing to deps 2 years ago
README.md 7a48557ec9 Add url properties to schema and page properties 2 years ago
build-ios.sh 3bb17b46fd chore: bump to 0.8.12 2 years ago
bump-version.sh fe87fe20cf Added a configuration to specify a build version different than the release version 2 years ago
get-pkg-version.js 934ed3991c build(nightly): use prerelease semver 2 years ago
nbb.edn 31aa5a7e47 Working script to generate db graphs from CLI 2 years ago
package.json bcc37eb298 Update publishing to optionally work with db graphs 2 years ago
patch-xcode-project.sh 09bb2542db ci(ios): testflight build workflow 2 years ago
publishing.sh fe663cc858 chore: add publishing.sh 4 years ago
yarn.lock bcc37eb298 Update publishing to optionally work with db graphs 2 years ago

README.md

Description

This is a collection of development related scripts, written as bash scripts, bb/babashka scripts and nbb scripts.

Usage

Babashka scripts

Most bb scripts live under src/ and are defined as bb tasks. See babashka tasks

Nbb scripts

Before running nbb-logseq scripts, be sure to have node >= 18.14 installed as well as a recent babashka for managing the dependencies in nbb.edn. Then yarn install to install dependencies

Create graph scripts

For database graphs, it is possible to create graphs with the logseq.tasks.db-graph.create-graph ns. This ns makes it easy to write scripts that create graphs by supporting a concise EDN map for graph generation. For example, the create_graph_with_properties.cljs script uses this ns to create a graph with a variety of properties:

$ yarn nbb-logseq src/logseq/tasks/db_graph/create_graph_with_properties.cljs woot
Generating 16 pages and 24 blocks ...
Created graph woot!

This script creates a DB graph with blocks containing several property types for both single and many cardinality. It also includes queries for most of these properties. Read the docs in logseq.tasks.db-graph.create-graph for specifics on the EDN map.

Another example is the create_graph_with_schema_org.cljs script which creates a graph with the https://schema.org/ ontology with as many of the classes and properties as possible:

$ yarn -s nbb-logseq src/logseq/tasks/db_graph/create_graph_with_schema_org.cljs schema
Skipping 67 superseded properties
Skipping 25 properties with unsupported data types
Renaming 44 classes due to page name conflicts
Generating 2268 pages with 900 classes and 1368 properties ...
Created graph schema!

Update graph scripts

For database graphs, it is possible to update graphs with the logseq.tasks.db-graph.persist-graph ns. This ns makes it easy to write scripts that update graphs using datascript and logseq's schema. For example, the update_graph_to_add_todos.cljs script uses this ns to update blocks with a specified query with a TODO task marker:

$ yarn -s nbb-logseq src/logseq/tasks/db_graph/update_graph_to_add_todos.cljs woot '[:find (pull ?b [*]) :where (has-property ?b :url-many)]'
Updated 1 block(s) with a 'TODO' for graph woot!

This script updates a DB graph by finding all blocks that match the given property query and marking them as TODO.