   (apply str (map (fn [child]
                     (str
                      (if (:rev (first child))
-                       (str "?a"
+                       (str "?"
                             (:id (first child)) " "
-                            "<"(:pred (first child)) "> ?a"
-                            (:id node) " .\n" )
-                       (str "?a"
-                            (:id node) " "
-                            "<"(:pred (first child)) "> ?a"
+                            "<"(:pred (first child)) "> ?"
+                            (if (:path node) "p" "") (:id node) " .\n" )
+                       (str "?"
+                            (if (:path node) "p" "") (:id node) " "
+                            "<"(:pred (first child)) "> ?"
                             (:id (first child)) " .\n" ))
                      (render-graph child) "\n"))
                   children)))
 
-
+(defn query-map [query]
+  (let [vals (q-map query)
+        qm (new QuerySolutionMap)]
+    (doall (map (fn [key] (.add qm (str key) (res (get vals key)))) (keys vals)))
+    qm))
 (defn build-query [inf uri]
-  (let [query  [{:id "root"} (qbuild inf uri)]]
-    (.execConstruct
-     (. QueryExecutionFactory sparqlService
-        "http://localhost:8000/sparql/"
-        (str "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+  (let [query  (qbuild inf (parse-uri uri))
+        qm (query-map query)
+        s (str "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
 PREFIX ont: <http://logangilmour.com/example-ontology#>
 

                (assoc command
                  :value
                  ((serializer inf binding)
                   (build-query (to-model example-view) nil)
                   (if (= (:type command) "update")
                     (plit (:value command))
                     (res (:value command)))
                   (res (:uri command)))
                  :binding
                  (.toString binding))


                                                        (res (:root db))
                                                        (prop (:haschild db)))))]

        (fn [data resource uri]
          ((s-rec root inf []) data nil resource uri "/view/"))
        ))
  ([view-data binding]

      (let [inf (. ModelFactory createRDFSModel view-data)]

        (fn [data child resource uri] ((s-rec binding inf []) data child resource uri "/view/"))
        )))

(defn syncer [inf]
  (fn [command url]

    (let [predicate (res (:predicate command))
          binders (get-all-bindings inf predicate)
          bindings (map #(.getSubject %) binders)
          views (map (partial serializer inf) bindings)]

      (map (fn [binder]

             (let [binding (.getSubject binder)
                   reverse (= (.getURI (.getPredicate binder)) (db :binds))]

