Samizdat: Co-op Engine

Home | About | Documentation | Developers | Download

Graffiti 2.1 (2011-12-25)

Graffiti RDF store now uses Sequel instead of DBI for relational database access. Sequel understands named parameters, so there's no more need for the awkward passing of re-ordered params list in SquishSelect#to_sql and Store#select, both methods now return just the translated SQL query. The query itself will have the column names aliased to blank node names from the Squish query where applicable.



  require 'sequel'
  require 'yaml'
  require 'graffiti'

  db = Sequel.connect(:adapter => 'pg', :database => dbname)
  config ='rdf.yaml') {|f| YAML.load( }
  store =, config)

  data = store.fetch(%{
    SELECT ?date, ?title
    WHERE (dc::date ?r ?date FILTER ?date >= :start)
          (dc::title ?r ?title)
    ORDER BY ?date DESC}, 10, 0, :start => - 24*3600)

  puts data.first[:title]