Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bhuga committed Apr 3, 2010
0 parents commit f51d141
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 changes: 36 additions & 0 deletions lib/rdf/myrepository.rb
Original file line number Diff line number Diff line change
@@ -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 changes: 23 additions & 0 deletions spec/my_repository.spec
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f51d141

Please sign in to comment.