grafter.rdf.protocols

Grafter protocols and types for RDF processing

->LangString

(->LangString string lang)

Positional factory function for class grafter.rdf.protocols.LangString.

->Quad

(->Quad s p o c)

Positional factory function for class grafter.rdf.protocols.Quad.

->RDFLiteral

(->RDFLiteral raw-value datatype-uri)

Positional factory function for class grafter.rdf.protocols.RDFLiteral.

->Triple

(->Triple s p o)

Constructs a Quad with a nil graph (context).

IDatatypeURI

protocol

members

datatype-uri

(datatype-uri this)

Returns the RDF literals datatype URI as a java.net.URI.

IRawValue

protocol

members

raw-value

(raw-value this)

Returns the naked value of a literal. For native primitive values e.g. a java.lang.Integer, this will return the supplied value (like identity). However for more complex types such as LangString’s it will coerce the value into a more natural primitive type.

IRDFString

protocol

members

lang

(lang this)

Return the strings language tag (as a clojure Keyword)

ISPARQLable

protocol

NOTE this protocol is intended for low-level access. End users should use query instead.

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)))

members

query-dataset

(query-dataset this sparql-string model)

ISPARQLUpdateable

protocol

members

update!

(update! this sparql-string)

Issue a SPARQL Update statement against the repository

IStatement

protocol

An RDF triple or quad

members

context

(context statement)

object

(object statement)

predicate

(predicate statement)

subject

(subject statement)

ITransactable

protocol

Low level protocol for transactions support. Most users probably want to use grafter.rdf.sesame/with-transaction

members

begin

(begin repo)

Start a transaction

commit

(commit repo)

Commit a transaction

rollback

(rollback repo)

Rollback a transaction

ITripleDeleteable

protocol

This protocol can be implemented by anything which you can delete statements from. For example a SPARQL Update Endpoint.

members

delete

(delete this quads)(delete this graph triples)

Delete the supplied triples or quads from the destination.

delete-statement

(delete-statement this statement)(delete-statement this graph statement)

ITripleReadable

protocol

Use the higher level wrapper function statements if you just wish to read in some RDF.

This protocol exists for implementers to hook in additional sources of statements.

Takes a source of statements or triples and converts it into a seq of triples.

A hash of options is passed to each implementation, they may be ignored or handled depending on the circumstance.

members

to-statements

(to-statements this options)

ITripleWriteable

protocol

This protocol is implemented by anything which you can put statements into.

members

add

(add this quads)(add this graph triples)(add this graph format triple-stream)(add this graph base-uri format triple-stream)

Add a seq of triples or quads to a destination. Works with a sequence of IStatements an InputStream, File or Reader

add-statement

(add-statement this statement)(add-statement this graph statement)

map->LangString

(map->LangString m__8876__auto__)

Factory function for class grafter.rdf.protocols.LangString, taking a map of keywords to field values.

map->Quad

(map->Quad m__8876__auto__)

Factory function for class grafter.rdf.protocols.Quad, taking a map of keywords to field values.

map->RDFLiteral

(map->RDFLiteral m__8876__auto__)

Factory function for class grafter.rdf.protocols.RDFLiteral, taking a map of keywords to field values.

map->Triple

(map->Triple m)

Constructs a Quad from an {:s :p :o } mapwith a nil graph (context).

rdf:langString

FIXME: write docs

triple?

(triple? t)

Predicate function to test if object is a valid RDF triple.