grafter.pipeline

Functions to declare the presence of Grafter pipeline functions to external processes and programs such as lein-grafter and Grafter server.

coerce-pipeline-arguments

multimethod

Coerce the arguments based on the pipelines stated types. Receives a fully qualified name of the pipeline (a symbol or string), or a pipeline-object and returns the arguments as coerced values, or raise an error if a coercion isn’t possible.

Uses the multi-method grafter.pipeline.types/parse-parameter to coerce values.

declare-pipeline

macro

(declare-pipeline & args)

Declare a pipeline function and expose it to other services such as the grafter leiningen plugin and grafter-server.

declare-pipeline takes a symbol identifying the function to expose, an optional human friendly title string, a type-form describing the pipelines arguments and return type, a map of metadata describing each argument and an optional sequence of key-value pairs containing additional options. The only recognised option is :supported-operations which indicates whether the pipeline output supports being append to or deleted from the pipeline destination.

(defn my-pipeline [a] [(->Quad a a a a)])

(declare-pipeline my-pipeline “My example pipeline” [URI -> Quads] {a “Argument a”} :supported-operations #{:append :delete})

Note that the type-form/signature specifies the input arguments followed by a -> and an output type.

All input argument types MUST be imported into the namespace and have a type reader declared via grafter.pipeline.types/deftype-reader.

Output types do not need be imported into the namespace, and must either be the symbols Quads or Dataset, or an alias such as “[Quad]”.

Default type-readers are defined for common grafter/clojure types.

exported-pipelines

Map of pipelines that have been declared and exported to the pipeline runners

find-pipeline

(find-pipeline name)

Find a pipeline by its fully qualified pipeline. Accepts either a string or a symbol identifying the pipeline e.g. “my.namespace/my-pipeline” or ’my.namespace/my-pipeline