   (sesame-rdf-type->type [this]
     this))
 
+(defn IStatement->sesame-statement
+  "Convert a grafter IStatement into a Sesame statement."
+  [^IStatement is]
+  (try
+    (if (pr/context is)
+      (ContextStatementImpl. (->sesame-rdf-type (pr/subject is))
+                             (->sesame-rdf-type (pr/predicate is))
+                             (->sesame-rdf-type (pr/object is))
+                             (->sesame-rdf-type (pr/context is)))
+      (StatementImpl. (->sesame-rdf-type (pr/subject is))
+                      (->sesame-rdf-type (pr/predicate is))
+                      (->sesame-rdf-type (pr/object is))))
+    (catch Exception ex
+      (throw (ex-info "Error outputing Quad" {:error :statement-conversion-error
+                                              :quad-meta (meta is)} ex)))))
+
 (extend-protocol ISesameRDFConverter
 
   java.lang.Boolean


  Triple
  (->sesame-rdf-type [this]
    (StatementImpl. (->sesame-rdf-type (pr/subject this))
                    (->sesame-rdf-type (pr/predicate this))
                    (->sesame-rdf-type (pr/object this))))

  Quad
  (->sesame-rdf-type [this]
    (ContextStatementImpl. (->sesame-rdf-type (pr/subject this))
                           (->sesame-rdf-type (pr/predicate this))
                           (->sesame-rdf-type (pr/object this))
                           (when-let [context (pr/context this)]
                             (->sesame-rdf-type context))))

  Value
  (->sesame-rdf-type [this]

  clojure.lang.Keyword
  (->sesame-rdf-type [this]
    (BNodeImpl. (name this))))

(defn sesame-statement->IStatement
  "Convert a sesame Statement into a grafter Quad."
