SPARQL query builder for Common Lisp.
(sparql (:select * :where (?x ?y ?z)))
(sparql
(:select *
:where (?x ?y ?z)
:limit 20
:offset 10))
(sparql
(:select *
:where (?x ?y ?z)
(:select *
:where (?x ?y ?z)
:limit 20
:offset 10)
:limit 20
:offset 10))
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.
(sparql
(:select ?x ?v ?z
:where (?x #u<rdf:type> #u<owl:Ontology>)
(?y ?v ?w)
(:optional (?x ?y ?z))
:limit 20))
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.
MIT