Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit

  • Loading branch information...
commit f51d14129428c2ca5336e878c09ef3b0b5a055df 0 parents
@bhuga authored
Showing with 100 additions and 0 deletions.
  1. +41 −0 README.md
  2. +36 −0 lib/rdf/myrepository.rb
  3. +23 −0 spec/my_repository.spec
41 README.md
@@ -0,0 +1,41 @@
+# RDF.rb storage adapter skeleton
+
+This is a skeleton repository to create your own RDF.rb storage adapter. It's
+designed to get you up and running with a new backend as quickly as possible,
+so that you can have working tests right away, allowing you to develop
+iteratively.
+
+# Getting started:
+
+ 1. Ensure you have the requirements below.
+ 1. Run the tests. You'll get a lot of `NotImplementedErrors`
+ 1. Find and fix the TODO markers in `lib/rdf/myrepository.rb`.
+ 1. Find and fix the TODO markers in `spec/my_repository.spec`. You may not need to do this if your repository needs no arguments to `new()`.
+ 1. Run the tests! Man, you're awesome!
+
+To run tests, run:
+
+ spec -cfn spec/my_repository.spec
+
+## Requirements
+
+You'll need the `rdf`, `rdf-spec`, and `rspec` libraries. The easiest way to install these is via RubyGems.
+
+ $ sudo gem install rdf rdf-spec rspec
+
+## Resources
+
+ * <http://rdf.rubyforge.org>
+
+
+### Author
+ * Ben Lavender | <blavender@gmail.com> | <http://github.com/bhuga> | <http://bhuga.net> | <http://blog.datagraph.org>
+
+### 'License'
+
+This is free and unemcumbered software released into the public domain. For
+more information, see the accompanying UNLICENSE file.
+
+If you're unfamiliar with public domain, that means it's perfectly fine to
+start with this skeleton and code away, later relicensing as you see fit.
+
36 lib/rdf/myrepository.rb
@@ -0,0 +1,36 @@
+require 'rdf'
+require 'enumerator'
+
+module RDF
+ class MyRepository < ::RDF::Repository
+
+ def initialize(options = {})
+ #TODO: Configure initialization
+ raise NotImplementedError
+ end
+
+ # @see RDF::Enumerable#each.
+ def each(&block)
+ if block_given?
+ #TODO: produce an RDF::Statement, then:
+ # block.call(RDF::Statement)
+ raise NotImplementedError
+ else
+ ::Enumerable::Enumerator.new(self,:each)
+ end
+ end
+
+ # @see RDF::Mutable#insert_statement
+ def insert_statement(statement)
+ #TODO: save the given RDF::Statement
+ raise NotImplementedError
+ end
+
+ # @see RDF::Mutable#delete_statement
+ def delete_statement(statement)
+ #TODO: delete the given RDF::Statement
+ raise NotImplementedError
+ end
+
+ end
+end
23 spec/my_repository.spec
@@ -0,0 +1,23 @@
+$:.unshift File.dirname(__FILE__) + "/../lib/"
+
+require 'rdf'
+require 'rdf/spec/repository'
+require 'rdf/myrepository'
+
+describe RDF::MyRepository do
+ context "My New RDF Repository" do
+ before :each do
+ @repository = RDF::MyRepository.new() # TODO: Do you need constructor arguments?
+ end
+
+ after :each do
+ #TODO: Anything you need to clean up a test goes here.
+ @repository.clear
+ end
+
+ # @see lib/rdf/spec/repository.rb in RDF-spec
+ it_should_behave_like RDF_Repository
+ end
+
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.