|
|
|
@ -13,6 +13,10 @@
|
|
|
|
|
:component (or (System/getenv "SCHEMA_COMPONENT")
|
|
|
|
|
"439856be-85be-49c1-b58b-4594741f37b3")})
|
|
|
|
|
|
|
|
|
|
(def attribute-uuids
|
|
|
|
|
{:module-desc (or (System/getenv "ATTR_MODULE_DESC")
|
|
|
|
|
"0924be5a-9680-44e3-986f-54b5b59631ba")})
|
|
|
|
|
|
|
|
|
|
(def coc-instance-uuids
|
|
|
|
|
{"dev" (or (System/getenv "INST_DEV")
|
|
|
|
|
"6348f1ab-1771-4bef-b101-eb76ec236646")
|
|
|
|
@ -63,12 +67,29 @@
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery instance
|
|
|
|
|
"MATCH (i:instance {uuid:{uuid}})
|
|
|
|
|
RETURN i")
|
|
|
|
|
OPTIONAL MATCH
|
|
|
|
|
(p:property)-[:of]->(i),
|
|
|
|
|
(a:attribute)<-[:of]-(p)
|
|
|
|
|
RETURN i, p, a")
|
|
|
|
|
(defn instance! [uuid]
|
|
|
|
|
(-> (neo4j/exec-query! instance
|
|
|
|
|
{:uuid uuid})
|
|
|
|
|
first
|
|
|
|
|
:i))
|
|
|
|
|
(let [res (neo4j/exec-query! instance
|
|
|
|
|
{:uuid uuid})
|
|
|
|
|
instance (-> res
|
|
|
|
|
first
|
|
|
|
|
:i
|
|
|
|
|
(assoc :properties []))]
|
|
|
|
|
(reduce (fn [instance row]
|
|
|
|
|
(if-let [prop (:p row)]
|
|
|
|
|
(update instance
|
|
|
|
|
:properties
|
|
|
|
|
conj (assoc prop :attr
|
|
|
|
|
(:a row)))
|
|
|
|
|
instance))
|
|
|
|
|
instance
|
|
|
|
|
res)))
|
|
|
|
|
(comment
|
|
|
|
|
(instance! "0b30521a-0727-4a6b-b69e-6f3c554a81b2")
|
|
|
|
|
(instance! "fbe4375b-6518-45bb-a692-e58dccd8f658"))
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery modules-with-comps
|
|
|
|
|
"MATCH (level:instance {uuid:{level_uuid}}),
|
|
|
|
@ -118,3 +139,28 @@
|
|
|
|
|
(comment
|
|
|
|
|
(modules-and-levels! "d97628f4-477d-49d7-a1c1-2fd643a0ee65")
|
|
|
|
|
(instance! "d97628f4-477d-49d7-a1c1-2fd643a0ee65"))
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery components-of-module
|
|
|
|
|
"MATCH (module:instance {uuid:{uuid}}),
|
|
|
|
|
(cschema:schema {uuid:{compschema_uuid}}),
|
|
|
|
|
(comp:instance)-[:of]->(schema),
|
|
|
|
|
(module)--(:link)--(comp)
|
|
|
|
|
RETURN comp
|
|
|
|
|
ORDER BY comp.name")
|
|
|
|
|
(defn module! [uuid]
|
|
|
|
|
(let [i (instance! uuid)
|
|
|
|
|
desc (->> (:properties i)
|
|
|
|
|
(filter #(= (:module-desc attribute-uuids)
|
|
|
|
|
(-> % :attr :uuid)))
|
|
|
|
|
first
|
|
|
|
|
:value)
|
|
|
|
|
comps (->> {:uuid uuid
|
|
|
|
|
:compschema_uuid (:component schema-uuids)}
|
|
|
|
|
(neo4j/exec-query! components-of-module)
|
|
|
|
|
(map :comp))]
|
|
|
|
|
|
|
|
|
|
(assoc i
|
|
|
|
|
:desc desc
|
|
|
|
|
:components comps)))
|
|
|
|
|
(comment
|
|
|
|
|
(module! "0b30521a-0727-4a6b-b69e-6f3c554a81b2"))
|
|
|
|
|