Bootstrapping the Semantic Web
with Redland
Overview
- Semantic Web Development
- RDF in a Box
- Redland
- Requirements
- Features
- APIs and Querying
- Availability
What Is Redland?
Redland RDF
Application Framework
Set of Libraries
Toolkit
Whatever!
Redland is a set of mature RDF open source libraries written in C
providing a foundation layer of technology for semantic web
applications including language bindings to C#, Obj-C, Perl, PHP,
Python, Ruby and others.
RDF Technology in 2000
- Poor tool support:
- 1 unmaintained fairly complete Java system
- A few incomplete others
- RDF needed better tools
- Time to engineer something industrial strength
- New standards work was on the horizon
- Target users: web developers
RDF in a box
- Reliable, portable, flexible, ...ible
- Fast, efficient, small, ...
- Easy to use and program with
- Available in (insert your favourite language here)
- Web standards compliant
- Easy to use license
Summary: lowest possible barriers to use
Redland from Semantic Web @Bristol
The name: Redland is an area of Bristol, UK
FOAF was created here.
5 RDF W3C Recommendation editors work here.
Jena Java Semantic Web toolkit was created here at HP Labs.
(Actually Jena was created the same month as Redland, June 2000,
by Brian McBride).
RDF in a box - Two Key Requirements
- Portable to your system
- Available in your programming language
Key Requirement 1 - Portable
- Answer: C
- Riposte: You are crazy, man!
- GNU autotools and libtool
gcc -W
everything.
g++ as a stricter C compiler
- Memory checkers such as dmalloc and
valgrind(1)
- Unit tests, syntax tests, query tests
- SourceForge compile farm: ~9 unix / linux / OSX systems
Key Requirement 2 - Language Availability
(Aside: I'm suspicious of any (web) technology that doesn't have
easy to find and use software for it in a variety of languages)
Other Important Requirements
- Fast - C is close to the metal
- Small - minmality: do not create functionality in advance of needing it
- Modular - use whatever system functionality is available
- Configurable - GNU autoconf to choose modules and parts
- Minimal dependencies - just an XML parser
- Low memory use (no leaks), embeddable
- Web standards compliant
- Licence - LGPL / GPL / Apache2
API Style - Object-based C
- Object-based not Object-Orientated (OO)
- Constructors, destructors and methods reflected into C functions
librdf_foo* librdf_new_foo(void);
void librdf_free_foo(librdf_foo* foo);
int librdf_foo_set_thing(librdf_foo* foo, char *thing);
char *librdf_foo_get_thing(librdf_foo* foo);
- No garbage collecting at C level. Bindings should handle this.
- Classes and factories for multiple implemenations
librdf_storage* a=librdf_new_storage("memory", ...);
librdf_storage* b=librdf_new_storage("uri", ...);
- Gnome GLib could have been a choice here at the cost of
a non-minimal set of dependencies
Data flow and constructs
- Reader pulls data
- Lazy evaluation
- No
while
loops (except query engine)
- Iterators for serializing objects, results
- Map to Perl
@array
, Python generators, C# Iterator ...
- Parser generates triples via callbacks
Semantic Web Stack
|
Tim Berners-Lee 2002
|
#include <stdweb.h>
|
|
|
|
|
|
|
stdrdf |
|
|
stdxml |
|
|
stduri |
C Open Source Web Libraries
stdrdf |
Redland |
stdxml |
expat, libxml2 |
stduri |
libcurl, libwww, BSD libfetch, (libxml2) |
(there is a libwww from the W3C but it covers a large range
of web technologies, is rather monolithic and large and more a
reference implementation)
What you get in the Redland box
- RDF Input and Output to/from syntaxes (Raptor):
RDF/XML, N-Triples, Turtle, RSS 1.0, RSS tag soup, Atom
- RDF triple Storage (Redland):
Memory, File, URI, Sleepycat/BDB, MySQL, SQLite
- RDF API - RDF data access and manipulation (Redland):
Graph and Triple APIs
- Language bindings (Bindings)
C#,
Java,
Obj-C,
Perl,
PHP,
Python,
Ruby,
Tcl
- Query languages and query engine (Rasqal):
SPARQL and RDQL
- Command line utilities for Raptor, Rasqal and Redland
Redland Documentation
- Installation docs for each library
- News and detailed release notes for each library
- API reference (kerneldoc to DocBook) for Redland or manpages
- Manual pages for each utility and library
- Language bindings installation docs for each language
- POD for Perl. PyDoc for Python. RDoc for Ruby
- Missing: Tutorials
- Missing: Redland Book
Availability expectations
- Python - ship with the system
- Perl - be in CPAN
- PHP - if it doesn't ship with core PHP, very hard to convince
- Java - expect it to be pure Java (I lose)
- Ruby, Tcl - ?
- Linux, BSDen - packaged in RPM, deb, portage, ports, ...
- OSX - DMG packages and installers (and fink, darwinports)
- Windows - binaries with
setup.exe
Availability to scripting languages
Expect to use it with one line of code
$ python
Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
<<< import RDF
<<<
Or none:
$ perl -MRDF::Redland '...'
You can always use the command line:
$ rdfproc
Redland RDF processor utility 1.0.0
Copyright (C) 2000-2005 David Beckett, ILRT, University of Bristol
Try `rdfproc --help' for more information.
Redland RDF APIs
- Manipulating triples and graphs
- Triple storage, Parsers, Serializers
- Tracking provenance and data aggregration
- Fine grained control
- Can be too low level
Alternatively, use a query language...
RDF Query in Redland - Rasqal
- RDQL - existing deployed language
- SPARQL - undergoing standardisation at W3C with new features
- Managing aggregation
- Better semi-structured data support
- Turtle/N3 style triple syntax
RDF Query - SPARQL
- SPARQL Protocol and RDF Query Language
- A Query Language ...
Find names and websites of contributors to PlanetRDF:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?website
FROM <http://planetrdf.com/bloggers.rdf>
WHERE { ?person foaf:weblog ?website ;
foaf:name ?name .
?website a foaf:Document
}
- ... and a Protocol
http://.../qps?
query-lang=http://www.w3.org/TR/rdf-sparql-query/
&graph-id=http://planetrdf.com/bloggers.rdf
&query=PREFIX foaf: <http://xmlns.com/foaf/0.1/...
- Run this query (ex1.rq)
Redland Availability
- Source!
- RPMs and debs for libraries, Python, Perl and Ruby
- Linux: Ubuntu CD1. Raptor in SUSE and several others
- BSD ports in freshports
- Gentoo Linux emerge ports
- OSX Objective-C packages (3rd party)
- Win32 library DLLs, python, C# and ruby(soon) (3rd party)
- Used with some commercial applications
- Ruby gems (3rd party)
- Perl CPAN TODO old version
Current and Future Possible Work
- Made it to V1.0 in less than 5 years
- Finishing SPARQL (current)
- SQLite store replacing Sleepycat (current)
- Free text searching
- Bug reports
- Redland (query) server, Apache
mod_sparql
?
- ...
For anything else, I prefer patches in diff -urN
form :)