Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 1.46 KB

README.md

File metadata and controls

43 lines (34 loc) · 1.46 KB

Description

These examples demonstrate how Logseq graphs can take part in the linked data ecosystem. Logseq's properties provide the necessary structure for users to define their own ontologies and opt in to existing ones.

Setup

  • Install node.js >= 16 and yarn.
  • Run yarn install to install npm dependencies.
  • Install babashka

Usage

Write rdf

Note: For a maintained version of this script, see https://github.com/logseq/rdf-export.

The write_rdf.cljs script converts a subset of a Logseq graph to an rdf file. For example:

# Clone a graph that has the ontological defaults of the script
$ git clone https://github.com/logseq/docs
...
# By default the output format is written as turtle
$ yarn nbb-logseq write_rdf.cljs docs docs.ttl
Parsing 277 files...
Writing file docs.ttl
# The output format can be changed with the :format config.
# For example, if :format is changed to "n-triples":
$ yarn nbb-logseq write_rdf.cljs docs docs.nt
Parsing 277 files...
Writing file docs.nt

With an rdf file, you can setup a SPARQL endpoint so anyone can query your data. Dydra provides this service for free. For example, you can query logseq's docs here. See https://github.com/logseq/docs/tree/master/script for an up to date version of this script.