#!/usr/bin/env ruby # A basic annotation server # $Id: annotea_server,v 1.2 2002-08-05 06:10:53 danbri Exp $ # # author: dan brickley # # This implements the basic lookup functionality of an Annotea server. # It does note provide annotation-posting facilities. Instead, the # working assumption is that an aggregate of annotations data has been # harvested from online sources. This greatly simplifies the cost of # implementing an Annotea server. # # see also: # http://www.w3.org/2001/Annotea/ # http://annozilla.mozdev.org/ # # Status / todo: # - basics have been tested in Annozilla, and seem to work. # - haven't tested multiple annotations for a single document # - caching would be very useful # - should test with non-HTML bodies # # Dependencies: # - RubyRDF libraries # - webrick # License: we need Webrick. Webrick is GPL. # ...so this should presumably be GPL. # ...and packaged separately from rubyrdf? # ...so I'm chucking it into Scutter filetree for now. # ...will look into constraints re making it w3c software. require 'squish' require 'basicrdf' require 'scutter' require 'webrick' include WEBrick # A basic Annotea Annotation # class SimpleAnnotation attr_accessor :target, :context, :creator_name, :created, :date, :body_uri, :annotype, :body def toRDF xml=< #{@creator_name} #{@created} #{@date} XML return xml end def SimpleAnnotation.list_annotations(target) puts "[annoruby] Looking up annotations on #{target}\n" raise("List annotation needs URI") if !target q = < 2000, :Logger => WEBrick::Log::new('logfile', WEBrick::Log::DEBUG) ) s.mount '/anno', AnnoteaServlet trap("INT"){ s.shutdown } s.start