#!/usr/bin/perl # sparql.pl - a brain-dead, half-baked SPARQL endpoint # Eric Lease Morgan # December 15, 2013 - first investigations # require use CGI; use CGI::Carp qw( fatalsToBrowser ); use RDF::Redland; use strict; # initialize my $cgi = CGI->new; my $query = $cgi->param( 'query' ); if ( ! $query ) { print $cgi->header; print &home; } else { # open the store for business my $store = RDF::Redland::Storage->new( 'hashes', 'store', "new='no', hash-type='bdb', dir='/var/www/html/main/sandbox/liam/etc'" ); my $model = RDF::Redland::Model->new( $store, '' ); # search my $results = $model->query_execute( RDF::Redland::Query->new( $query, undef, undef, 'sparql' ) ); # return the results print $cgi->header( -type => 'application/xml' ); print $results->to_string; } # done exit; sub home { # return a home page return < LiAM SPARQL Endpoint

LiAM SPARQL Endpoint

This is a brain-dead and half-baked SPARQL endpoint to a subset of LiAM linked data. Enter a query, but there is the disclaimer. Errors will probably happen because of SPARQL syntax errors. Remember, the interface is brain-dead. Your milage will vary.


Sample queries:

For more information about SPARQL, see:

  1. SPARQL Query Language for RDF from the W3C
  2. SPARQL from Wikipedia

Source code -- sparql.pl -- is available online.


Eric Lease Morgan <eric_morgan\@infomotions.com>
March 5, 2014

EOF }