The cl-sparql Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-sparql Reference Manual

This is the cl-sparql Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 04:03:27 2022 GMT+0.

Table of Contents


1 Introduction

CL-SPARQL

SPARQL query builder for Common Lisp.

Syntax

(sparql (:select * :where (?x ?y ?z)))
 (sparql 
    (:select *
        :where (?x ?y ?z)
        :limit 20
        :offset 10))

Subqueries

(sparql 
    (:select *
        :where (?x ?y ?z)
            (:select *
                :where (?x ?y ?z)
                :limit 20
                :offset 10)
        :limit 20
        :offset 10))

URI syntax

Enable special URI syntax with (sparql:enable-uri-syntax).

After that, you can write uris like:

#u<rdf:type>

and you get the expanded uri:

#<PURI:URI http://www.w3.org/1999/02/22-rdf-syntax-ns#type>.

Use define-uri-prefix to define new uri prefixes expansions, like:

(define-uri-prefix rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
(define-uri-prefix xsd "http://www.w3.org/2001/XMLSchema#")
(define-uri-prefix ex "http://www.franz.com/things#")  
(define-uri-prefix rdfs "http://www.w3.org/2000/01/rdf-schema#")  
(define-uri-prefix fn "http://www.w3.org/2005/xpath-functions#") 
(define-uri-prefix err "http://www.w3.org/2005/xqt-errors#")  
(define-uri-prefix owl "http://www.w3.org/2002/07/owl#")  
(define-uri-prefix xs "http://www.w3.org/2001/XMLSchema#")

Those are already defined.

URI syntax in queries

(sparql
    (:select ?x ?v ?z
        :where (?x #u<rdf:type> #u<owl:Ontology>)
               (?y ?v ?w)
               (:optional (?x ?y ?z))
        :limit 20))

Implementation technique

I think the embedded domain specific language technique used is interesting. parser-combinators library is used, but, instead of using for parsing strings, it is used for parsing already read Lisp lists.

License

MIT


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-sparql

SPARQL query builder for Common Lisp

Author

Mariano Montone <marianomontone@gmail.com>

License

MIT

Version

0.0.1

Dependencies
  • puri (system).
  • parser-combinators (system).
  • cl-ppcre (system).
  • split-sequence (system).
Source

cl-sparql.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 cl-sparql/cl-sparql.asd

Source

cl-sparql.asd.

Parent Component

cl-sparql (system).

ASDF Systems

cl-sparql.


3.1.2 cl-sparql/package.lisp

Source

cl-sparql.asd.

Parent Component

cl-sparql (system).

Packages

sparql.


3.1.3 cl-sparql/sparql.lisp

Dependency

package.lisp (file).

Source

cl-sparql.asd.

Parent Component

cl-sparql (system).

Public Interface
Internals

Previous: , Up: Lisp   [Contents][Index]

3.1.4 cl-sparql/uri.lisp

Dependency

sparql.lisp (file).

Source

cl-sparql.asd.

Parent Component

cl-sparql (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 sparql

Source

package.lisp.

Use List
  • common-lisp.
  • parser-combinators.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Macros

Macro: define-uri-prefix (uri-prefix value &optional documentation)
Package

sparql.

Source

uri.lisp.

Macro: sparql (sparql)
Package

sparql.

Source

sparql.lisp.


5.1.2 Ordinary functions

Function: enable-uri-syntax ()
Package

sparql.

Source

uri.lisp.

Function: get-uri-prefix (uri-prefix)
Package

sparql.

Source

uri.lisp.

Function: make-uri (prefix uri &rest args)
Package

sparql.

Source

uri.lisp.

Function: parse-literal (literal)
Package

sparql.

Source

uri.lisp.

Function: sparql-compile (sparql)
Package

sparql.

Source

sparql.lisp.

Function: sparql-eval (sparql)
Package

sparql.

Source

sparql.lisp.


5.1.3 Generic functions

Generic Function: render-literal (value)
Package

sparql.

Methods
Method: render-literal ((x symbol))
Source

uri.lisp.

Method: render-literal ((x (eql nil)))
Source

uri.lisp.

Method: render-literal ((x (eql t)))
Source

uri.lisp.

Method: render-literal ((uri uri))
Source

uri.lisp.

Method: render-literal ((value string))
Source

uri.lisp.

Method: render-literal ((value integer))
Source

uri.lisp.

Method: render-literal (value)
Source

uri.lisp.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *eval*
Package

sparql.

Source

sparql.lisp.

Special Variable: *uri-prefixes*
Package

sparql.

Source

uri.lisp.

Special Variable: *variable-name-reader*
Package

sparql.

Source

sparql.lisp.


5.2.2 Ordinary functions

Function: clean-literal (literal)
Package

sparql.

Source

uri.lisp.

Function: display-uri-prefixes ()
Package

sparql.

Source

uri.lisp.

Function: expand (term)
Package

sparql.

Source

sparql.lisp.

Function: in-list (parser)
Package

sparql.

Source

sparql.lisp.

Function: parse-boolean-literal (literal)
Package

sparql.

Source

uri.lisp.

Function: parse-typed-literal (literal)
Package

sparql.

Source

uri.lisp.

Function: parse-uri (uri)
Package

sparql.

Source

uri.lisp.

Function: reduce-strings (list)

Join adjacent strings in a list, leave other values intact.

Package

sparql.

Source

sparql.lisp.

Function: render-sparql (sparql)
Package

sparql.

Source

sparql.lisp.

Function: sparql-delete-data ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-filter-exists ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-filter-not-exists ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-insert-data ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-limit ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-minus ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-offset ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-optional ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-order-arg ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-order-by ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-order-term ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-parser ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-select ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-subselect ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-triple ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-union ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-var ()

Parser: parse a SPARQL variable.

Package

sparql.

Source

sparql.lisp.

Function: sparql-where ()
Package

sparql.

Source

sparql.lisp.

Function: sparql-where-graph ()
Package

sparql.

Source

sparql.lisp.

Function: strcat (args)

Concatenate a list of strings into a single one.

Package

sparql.

Source

sparql.lisp.

Function: transform (transform)

Parser: transform and return the result, when the transformation applies (not null)

Package

sparql.

Source

sparql.lisp.

Function: triple-object ()
Package

sparql.

Source

sparql.lisp.

Function: triple-predicate ()
Package

sparql.

Source

sparql.lisp.

Function: triple-subject ()
Package

sparql.

Source

sparql.lisp.

Function: triples-block ()
Package

sparql.

Source

sparql.lisp.

Function: uri-reader (stream sub-char numarg)
Package

sparql.

Source

uri.lisp.

Function: where-body ()
Package

sparql.

Source

sparql.lisp.

Function: where-triple ()
Package

sparql.

Source

sparql.lisp.


5.2.3 Generic functions

Generic Function: expand-term (type term)
Package

sparql.

Methods
Method: expand-term ((type (eql :offset)) offset)
Source

sparql.lisp.

Method: expand-term ((type (eql :limit)) limit)
Source

sparql.lisp.

Method: expand-term ((type (eql :desc)) asc)
Source

sparql.lisp.

Method: expand-term ((type (eql :asc)) asc)
Source

sparql.lisp.

Method: expand-term ((type (eql :order-by)) order-by)
Source

sparql.lisp.

Method: expand-term ((type (eql :options)) options)
Source

sparql.lisp.

Method: expand-term ((type (eql :minus)) minus)
Source

sparql.lisp.

Method: expand-term ((type (eql :filter-not-exists)) filter-not-exists)
Source

sparql.lisp.

Method: expand-term ((type (eql :filter-exists)) filter-exists)
Source

sparql.lisp.

Method: expand-term ((type (eql :optional)) optional)
Source

sparql.lisp.

Method: expand-term ((type (eql :union)) union)
Source

sparql.lisp.

Method: expand-term ((type (eql :triple)) triple)
Source

sparql.lisp.

Method: expand-term ((type (eql :graph)) graph)
Source

sparql.lisp.

Method: expand-term ((type (eql :where)) where)
Source

sparql.lisp.

Method: expand-term ((type (eql :eval)) form)
Source

sparql.lisp.

Method: expand-term ((type (eql :var)) var)
Source

sparql.lisp.

Method: expand-term ((type (eql :vars)) vars)
Source

sparql.lisp.

Method: expand-term ((type (eql :subselect)) term)
Source

sparql.lisp.

Method: expand-term ((type (eql :delete-data)) term)
Source

sparql.lisp.

Method: expand-term ((type (eql :insert-data)) term)
Source

sparql.lisp.

Method: expand-term ((type (eql :select)) term)
Source

sparql.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   D   E   F   G   I   M   P   R   S   T   U   W  
Index Entry  Section

C
clean-literal: Private ordinary functions

D
define-uri-prefix: Public macros
display-uri-prefixes: Private ordinary functions

E
enable-uri-syntax: Public ordinary functions
expand: Private ordinary functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions
expand-term: Private generic functions

F
Function, clean-literal: Private ordinary functions
Function, display-uri-prefixes: Private ordinary functions
Function, enable-uri-syntax: Public ordinary functions
Function, expand: Private ordinary functions
Function, get-uri-prefix: Public ordinary functions
Function, in-list: Private ordinary functions
Function, make-uri: Public ordinary functions
Function, parse-boolean-literal: Private ordinary functions
Function, parse-literal: Public ordinary functions
Function, parse-typed-literal: Private ordinary functions
Function, parse-uri: Private ordinary functions
Function, reduce-strings: Private ordinary functions
Function, render-sparql: Private ordinary functions
Function, sparql-compile: Public ordinary functions
Function, sparql-delete-data: Private ordinary functions
Function, sparql-eval: Public ordinary functions
Function, sparql-filter-exists: Private ordinary functions
Function, sparql-filter-not-exists: Private ordinary functions
Function, sparql-insert-data: Private ordinary functions
Function, sparql-limit: Private ordinary functions
Function, sparql-minus: Private ordinary functions
Function, sparql-offset: Private ordinary functions
Function, sparql-optional: Private ordinary functions
Function, sparql-order-arg: Private ordinary functions
Function, sparql-order-by: Private ordinary functions
Function, sparql-order-term: Private ordinary functions
Function, sparql-parser: Private ordinary functions
Function, sparql-select: Private ordinary functions
Function, sparql-subselect: Private ordinary functions
Function, sparql-triple: Private ordinary functions
Function, sparql-union: Private ordinary functions
Function, sparql-var: Private ordinary functions
Function, sparql-where: Private ordinary functions
Function, sparql-where-graph: Private ordinary functions
Function, strcat: Private ordinary functions
Function, transform: Private ordinary functions
Function, triple-object: Private ordinary functions
Function, triple-predicate: Private ordinary functions
Function, triple-subject: Private ordinary functions
Function, triples-block: Private ordinary functions
Function, uri-reader: Private ordinary functions
Function, where-body: Private ordinary functions
Function, where-triple: Private ordinary functions

G
Generic Function, expand-term: Private generic functions
Generic Function, render-literal: Public generic functions
get-uri-prefix: Public ordinary functions

I
in-list: Private ordinary functions

M
Macro, define-uri-prefix: Public macros
Macro, sparql: Public macros
make-uri: Public ordinary functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, expand-term: Private generic functions
Method, render-literal: Public generic functions
Method, render-literal: Public generic functions
Method, render-literal: Public generic functions
Method, render-literal: Public generic functions
Method, render-literal: Public generic functions
Method, render-literal: Public generic functions
Method, render-literal: Public generic functions

P
parse-boolean-literal: Private ordinary functions
parse-literal: Public ordinary functions
parse-typed-literal: Private ordinary functions
parse-uri: Private ordinary functions

R
reduce-strings: Private ordinary functions
render-literal: Public generic functions
render-literal: Public generic functions
render-literal: Public generic functions
render-literal: Public generic functions
render-literal: Public generic functions
render-literal: Public generic functions
render-literal: Public generic functions
render-literal: Public generic functions
render-sparql: Private ordinary functions

S
sparql: Public macros
sparql-compile: Public ordinary functions
sparql-delete-data: Private ordinary functions
sparql-eval: Public ordinary functions
sparql-filter-exists: Private ordinary functions
sparql-filter-not-exists: Private ordinary functions
sparql-insert-data: Private ordinary functions
sparql-limit: Private ordinary functions
sparql-minus: Private ordinary functions
sparql-offset: Private ordinary functions
sparql-optional: Private ordinary functions
sparql-order-arg: Private ordinary functions
sparql-order-by: Private ordinary functions
sparql-order-term: Private ordinary functions
sparql-parser: Private ordinary functions
sparql-select: Private ordinary functions
sparql-subselect: Private ordinary functions
sparql-triple: Private ordinary functions
sparql-union: Private ordinary functions
sparql-var: Private ordinary functions
sparql-where: Private ordinary functions
sparql-where-graph: Private ordinary functions
strcat: Private ordinary functions

T
transform: Private ordinary functions
triple-object: Private ordinary functions
triple-predicate: Private ordinary functions
triple-subject: Private ordinary functions
triples-block: Private ordinary functions

U
uri-reader: Private ordinary functions

W
where-body: Private ordinary functions
where-triple: Private ordinary functions

Jump to:   C   D   E   F   G   I   M   P   R   S   T   U   W