Răsfoiți Sursa

fix: schema script and class renamed urls

also a minor change on update script I forgot to commit
Gabriel Horner 2 ani în urmă
părinte
comite
958971f8e9

+ 6 - 4
scripts/src/logseq/tasks/db_graph/create_graph_with_schema_org.cljs

@@ -55,13 +55,15 @@
                                          (if (string? type') [type'] type')))
                                   "schema:DataType")
                        "schema:DataType")
-        properties (sort (class-properties (class-m "@id")))]
+        properties (sort (class-properties (class-m "@id")))
+        url (-> (class-m "@id")
+                (string/replace-first "schema:" "https://schema.org/")
+                (string/replace-first #"_Class$" ""))]
     (cond-> {:block/original-name (string/replace-first (class-m "@id") "schema:" "")
              :block/type "class"
              :block/uuid (get-class-uuid class-uuids (class-m "@id"))
              :db/id (get-class-db-id class-db-ids (class-m "@id"))
-             :properties (cond->
-                          {:url (string/replace-first (class-m "@id") "schema:" "https://schema.org/")}
+             :properties (cond-> {:url url}
                            (class-m "rdfs:comment")
                            (assoc :description (get-comment-string (class-m "rdfs:comment"))))}
       parent-class
@@ -156,7 +158,7 @@
   "Properties and class names conflict in Logseq because schema.org names are
   case sensitive whereas Logseq's :block/name is case insensitive. This is dealt
   with by appending a '_Class' suffix to conflicting classes.  If this strategy
-  changes, be sure to update schema->logseq-data-types"
+  changes, be sure to update schema->logseq-data-types and ->class-page"
   [property-ids class-ids {:keys [verbose]}]
   (let [conflicts
         (->> (concat property-ids class-ids)

+ 1 - 2
scripts/src/logseq/tasks/db_graph/update_graph_to_add_todos.cljs

@@ -31,8 +31,7 @@
                                 (hash-map :db/id (:db/id %)
                                           :block/content (str "TODO " (:block/content %))
                                           :block/marker "TODO"
-                                          :block/refs (into [{:db/id todo-id}] (:block/refs %))
-                                          :block/path-refs (into [{:db/id todo-id}] (:block/path-refs %))))
+                                          :block/refs (into [{:db/id todo-id}] (:block/refs %))))
                              blocks-to-update))]
     (persist-graph/add-listener conn db-name)
     (d/transact! conn update-tx)

+ 2 - 1
scripts/src/logseq/tasks/db_graph/validate_client_db.cljs

@@ -61,4 +61,5 @@
     (println "Read graph" (str db-name " with " (count datoms) " datoms!"))
     (validate-client-db ent-maps)))
 
-(when (= nbb/*file* (:file (meta #'-main))) (-main *command-line-args*))
+(when (= nbb/*file* (:file (meta #'-main)))
+  (-main *command-line-args*))