Skip to content
vityok edited this page Jan 4, 2013 · 9 revisions

Welcome to the de.setf.wilbur wiki!

Installation

Installing Wilbur is easy: it is present in the Quicklisp projects registry. Install Wilbur by running:

(ql:quickload "wilbur")

Documentation

Original Wilbur API documentation is available at the SourceForge project site.

Sample usage

Lets grab some data from DBPedia:

wget http://dbpedia.org/data/Semantic_Web.rdf

Wilbur parses RDF/XML graphs from a stream with parse-db-from-stream function and expects that a graph database is stored in a variable wilbur:*db*

(with-open-file (stream #P"Semantic_Web.rdf" :direction :input)
  (setf wilbur:*db*
	(wilbur:parse-db-from-stream stream
				     "http://dbpedia.org/page/Semantic_Web")))

Now we can run queries like:

(wilbur:query nil !rdfs:label nil)
(#<TRIPLE !"http://dbpedia.org/resource/Semantic_Web" !rdfs:label #"Semantisches Web"@de #x18EEC1E6>
 #<TRIPLE !"http://dbpedia.org/resource/Semantic_Web" !rdfs:label #"시맨틱 웹"@ko #x18EEC2AE>
 #<TRIPLE !"http://dbpedia.org/resource/Semantic_Web" !rdfs:label #"Sémantický web"@cs #x18EEC366>
...)

The output is not very neat, let's add some prefixes to the dictionary:

(wilbur:add-namespace "resource" "http://dbpedia.org/resource/")

Now the query output will be:

(#<TRIPLE !resource:Semantic_Web !rdfs:label #"Semantisches Web"@de #x1867D45E>
 #<TRIPLE !resource:Semantic_Web !rdfs:label #"시맨틱 웹"@ko #x1867D526>
 #<TRIPLE !resource:Semantic_Web !rdfs:label #"Sémantický web"@cs #x1867D5DE>
 #<TRIPLE !resource:Semantic_Web !rdfs:label #"语义网"@zh #x1867D6A6>
....)

See also

Clone this wiki locally