|
|
|
@ -25,7 +25,7 @@
|
|
|
|
|
"MATCH (coc:instance {uuid:{coc_uuid}}),
|
|
|
|
|
(rschema:schema {uuid:{roleschema_uuid}}),
|
|
|
|
|
(role:instance)-[:of]->(rschema),
|
|
|
|
|
(coc)--(:link)--(role:instance)
|
|
|
|
|
(coc)--(:link)--(role)
|
|
|
|
|
OPTIONAL MATCH
|
|
|
|
|
(lschema:schema {uuid:{levelschema_uuid}}),
|
|
|
|
|
(level:instance)-[:of]->(lschema),
|
|
|
|
@ -39,7 +39,10 @@
|
|
|
|
|
(group-by :role)
|
|
|
|
|
(map (fn [[role rows]]
|
|
|
|
|
{:role role
|
|
|
|
|
:levels (filter some? (map :level rows))}))))
|
|
|
|
|
:levels (->> (map :level rows)
|
|
|
|
|
(filter some?)
|
|
|
|
|
(sort-by :name))}))
|
|
|
|
|
(sort-by #(-> % :role :name))))
|
|
|
|
|
|
|
|
|
|
(comment
|
|
|
|
|
(roles-with-levels-of-coc! "dev")
|
|
|
|
@ -57,3 +60,42 @@
|
|
|
|
|
first
|
|
|
|
|
:coc
|
|
|
|
|
(assoc :key coc-key)))
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery level
|
|
|
|
|
"MATCH (level:instance {uuid:{uuid}})
|
|
|
|
|
RETURN level")
|
|
|
|
|
(defn level! [uuid]
|
|
|
|
|
(-> (neo4j/exec-query! level
|
|
|
|
|
{:uuid uuid})
|
|
|
|
|
first
|
|
|
|
|
:level))
|
|
|
|
|
|
|
|
|
|
(neo4j/defquery modules-with-comps
|
|
|
|
|
"MATCH (level:instance {uuid:{level_uuid}}),
|
|
|
|
|
(mschema:schema {uuid:{moduleschema_uuid}}),
|
|
|
|
|
(module:instance)-[:of]->(mschema),
|
|
|
|
|
(level)--(:link)--(module)
|
|
|
|
|
OPTIONAL MATCH
|
|
|
|
|
(cschema:schema {uuid:{compschema_uuid}}),
|
|
|
|
|
(comp:instance)-[:of]->(cschema),
|
|
|
|
|
(module)--(:link)--(comp)
|
|
|
|
|
RETURN module, comp")
|
|
|
|
|
(defn modules-with-comps! [level-uuid]
|
|
|
|
|
(->> (neo4j/exec-query! modules-with-comps
|
|
|
|
|
{:level_uuid level-uuid
|
|
|
|
|
:moduleschema_uuid (:module schema-uuids)
|
|
|
|
|
:compschema_uuid (:component schema-uuids)})
|
|
|
|
|
(group-by :module)
|
|
|
|
|
(map (fn [[module rows]]
|
|
|
|
|
{:module module
|
|
|
|
|
:comps (->> (map :comp rows)
|
|
|
|
|
(filter some?)
|
|
|
|
|
(sort-by :name))}))
|
|
|
|
|
(sort-by #(-> % :module :name))))
|
|
|
|
|
|
|
|
|
|
(comment
|
|
|
|
|
(modules-with-comps! "140962fb-f55e-45ab-87fc-680c012bd8dc")
|
|
|
|
|
(neo4j/exec-query! modules-with-comps
|
|
|
|
|
{:level_uuid "140962fb-f55e-45ab-87fc-680c012bd8dc"
|
|
|
|
|
:moduleschema_uuid (:module schema-uuids)
|
|
|
|
|
:compschema_uuid (:component schema-uuids)}))
|
|
|
|
|