Liking cljdoc? Tell your friends :D

grafter.rdf.repository

DEPRECATED. Use grafter.rdf4j.repository instead. This namespace contains the old sesame implementation.

Functions for constructing and working with various Sesame repositories.

DEPRECATED.  Use grafter.rdf4j.repository instead.  This namespace
contains the old sesame implementation.

Functions for constructing and working with various Sesame repositories.
raw docstring

add->repoclj

(add->repo)
(add->repo acc)
(add->repo acc v)
source

batched-queryclj

(batched-query qstr conn)
(batched-query qstr conn limit)
(batched-query qstr conn limit offset)

Like query, but queries are batched from the server by wrapping them in a SPARQL SELECT query with a limit/offset.

NOTE: Though this function returns a lazy sequence, it is intended to be used eagerly, perhaps inside something that eagerly loads the results and manages the connection resources inside a with-open.

Like query, but queries are batched from the server by wrapping
them in a SPARQL SELECT query with a limit/offset.

NOTE: Though this function returns a lazy sequence, it is intended
to be used eagerly, perhaps inside something that eagerly loads the
results and manages the connection resources inside a with-open.
sourceraw docstring

custom-query-inferencerclj

(custom-query-inferencer)
(custom-query-inferencer query-text matcher-text)
(custom-query-inferencer notifying-sail query-text matcher-text)

A forward-chaining inferencer that infers new statements using a SPARQL graph query.

A forward-chaining inferencer that infers new statements using a
SPARQL graph query.
sourceraw docstring

direct-type-inferencerclj

(direct-type-inferencer)
(direct-type-inferencer notifying-sail)

A forward-chaining inferencer that infers the direct-type hierarchy relations sesame:directSubClassOf, sesame:directSubPropertyOf and sesame:directType.

A forward-chaining inferencer that infers the direct-type hierarchy
relations sesame:directSubClassOf, sesame:directSubPropertyOf and
sesame:directType.
sourceraw docstring

fixture-repoclj

(fixture-repo)
(fixture-repo repo-or-data & data)

adds the specified data to a sparql repository. if the first argument is a repository that object is used, otherwise the first and remaining arguments are assumed to be grafter.rdf.protocols/itriplereadable and are loaded into a sesame memorystore sail-repo.

this function is most useful for loading fixture data from files e.g.

(fixture-repo "test-data.trig" "more-test-data.trig")

adds the specified data to a sparql repository.  if the first
argument is a repository that object is used, otherwise the first
and remaining arguments are assumed to be
grafter.rdf.protocols/itriplereadable and are loaded into a sesame
memorystore sail-repo.

this function is most useful for loading fixture data from files e.g.

(fixture-repo "test-data.trig" "more-test-data.trig")
sourceraw docstring

http-repoclj

(http-repo repo-url)

Given a URL as a String return a Sesame HTTPRepository for e.g. interacting with the OpenRDF Workbench.

Given a URL as a String return a Sesame HTTPRepository for e.g.
interacting with the OpenRDF Workbench.
sourceraw docstring

IQueryEvaluatorcljprotocol

evaluateclj

(evaluate this)

Low level protocol to evaluate a sesame RDF Query object, and convert the results into a grafter representation.

Low level protocol to evaluate a sesame RDF Query
object, and convert the results into a grafter representation.
source

make-restricted-datasetclj

(make-restricted-dataset & {:as options})

Build a dataset to act as a graph restriction. You can specify for both :default-graph and :named-graphs. Both of which take sequences of URI strings.

Build a dataset to act as a graph restriction.  You can specify for
both `:default-graph` and `:named-graphs`.  Both of which take sequences
of URI strings.
sourceraw docstring

memory-storeclj

(memory-store)

Instantiate a sesame RDF MemoryStore.

Instantiate a sesame RDF MemoryStore.
sourceraw docstring

native-storeclj

(native-store datadir)
(native-store datadir indexes)

Instantiate a sesame RDF NativeStore.

Instantiate a sesame RDF NativeStore.
sourceraw docstring

prepare-queryclj

(prepare-query repo sparql-string)
(prepare-query repo sparql-string restriction)

Low level function to prepare (parse, but not process) a sesame RDF query. Takes a repository a query string and an optional sesame Dataset to act as a query restriction.

Prepared queries still need to be evaluated with evaluate.

Low level function to prepare (parse, but not process) a sesame RDF
query.  Takes a repository a query string and an optional sesame
Dataset to act as a query restriction.

Prepared queries still need to be evaluated with evaluate.
sourceraw docstring

prepare-updateclj

(prepare-update repo sparql-update-str)
(prepare-update repo sparql-update-str dataset)

Prepare (parse but don't process) a SPARQL update request.

Prepared updates still need to be evaluated with evaluate.

Prepare (parse but don't process) a SPARQL update request.

Prepared updates still need to be evaluated with evaluate.
sourceraw docstring

queryclj

(query repo sparql & {:as options})

Run an arbitrary SPARQL query. Works with ASK, DESCRIBE, CONSTRUCT and SELECT queries.

You can call this on a Repository however if you do you may in some cases cause a resource leak, for example if the sequence of results isn't fully consumed.

To use this without leaking resources it is recommended that you call ->connection on your repository, inside a with-open; and then consume all your results inside of a nested doseq/dorun/etc...

e.g.

(with-open [conn (->connection repo)]
   (doseq [res (query conn "SELECT * WHERE { ?s ?p ?o .}")]
      (println res)))

Takes a repo and sparql string and an optional set of k/v argument pairs, and executes the sparql query on the repository.

Options are:

  • :default-graph a seq of URI strings representing named graphs to be set as the default union graph for the query.

  • :named-graphs a seq of URI strings representing the named graphs in to be used in the query.

If no options are passed then we use the default of no graph restrictions whilst the union graph is the union of all graphs.

Run an arbitrary SPARQL query.  Works with ASK, DESCRIBE, CONSTRUCT
and SELECT queries.

You can call this on a Repository however if you do you may in some
cases cause a resource leak, for example if the sequence of results
isn't fully consumed.

To use this without leaking resources it is recommended that you
call ->connection on your repository, inside a with-open; and then
consume all your results inside of a nested doseq/dorun/etc...

e.g.

````
(with-open [conn (->connection repo)]
   (doseq [res (query conn "SELECT * WHERE { ?s ?p ?o .}")]
      (println res)))
````

Takes a repo and sparql string and an optional set of k/v argument
pairs, and executes the sparql query on the repository.

Options are:

- `:default-graph` a seq of URI strings representing named graphs to be set
  as the default union graph for the query.

- `:named-graphs` a seq of URI strings representing the named graphs in
  to be used in the query.

If no options are passed then we use the default of no graph
restrictions whilst the union graph is the union of all graphs.
sourceraw docstring

rdfs-inferencerclj

(rdfs-inferencer)
(rdfs-inferencer notifying-sail)

Returns a Sesame ForwardChainingRDFSInferencer using the rules from the RDF Semantics Recommendation (10 February 2004).

You can instantiate a repository with a memory store or a native store or with any SAIL that returns InferencerConnections. e.g. to instantiate a repository with a memory-store:

(repo (rdfs-inferencer (memory-store)))

Returns a Sesame ForwardChainingRDFSInferencer using the rules from
the RDF Semantics Recommendation (10 February 2004).

You can instantiate a repository with a memory store or a native
store or with any SAIL that returns InferencerConnections.  e.g. to
instantiate a repository with a memory-store:

`(repo (rdfs-inferencer (memory-store)))`
sourceraw docstring

repocljdeprecated

(repo)
(repo sail-or-rdf-file)
(repo rdf-data sail)

DEPRECATED: Use sail-repo or fixture-repo instead.

Given a sesame Sail of some type, return a sesame SailRepository.

This function also supports initialising the repository with some data that can be loaded from anything grafter.rdf/statements can coerce. Additionally the data can also be a sequence of grafter.rdf.protocols/Quad's.

Finally you can also optionally supply a sesame sail to wrap the repository, which can be used to configure a sesame NativeStore.

By default this function will return a repository initialised with a Sesame MemoryStore.

DEPRECATED: Use sail-repo or fixture-repo instead.

Given a sesame Sail of some type, return a sesame SailRepository.

This function also supports initialising the repository with some
data that can be loaded from anything grafter.rdf/statements can
coerce.  Additionally the data can also be a sequence of
grafter.rdf.protocols/Quad's.

Finally you can also optionally supply a sesame sail to wrap the
repository, which can be used to configure a sesame NativeStore.

By default this function will return a repository initialised with a
Sesame MemoryStore.
sourceraw docstring

resource-repoclj

(resource-repo)
(resource-repo repo-or-data & data)

Like fixture repo but assumes all supplied data is on the java resource path. For example:

(repo/resource-repo "grafter/rdf/sparql/sparql-data.trig" "grafter/rdf/rdf-types.trig")

Will load the supplied RDF files from the resource path into a single memory repository for testing.

If you want to use a custom repository the first argument can be a repository.

Like fixture repo but assumes all supplied data is on the java
resource path.  For example:

(repo/resource-repo "grafter/rdf/sparql/sparql-data.trig"
                    "grafter/rdf/rdf-types.trig")

Will load the supplied RDF files from the resource path into a
single memory repository for testing.

If you want to use a custom repository the first argument can be a
repository.
sourceraw docstring

sail-repoclj

(sail-repo)
(sail-repo sail)

Given a sesame Sail of some type, return a sesame SailRepository.

Finally you can also optionally supply a sesame sail to wrap the repository, which can be used to configure a sesame NativeStore.

By default this function will return a repository initialised with a Sesame MemoryStore.

Given a sesame Sail of some type, return a sesame SailRepository.

Finally you can also optionally supply a sesame sail to wrap the
repository, which can be used to configure a sesame NativeStore.

By default this function will return a repository initialised with a
Sesame MemoryStore.
sourceraw docstring

shutdownclj

(shutdown repo)

Cleanly shutsdown the repository.

Cleanly shutsdown the repository.
sourceraw docstring

sparql-repoclj

(sparql-repo query-url)
(sparql-repo query-url update-url)

Given a query-url (String or IURI) and an optional update-url String or IURI, return a Sesame SPARQLRepository for communicating with remote repositories.

Given a query-url (String or IURI) and an optional update-url String
or IURI, return a Sesame SPARQLRepository for communicating with
remote repositories.
sourceraw docstring

ToConnectioncljprotocol

->connectionclj

(->connection repo)

Given a sesame repository return a connection to it. ->connection is designed to be used with the macro with-open

Given a sesame repository return a connection to it.
->connection is designed to be used with the macro with-open
source

with-transactioncljmacro

(with-transaction repo & forms)

Wraps the given forms in a transaction on the supplied repository. Exceptions are rolled back on failure.

Wraps the given forms in a transaction on the supplied repository.
Exceptions are rolled back on failure.
sourceraw docstring

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

× close