Liking cljdoc? Tell your friends :D

grafter.matcha.alpha


-make-select-solutionclj

(-make-select-solution reqs opts required-indices optional-indices)

Creates a solution vector according where values in reqs and opts are in the right position (as specified in select's 'projected values').

  • reqs - vector of required values
  • opts - vector of optional values
  • required-indices - vector of ints
  • optional-indices - vector of ints
Creates a solution vector according where values in reqs and opts are
in the right position (as specified in select's 'projected values').

- reqs - vector of required values
- opts - vector of optional values
- required-indices - vector of ints
- optional-indices - vector of ints
sourceraw docstring

askcljmacro

(ask bgps)
(ask bgps db)

Predicate: are there results in a db-or-idx matching bgps patterns?

If called with 1 argument, returns a function of 1 argument: the db-or-idx.

If called with 2 arguments, queries the db-or-idx directly.

Predicate: are there results in a `db-or-idx` matching `bgps` patterns?

If called with 1 argument, returns a function of 1 argument: the `db-or-idx`.

If called with 2 arguments, queries the `db-or-idx` directly.
sourceraw docstring

buildcljmacro

(build subject construct-pattern bgps)
(build subject construct-pattern bgps db-or-idx)

Query a db-or-idx with bgps patterns, and return data grouped by subject and predicates into resource object maps.

subject can be a concrete value, a value bound in lexical scope, a ?query-var symbol used in the bgps or a 2-tuple key value pair of [:keyword ?query-var] or [:keyword :concrete-value]. If the vector form is used case :keyword will be the key used to identify the subject of the maps in the response. If only ?query-var or a concrete value and no :keyword is specified then the default keyword of :grafter.rdf/uri is used.

NOTE: unlike construct, build will eliminate any unbound variables from the response maps that may arrise from using an optional.

If called with 3 arguments, returns a function of 1 argument: the db-or-idx, which returns a sequence of results in the form of the construct-pattern.

If called with 4 arguments, queries the db-or-idx directly, returning a sequence of results in the form of the construct-pattern.

Query a `db-or-idx` with `bgps` patterns, and return data grouped by
subject and predicates into resource object maps.

`subject` can be a concrete value, a value bound in lexical scope, a
`?query-var` symbol used in the `bgps` or a 2-tuple key value pair
of `[:keyword ?query-var]` or [:keyword :concrete-value]. If the
vector form is used case `:keyword` will be the key used to identify
the subject of the maps in the response. If only `?query-var` or a
concrete value and no `:keyword` is specified then the default
keyword of `:grafter.rdf/uri` is used.

NOTE: unlike `construct`, `build` will eliminate any unbound
variables from the response maps that may arrise from using an
optional.

If called with 3 arguments, returns a function of 1 argument: the `db-or-idx`,
which returns a sequence of results in the form of the `construct-pattern`.

If called with 4 arguments, queries the `db-or-idx` directly, returning a
sequence of results in the form of the `construct-pattern`.
sourceraw docstring

build-1cljmacro

(build-1 subject-kv construct-pattern bgps)
(build-1 subject construct-pattern bgps db-or-idx)

Like build but returns only the first resource object.

NOTE: it is not lazy, so to make this efficient you should be selective in your bgps.

Like `build` but returns only the first resource object.

NOTE: it is not lazy, so to make this efficient you should be
selective in your `bgps`.
sourceraw docstring

clausecljmacro

(clause name & argspec)
source

collection?clj

(collection? x)
source

constructcljmacro

(construct construct-pattern bgps)
(construct construct-pattern bgps db-or-idx)

NOTE: If you want to construct maps, you will likely be better using build instead.

Query a db-or-idx with bgps patterns, and return data in the form of the construct-pattern.

If called with 2 arguments, returns a function of 1 argument: the db-or-idx, which returns a sequence of results in the form of the construct-pattern.

If called with 3 arguments, queries the db-or-idx directly, returning a sequence of results in the form of the construct-pattern.

NOTE: If you want to construct maps, you will likely be better
using `build` instead.

Query a `db-or-idx` with `bgps` patterns, and return data in the
form of the `construct-pattern`.

If called with 2 arguments, returns a function of 1 argument: the `db-or-idx`,
which returns a sequence of results in the form of the `construct-pattern`.

If called with 3 arguments, queries the `db-or-idx` directly, returning a
sequence of results in the form of the `construct-pattern`.
sourceraw docstring

construct-1cljmacro

(construct-1 construct-pattern bgps)
(construct-1 construct-pattern bgps db)

Query a db-or-idx with bgps patterns, and return data in the form of the construct-pattern.

If called with 2 arguments, returns a function of 1 argument: the db-or-idx, which returns the first result in the form of the construct-pattern.

If called with 3 arguments, queries the db-or-idx directly, returning the first result in the form of the construct-pattern.

Query a `db-or-idx` with `bgps` patterns, and return data in the form of the
`construct-pattern`.

If called with 2 arguments, returns a function of 1 argument: the `db-or-idx`,
which returns the first result in the form of the `construct-pattern`.

If called with 3 arguments, queries the `db-or-idx` directly, returning the
first result in the form of the `construct-pattern`.
sourceraw docstring

extract-validationclj

(extract-validation bound-vars conformed-bgps)
source

find-vars-in-treeclj

(find-vars-in-tree tree)
source

group-subjects-for-buildclj

(group-subjects-for-build subject-k solutions)
  • solutions - a seq of maps
- `solutions` - a seq of maps
sourceraw docstring

group-subjects-for-constructclj

(group-subjects-for-construct construct-pattern solutions)
source

handle-optionalsclj

(handle-optionals construct-pattern optionals solutions)

Takes a seq of maps (solutions) and removes top level keys mapped to an unbound value from each map.

Takes a seq of maps (solutions) and removes top level keys
mapped to an unbound value from each map.
sourceraw docstring

index-triplesclj

(index-triples db)

Return an indexed database of triples. Indexing a database will result in better performance if you want to run multiple queries over the same database.

All query functions should accept either a sequence of triples or an indexed database.

Return an indexed database of triples. Indexing a database will
result in better performance if you want to run multiple queries
over the same database.

All query functions should accept either a sequence of triples or an
indexed database.
sourceraw docstring

merge-dbsclj

(merge-dbs & dbs)

Merges all supplied Matcha databases together into one. Any individual database form can either be indexed already with index-triples, or a sequence of triples, in which case the triples will be indexed before being combined with any other databases.

Merges all supplied Matcha databases together into one.  Any
individual database form can either be indexed already with
index-triples, or a sequence of triples, in which case the triples
will be indexed before being combined with any other databases.
sourceraw docstring

optionalcljmacro

(optional _bgps)

Makes a graph pattern optional. I.E., the pattern inside (optional [...]) is optional, patterns outside are required. Can be arbitrarily nested. MUST be used inside a (select|construct|ask|etc) query.

SYNTAX: (optional bgps) bgps: ::bgps

E.G., (select [?o ?eman] [[?person foaf:knows somebody] (optional [[?o rdfs:label ?name] (optional [[?name :name/backwards ?eman] (values ?name names)])])] optional-friends)

Makes a graph pattern optional. I.E., the pattern inside (optional [...]) is
optional, patterns outside are required. Can be arbitrarily nested. MUST be
used inside a (select|construct|ask|etc) query.

SYNTAX: (optional bgps)
        bgps: ::bgps

E.G.,
(select [?o ?eman]
  [[?person foaf:knows somebody]
   (optional [[?o rdfs:label ?name]
              (optional [[?name :name/backwards ?eman]
                         (values ?name names)])])]
  optional-friends)
sourceraw docstring

query-var?clj

(query-var? sym)

Test whether supplied sym is a query variable. Query variables are symbols who's name begin with a ?.

Test whether supplied sym is a query variable.  Query variables are
symbols who's name begin with a ?.
sourceraw docstring

replace-vars-with-valsclj

(replace-vars-with-vals construct-pattern binding-maps)
source

require-grafter-protocolsclj

(require-grafter-protocols require-form)
source

resolve-symclj

(resolve-sym x)
source

selectcljmacro

(select bgps)
(select project-vars bgps)
(select project-vars bgps db-or-idx)

Query a db-or-idx with bgps patterns.

If called with 1 argument, select finds all ?vars in the bgps patterns and returns a function of 1 argument: the db-or-idx, which returns a sequence of results.

If called with 2 arguments, returns a function of 1 argument: the db-or-idx, which returns a sequence of results with the ?vars in project-vars projected.

If called with 3 arguments, queries the db-or-idx directly, returning a sequence of results with the ?vars in project-vars projected.

Query a `db-or-idx` with `bgps` patterns.

If called with 1 argument, `select` finds all `?vars` in the `bgps` patterns
and returns a function of 1 argument: the `db-or-idx`, which returns a
sequence of results.

If called with 2 arguments, returns a function of 1 argument: the `db-or-idx`,
which returns a sequence of results with the `?vars` in `project-vars`
projected.

If called with 3 arguments, queries the `db-or-idx` directly, returning a
sequence of results with the `?vars` in `project-vars` projected.
sourceraw docstring

select-1cljmacro

(select-1 bgps)
(select-1 project-vars bgps)
(select-1 project-vars bgps db)

Query a db-or-idx with bgps patterns.

If called with 1 argument, select finds all ?vars in the bgps patterns and returns a function of 1 argument: the db-or-idx, which returns the first result.

If called with 2 arguments, returns a function of 1 argument: the db-or-idx, which returns the first result with ?vars in project-varsprojected.

If called with 3 arguments, queries the db-or-idx directly, returning the first result with ?vars in project-vars projected.

Query a `db-or-idx` with `bgps` patterns.

If called with 1 argument, `select` finds all `?vars` in the `bgps` patterns
and returns a function of 1 argument: the `db-or-idx`, which returns the first
result.

If called with 2 arguments, returns a function of 1 argument: the `db-or-idx`,
which returns the first result with `?vars` in `project-vars`projected.

If called with 3 arguments, queries the `db-or-idx` directly, returning the
first result with `?vars` in `project-vars` projected.
sourceraw docstring

split-optionalsclj

(split-optionals bgps)

Returns a map of {:bgps ... :optionals [...]}

Where :bgps value is the input form with (optional ...) forms removed, and :optionals is s vector of optional forms.

Returns a map of {:bgps ... :optionals [...]}

Where :bgps value is the input form with `(optional ...)` forms
removed, and :optionals is s vector of optional forms.
sourceraw docstring

tripleclj

source

triple-vector->idx-tripleclj

(triple-vector->idx-triple [s p o])

Assume triples are either 3/tuple vectors or can be destructured as such. Grafter Quad objects can be destructured in this manner.

Assume triples are either 3/tuple vectors or can be destructured as
such.  Grafter Quad objects can be destructured in this manner.
sourceraw docstring

unify-solutionsclj

(unify-solutions projected-vars solutions)

Returns a seq of maps.

Returns a seq of maps.
sourceraw docstring

valid-bgps?clj

(valid-bgps? bgps-syms)
source

valid-values?clj

(valid-values? values-syms)
source

valuescljmacro

(values _binding _bound-value)

Binds a ?qvar binding to elements of a set inside the query. MUST be used inside a (select|construct|ask|etc) query.

SYNTAX: (values binding bound-value) binding: ?qvar bound-value: any?

E.G., (let [subjects #{:a :b :c}] (select [?s ?p ?o] [[?s ?p ?o] (values ?s subjects)]))

Binds a ?qvar binding to elements of a set inside the query. MUST be used
inside a (select|construct|ask|etc) query.

SYNTAX: (values binding bound-value)
        binding: ?qvar
        bound-value: any?

E.G.,
(let [subjects #{:a :b :c}]
  (select [?s ?p ?o]
    [[?s ?p ?o]
     (values ?s subjects)]))
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close