From f9a30b494fcdd7240c742ed7139b24ce6d3d53dc Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Tue, 8 Oct 2024 16:56:08 -0400 Subject: [PATCH] Update lib to run with feat/db branch and ensure file graph still runs --- nbb.edn | 3 +-- package.json | 4 +++- src/logseq/rdf_export.cljs | 24 ++++++++++++------------ src/logseq/rdf_export/config.cljs | 2 +- test/fixtures/docs-with-labels.ttl | 4 ++-- test/fixtures/docs.ttl | 4 ++-- yarn.lock | 7 +++---- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/nbb.edn b/nbb.edn index a45332d..66f6706 100644 --- a/nbb.edn +++ b/nbb.edn @@ -2,7 +2,6 @@ {org.babashka/cli {:mvn/version "0.6.46"} logseq/graph-parser {:git/url "https://github.com/logseq/logseq" - :git/sha "82cf4d3c65acbf230a3170640fe271dd74095067" - :git/tag "0.9.8" + :git/sha "eed5c8bce43d5235dd1936e72d60fae2b0cd03bb" :deps/root "deps/graph-parser"} #_{:local/root "../logseq/deps/graph-parser"}}} diff --git a/package.json b/package.json index 3d84948..508ce18 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,10 @@ "url": "https://github.com/logseq/rdf-export/issues" }, "homepage": "https://github.com/logseq/rdf-export#readme", + "devDependencies": { + "@logseq/nbb-logseq": "logseq/nbb-logseq#feat-db-v16" + }, "dependencies": { - "@logseq/nbb-logseq": "^1.2.168", "mldoc": "^1.5.0", "n3": "^1.16.3", "turtle-validator": "^1.1.1" diff --git a/src/logseq/rdf_export.cljs b/src/logseq/rdf_export.cljs index 70e66f2..290d476 100644 --- a/src/logseq/rdf_export.cljs +++ b/src/logseq/rdf_export.cljs @@ -10,7 +10,7 @@ All of the above pages can be customized with query config options." [clojure.edn :as edn] [clojure.set :as set] [datascript.core :as d] - [logseq.db.rules :as rules] + [logseq.db.frontend.rules :as rules] [babashka.cli :as cli] [logseq.graph-parser.cli :as gp-cli] [logseq.rdf-export.config :as config] @@ -23,10 +23,10 @@ All of the above pages can be customized with query config options." (map (fn [block] (let [block-name (or (get-in block [:block/properties :title]) - (:block/original-name block) + (:block/title block) ;; Use page name for non-journal pre-blocks (when-not (get-in block [:block/page :block/journal?]) - (get-in block [:block/page :block/original-name])))] + (get-in block [:block/page :block/title])))] (cond-> (-> (:block/properties block) ;; TODO: Add proper tags support @@ -34,7 +34,7 @@ All of the above pages can be customized with query config options." ((fn [x] (apply dissoc x exclude-properties))) expand-entity-fn) (some? block-name) - (assoc :block/original-name block-name)))) + (assoc :block/title block-name)))) result)) (defn- page-url [page-name config] @@ -49,8 +49,8 @@ All of the above pages can be customized with query config options." [m {:keys [url-property type-property classes-without-ids unique-id-properties] :as config} property-map] - (if-let [subject (if (:block/original-name m) - (page-url (:block/original-name m) config) + (if-let [subject (if (:block/title m) + (page-url (:block/title m) config) (some #(when-let [v (m %)] (if (url? v) v (page-url v config))) unique-id-properties))] @@ -75,7 +75,7 @@ All of the above pages can be customized with query config options." (defn- block->label-triple [block] [(:url block) "http://www.w3.org/2000/01/rdf-schema#label" - (:block/original-name block)]) + (:block/title block)]) (defn- build-alias-triples [ents config] @@ -84,7 +84,7 @@ All of the above pages can be customized with query config options." (mapcat #(map (fn [alias] (block->label-triple {:url (page-url alias config) - :block/original-name (:block/original-name %)})) + :block/title (:block/title %)})) (:alias %))))) (defn- add-class-instances [db config property-map {:keys [add-labels]}] @@ -115,7 +115,7 @@ All of the above pages can be customized with query config options." (vals rules/query-dsl-rules)) (map first) (create-entities config)) - built-in-properties {:block/original-name + built-in-properties {:block/title {:url (if add-labels "http://www.w3.org/2000/01/rdf-schema#label" "https://schema.org/name")} @@ -124,7 +124,7 @@ All of the above pages can be customized with query config options." "http://www.w3.org/2002/07/owl#sameAs" "https://schema.org/sameAs")}} property-map (into built-in-properties - (map (juxt (comp keyword :block/original-name) identity) + (map (juxt (comp keyword :block/title) identity) properties))] (set (concat @@ -134,8 +134,8 @@ All of the above pages can be customized with query config options." (when add-labels (map (fn [[k v]] (block->label-triple - {:url (:url v) :block/original-name (name k)})) - (dissoc built-in-properties :block/original-name))))))) + {:url (:url v) :block/title (name k)})) + (dissoc built-in-properties :block/title))))))) (defn- add-quads [writer quads] (doseq [[q1 q2 q3] diff --git a/src/logseq/rdf_export/config.cljs b/src/logseq/rdf_export/config.cljs index 7474cb0..b0421e5 100644 --- a/src/logseq/rdf_export/config.cljs +++ b/src/logseq/rdf_export/config.cljs @@ -50,7 +50,7 @@ :in $ % :where (page-property ?b :type "Class") - [?b :block/original-name ?n] + [?b :block/title ?n] (page-property ?b2 :type ?n)] ;; Query to fetch additional instances. ;; Useful for instances that aren't fetched by :class-instances-query diff --git a/test/fixtures/docs-with-labels.ttl b/test/fixtures/docs-with-labels.ttl index 7ffcd34..fb4c0df 100644 --- a/test/fixtures/docs-with-labels.ttl +++ b/test/fixtures/docs-with-labels.ttl @@ -210,8 +210,6 @@ d:Rectangle "Whiteboard/Tool/Shape/ d:Search a d:Feature; "Search"; d:platforms . -d:Settings a ; - "Settings". d:Shape "Whiteboard/Tool/Shape". d:Shapes "Whiteboard/Tool/Shape". a d:Feature; @@ -436,6 +434,8 @@ d:sameAs a d:Property; "sameAs"; d:rangeIncludes d:Uri; s:url . +d:settings a ; + "settings". d:slide a d:Feature; "slide"; d:Presentation; diff --git a/test/fixtures/docs.ttl b/test/fixtures/docs.ttl index 29548ff..5741087 100644 --- a/test/fixtures/docs.ttl +++ b/test/fixtures/docs.ttl @@ -249,8 +249,6 @@ d:Query a d:Command; d:Search a d:Feature; d:platforms ; s:name "Search". -d:Settings a ; - s:name "Settings". a d:Feature; d:initial-version "0.9.10"; d:platforms ; @@ -501,6 +499,8 @@ d:sameAs a d:Property; s:description "Indicates that two URIs are equivalent"; s:name "sameAs"; s:url . +d:settings a ; + s:name "settings". d:slide a d:Feature; d:platforms ; s:name "slide"; diff --git a/yarn.lock b/yarn.lock index c4969b3..f389d61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,9 @@ # yarn lockfile v1 -"@logseq/nbb-logseq@^1.2.168": - version "1.2.168" - resolved "https://registry.yarnpkg.com/@logseq/nbb-logseq/-/nbb-logseq-1.2.168.tgz#e4120c4a7eb6c80737473292c1e20919b4453c91" - integrity sha512-lgZuAhck/74+9mT4vr6jVLkPcyRA/RO8ApBizq3d1L6LsPlPjdRp4nIaC2I1/p/AaIIB5vP89pMpqZfVsIHHQg== +"@logseq/nbb-logseq@logseq/nbb-logseq#feat-db-v16": + version "1.2.173-feat-db-v16" + resolved "https://codeload.github.com/logseq/nbb-logseq/tar.gz/5c52c2869da240283db96cd13366e45e532c5d29" dependencies: import-meta-resolve "^2.1.0"