Skip to content

Commit

Permalink
ensure that @type and rdfs:Class have complete property maps
Browse files Browse the repository at this point in the history
  • Loading branch information
zonotope committed Aug 17, 2024
1 parent ee8daba commit bb5997a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/clj/fluree/db/json_ld/vocab.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@
:childProps #{}
:datatype nil})

(defn initial-property-map*
[iri sid]
(assoc base-property-map :id sid, :iri iri))

(defn initial-property-map
[db sid]
(let [iri (iri/decode-sid db sid)]
(assoc base-property-map :id sid
:iri iri)))
(initial-property-map* iri sid)))

(defn add-subclass
[prop-map subclass]
Expand Down Expand Up @@ -186,6 +189,12 @@

:else pred-map)))

(def initial-type-map
(initial-property-map* const/iri-type const/$rdf:type))

(def initial-class-map
(initial-property-map* const/iri-class const/$rdfs:Class))

(defn with-vocab-flakes
[pred-map db vocab-flakes]
(let [new-pred-map (reduce (fn [pred-map* vocab-flake]
Expand All @@ -195,9 +204,7 @@
(if (iri/sid? k)
(assoc preds k v, (:iri v) v)
preds))
{"@type" {:iri "@type"
:id const/$rdf:type}}
new-pred-map)))
{const/iri-type initial-type-map} new-pred-map)))

(defn refresh-subclasses
[{:keys [pred] :as schema}]
Expand All @@ -212,10 +219,7 @@

(defn base-schema
[]
(let [pred (map-pred-id+iri [{:iri "@type"
:id const/$rdf:type}
{:iri "http://www.w3.org/2000/01/rdf-schema#Class"
:id const/$rdfs:Class}])]
(let [pred (map-pred-id+iri [initial-type-map initial-class-map])]
{:t 0
:pred pred
:shapes (atom {:class {} ; TODO: Does this need to be an atom?
Expand Down

0 comments on commit bb5997a

Please sign in to comment.