forked from bhuga/rdf-repository-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f51d141
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|