diff --git a/src/arachne/aristotle/query/spec.clj b/src/arachne/aristotle/query/spec.clj index 5dd2513..fbdf86c 100644 --- a/src/arachne/aristotle/query/spec.clj +++ b/src/arachne/aristotle/query/spec.clj @@ -70,7 +70,7 @@ (defd ::sort-conditions "A list of alternating expresion/direction pairs." - (s/cat :pairs (s/+ (s/cat :expr ::expr :direction #{:asc :desc})))) + (s/spec (s/cat :pairs (s/+ (s/cat :expr ::expr :direction #{:asc :desc}))))) (defd ::quad "Quad represented as a 4-tuple" diff --git a/test/arachne/aristotle/query_test.clj b/test/arachne/aristotle/query_test.clj index 1424a50..6753732 100644 --- a/test/arachne/aristotle/query_test.clj +++ b/test/arachne/aristotle/query_test.clj @@ -34,7 +34,19 @@ '[:bgp [?e :ds/zip_code "90001"] [?e :ds/total_population ?pop]])] - (is (= "57110" (get (first results) '?pop))))) + (is (= "57110" (get (first results) '?pop)))) + (let [results (q/run test-graph + '[:top-n 10 [(:xsd/integer ?population) :desc] + [:bgp + [?district :ds/total_population ?population]]])] + (is (= (count results) 10)) + (is (= "" (get (first results) '?district)))) + (let [results (q/run test-graph + '[:order [(:xsd/integer ?population) :asc] + [:bgp + [?district :ds/total_population ?population]]])] + (is (= "0" (get (first results) '?population))) + (is (= "105549" (get (last results) '?population))))) (deftest functions+filters (is (= #{["90650"]}