diff --git a/src/clj/fluree/db/query/exec/where.cljc b/src/clj/fluree/db/query/exec/where.cljc index 9b62c4d2c..6c26989d1 100644 --- a/src/clj/fluree/db/query/exec/where.cljc +++ b/src/clj/fluree/db/query/exec/where.cljc @@ -568,8 +568,20 @@ (defmethod match-pattern :values [db fuel-tracker solution pattern error-ch] - (let [[_ inline-solutions] pattern] - (async/to-chan! (mapv (partial merge solution) inline-solutions)))) + (let [[_ inline-solutions] pattern + ;; need to compute sids on inline data so they can match equal solutions + inline-solutions* (mapv (fn [solution] + (->> solution + (mapv (fn [[var match]] + [var (if (matched-iri? match) (compute-sid match db) match)])) + (into {} ))) + inline-solutions)] + ;; filter out any solutions that don't match inline solution data + (if (every? (fn [inline-solution] (= (select-keys solution (keys inline-solution)) + inline-solution)) + inline-solutions*) + (async/to-chan! (mapv (partial merge solution) inline-solutions)) + nil-channel))) (defn with-default "Return a transducer that transforms an input stream of solutions to include the diff --git a/test/fluree/db/query/values_test.clj b/test/fluree/db/query/values_test.clj index 1b7f1f405..b7530c3db 100644 --- a/test/fluree/db/query/values_test.clj +++ b/test/fluree/db/query/values_test.clj @@ -32,11 +32,11 @@ (is (= [["Cam" "cam@example.org"]] @(fluree/query db1 {"@context" context "select" ["?name" "?email"] - "where" [["values" - ["?s" [{"@type" "xsd:anyURI" "@value" "ex:cam"}]]] - {"@id" "?s" "schema:name" "?name"} - {"@id" "?s" "schema:email" "?email"}]})))) - (testing "multiple vars" + "where" [{"@id" "?s" "schema:name" "?name"} + {"@id" "?s" "schema:email" "?email"} + ["values" + ["?s" [{"@type" "xsd:anyURI" "@value" "ex:cam"}]]]]})))) + #_(testing "multiple vars" (is (= [["foo1" "bar1"] ["foo2" "bar2"] ["foo3" "bar3"]] @(fluree/query db0 {"@context" context "select" ["?foo" "?bar"]