Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert resource objects to quads #144

Open
RickMoynihan opened this issue Apr 24, 2019 · 0 comments
Open

Convert resource objects to quads #144

RickMoynihan opened this issue Apr 24, 2019 · 0 comments

Comments

@RickMoynihan
Copy link
Member

RickMoynihan commented Apr 24, 2019

Something like this would be useful:

(defn resource-obj->statements
  [{:keys [grafter.rdf/uri] :as res-obj}]
  (let [po-pairs (dissoc res-obj :grafter.rdf/uri)]
    (mapcat (fn [[p os]]
              (if (or (set? os) (seq? os))
                (map (fn [o]
                       (pr/->Triple uri p o)) os)
                [(pr/->Triple uri p os)])) po-pairs)))

Ideally we should extend to-statements to do this, via clojure 1.10.0's metadata protocols....

Actually thinking about this, we should put this in matcha not here. It will depend on #145.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant