Skip to content

Convert resource objects to quads #144

@RickMoynihan

Description

@RickMoynihan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions