mirror of
https://github.com/logseq/logseq.git
synced 2026-04-30 08:56:29 +00:00
Remove more cases of :block/schema
This commit is contained in:
@@ -2,18 +2,18 @@
|
||||
"Script that generates all the permutations of property types and cardinality.
|
||||
Also creates a page of queries that exercises most properties
|
||||
NOTE: This script is also used in CI to confirm graph creation works"
|
||||
(:require [logseq.outliner.cli :as outliner-cli]
|
||||
[logseq.common.util.date-time :as date-time-util]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.common.util.page-ref :as page-ref]
|
||||
[logseq.db.frontend.property.type :as db-property-type]
|
||||
[clojure.string :as string]
|
||||
(:require ["os" :as os]
|
||||
["path" :as node-path]
|
||||
[babashka.cli :as cli]
|
||||
[clojure.edn :as edn]
|
||||
[clojure.set :as set]
|
||||
[clojure.string :as string]
|
||||
[datascript.core :as d]
|
||||
["path" :as node-path]
|
||||
["os" :as os]
|
||||
[babashka.cli :as cli]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.common.util.date-time :as date-time-util]
|
||||
[logseq.common.util.page-ref :as page-ref]
|
||||
[logseq.db.frontend.property.type :as db-property-type]
|
||||
[logseq.outliner.cli :as outliner-cli]
|
||||
[nbb.classpath :as cp]
|
||||
[nbb.core :as nbb]))
|
||||
|
||||
@@ -168,16 +168,17 @@
|
||||
:properties
|
||||
(->> db-property-type/user-built-in-property-types
|
||||
(mapcat #(cond-> (if (= :node %)
|
||||
[[% {:block/schema {:type %} :build/schema-classes [:TestClass]}]
|
||||
[:node-without-classes {:block/schema {:type %}}]]
|
||||
[[% {:block/schema {:type %}}]])
|
||||
[[% {:property/type % :build/schema-classes [:TestClass]}]
|
||||
[:node-without-classes {:property/type %}]]
|
||||
[[% {:property/type %}]])
|
||||
(contains? db-property-type/cardinality-property-types %)
|
||||
(conj [(keyword (str (name %) "-many"))
|
||||
(cond-> {:block/schema {:type % :cardinality :many}}
|
||||
(cond-> {:property/type %
|
||||
:db/cardinality :many}
|
||||
(= :node %)
|
||||
(assoc :build/schema-classes [:TestClass]))])))
|
||||
(into (mapv #(vector (keyword (str (name %) "-closed"))
|
||||
{:block/schema {:type %}
|
||||
{:property/type %
|
||||
:build/closed-values (closed-values-config (keyword (str (name %) "-closed")))})
|
||||
[:default :url :number]))
|
||||
(into {}))}))
|
||||
|
||||
@@ -10,20 +10,20 @@
|
||||
* Some properties are skipped because they are superseded/deprecated or because they have a property
|
||||
type logseq doesnt' support yet
|
||||
* schema.org assumes no cardinality. For now, only :node properties are given a :cardinality :many"
|
||||
(:require [logseq.outliner.cli :as outliner-cli]
|
||||
[logseq.db.frontend.property :as db-property]
|
||||
[clojure.string :as string]
|
||||
[clojure.edn :as edn]
|
||||
[datascript.core :as d]
|
||||
["path" :as node-path]
|
||||
(:require ["fs" :as fs]
|
||||
["os" :as os]
|
||||
["fs" :as fs]
|
||||
[nbb.classpath :as cp]
|
||||
[nbb.core :as nbb]
|
||||
[clojure.set :as set]
|
||||
[clojure.walk :as w]
|
||||
["path" :as node-path]
|
||||
[babashka.cli :as cli]
|
||||
[logseq.db.frontend.malli-schema :as db-malli-schema]))
|
||||
[clojure.edn :as edn]
|
||||
[clojure.set :as set]
|
||||
[clojure.string :as string]
|
||||
[clojure.walk :as w]
|
||||
[datascript.core :as d]
|
||||
[logseq.db.frontend.malli-schema :as db-malli-schema]
|
||||
[logseq.db.frontend.property :as db-property]
|
||||
[logseq.outliner.cli :as outliner-cli]
|
||||
[nbb.classpath :as cp]
|
||||
[nbb.core :as nbb]))
|
||||
|
||||
(defn- get-comment-string
|
||||
[rdfs-comment renamed-pages]
|
||||
@@ -113,16 +113,15 @@
|
||||
|
||||
inverted-renamed-properties (set/map-invert renamed-properties)
|
||||
class-name (strip-schema-prefix (property-m "@id"))
|
||||
url (str "https://schema.org/" (get inverted-renamed-properties class-name class-name))
|
||||
schema (cond-> {:type schema-type}
|
||||
;; This cardinality rule should be adjusted as we use schema.org more
|
||||
(= schema-type :node)
|
||||
(assoc :cardinality :many))]
|
||||
url (str "https://schema.org/" (get inverted-renamed-properties class-name class-name))]
|
||||
{(keyword (strip-schema-prefix (property-m "@id")))
|
||||
(cond-> {:block/schema schema
|
||||
(cond-> {:property/type schema-type
|
||||
:build/properties (cond-> {:url url}
|
||||
(property-m "rdfs:comment")
|
||||
(assoc :logseq.property/description (get-comment-string (property-m "rdfs:comment") renamed-pages)))}
|
||||
;; This cardinality rule should be adjusted as we use schema.org more
|
||||
(= schema-type :node)
|
||||
(assoc :db/cardinality :many)
|
||||
(= schema-type :node)
|
||||
(assoc :build/schema-classes (mapv (comp keyword strip-schema-prefix) range-includes)))}))
|
||||
|
||||
@@ -260,7 +259,8 @@
|
||||
(apply merge
|
||||
(mapv #(->property-page % class-map options) select-properties))
|
||||
;; Have to update schema for now as validation doesn't take into account existing properties
|
||||
:logseq.property/description {:block/schema {:public? true :type :default}
|
||||
:logseq.property/description {:property/public? true
|
||||
:property/type :default
|
||||
:build/properties {:url "https://schema.org/description"
|
||||
:logseq.property/description "A description of the item."}}))
|
||||
|
||||
@@ -377,7 +377,7 @@
|
||||
(map (fn [m]
|
||||
(let [props (->> (db-property/properties m)
|
||||
(into {}))]
|
||||
(cond-> (select-keys m [:block/name :block/tags :block/title :block/schema :db/ident
|
||||
(cond-> (select-keys m [:block/name :block/tags :block/title :property/type :db/cardinality :db/ident
|
||||
:logseq.property.class/properties :logseq.property/parent
|
||||
:db/cardinality :property/schema.classes :block/refs])
|
||||
(seq props)
|
||||
|
||||
Reference in New Issue
Block a user