我正在使用clj-plaza
(0.0.5-SNAPSHOT) 来查询 Sesame/Jena 模型。该函数model-query
似乎没有执行查询。clj-plaza
它改为返回查询的内部表示。
(init-jena-framework)
(def *m* (build-model))
(with-model *m*
(model-add-triples
(model-to-triples
(document-to-model "http://www.rdfdata.org/dat/rdfdata.rdf"
:rdf))))
(def all-subjects-query
(defquery
(query-set-vars [:?subject])
(query-set-pattern (make-pattern [[:?subject ?p ?o]]))
(query-set-type :select))
;; As expected
(model-query-triples *m* all-subjects-query)
=> clojure.lang.LazySeq@2e1e8502
;; Does not execute query (?)
(model-query *m* all-subjects-query)
=> {:kind :select, :pattern [[:?object :?p :?o]], :vars [:?object]}
官方教程声称model-query
从查询中返回绑定列表:
({:?object "http://randomurl.com/asdf"}
{:?object "http://asdf.com/qwer"})