| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -32,7 +32,8 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					   CREATE (p:property {uuid:{prop_uuid}})-[:of]->(i),
 | 
					 | 
					 | 
					 | 
					   CREATE (p:property {uuid:{prop_uuid}})-[:of]->(i),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          (p)-[:of]->(a)
 | 
					 | 
					 | 
					 | 
					          (p)-[:of]->(a)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     SET p.value = {value},
 | 
					 | 
					 | 
					 | 
					     SET p.value = {value},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					         p.created_at = {created_at}")
 | 
					 | 
					 | 
					 | 
					         p.created_at = {created_at},
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					         p.updated_at = {updated_at}")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					(defn create! [schema-uuid instance]
 | 
					 | 
					 | 
					 | 
					(defn create! [schema-uuid instance]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (let [instance-uuid (neo4j/uuid)
 | 
					 | 
					 | 
					 | 
					  (let [instance-uuid (neo4j/uuid)
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -82,8 +83,29 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     SET i.name = {name},
 | 
					 | 
					 | 
					 | 
					     SET i.name = {name},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					         i.updated_at = {updated_at}")
 | 
					 | 
					 | 
					 | 
					         i.updated_at = {updated_at}")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					(neo4j/defquery edit-property
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  "MATCH (i:instance {uuid:{instance_uuid}}),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					         (a:attribute {uuid:{attribute_uuid}})
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					   MERGE (p:property {uuid:{uuid}})-[:of]->(i)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					   MERGE (p)-[:of]->(a)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					   ON CREATE SET p.created_at = {now},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                 p.updated_at = {now},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                 p.value = {value}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					   ON MATCH SET p.updated_at = {now},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                p.value = {value}")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					(defn edit! [instance]
 | 
					 | 
					 | 
					 | 
					(defn edit! [instance]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  (neo4j/exec-query! edit-instance
 | 
					 | 
					 | 
					 | 
					  (clojure.pprint/pprint instance)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  (let [prop-tuples (map #(vector edit-property
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                  {:uuid (:uuid % (neo4j/uuid))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                   :now (neo4j/now-str)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                   :value (:value %)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                   :instance_uuid (:uuid instance)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                   :attribute_uuid (-> % :attribute :uuid)})
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                         (:properties instance))]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    (apply neo4j/exec-queries!
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					           (concat [[edit-instance
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                      {:uuid (:uuid instance)
 | 
					 | 
					 | 
					 | 
					                      {:uuid (:uuid instance)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                       :name (:name instance)
 | 
					 | 
					 | 
					 | 
					                       :name (:name instance)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                      :updated_at (neo4j/now-str)}))
 | 
					 | 
					 | 
					 | 
					                       :updated_at (neo4j/now-str)}]]
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                   prop-tuples))))
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
 
 |