https://github.com/mbj/axiom-arango-adapter
An ArangoDB adapter for Axiom
https://github.com/mbj/axiom-arango-adapter
Last synced: over 1 year ago
JSON representation
An ArangoDB adapter for Axiom
- Host: GitHub
- URL: https://github.com/mbj/axiom-arango-adapter
- Owner: mbj
- License: mit
- Created: 2013-01-25T23:47:59.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-06-02T20:52:37.000Z (about 13 years ago)
- Last Synced: 2025-04-16T03:16:31.702Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 660 KB
- Stars: 8
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
README
axiom-arango-adapter
======================
[](http://travis-ci.org/mbj/axiom-arango-adapter)
[](https://gemnasium.com/mbj/axiom-arango-adapter)
[](https://codeclimate.com/github/mbj/axiom-arango-adapter)
[ArangoDB](https://www.arangodb.org) adapter for [axiom](https://github.com/dkubb/axiom).
Installation
------------
Install the gem `axiom-arango-adapter` via your preferred method.
Examples
--------
Setup a gateway and connect it to ArangDB:
```ruby
require 'axiom-arango-adapter'
require 'logger'
# Connect to ArangoDB
database = Ashikawa::Core::Database.new('http://localhost:8529')
# Save some people in the database
collection = database['people']
[
{ :id => 1, :firstname => "Jon", :lastname => "Doe" },
{ :id => 2, :firstname => "Sue", :lastname => "Doe" }
].each do |document|
collection.create(document)
end
# Some logger to see AQL
logger = Logger.new($stderr, :debug)
# Instantiating adapter
adapter = Axiom::Adapter::Arango::Adapter.new(database, logger)
# Setting up a base relation
header = Axiom::Relation::Header.coerce([[:id, Integer], [:firstname, String], [:lastname, String]])
base = Axiom::Relation::Base.new(:people, header)
# Creating a gateway
gateway = adapter.gateway(base)
# Use the gateway with the examples from the axiom README, for example:
gateway.restrict { |r| r.firstname.eq("Sue") } # restricts to tuples where firstname is "Sue"
```
You can find more examples in the [axiom README](https://github.com/dkubb/axiom/blob/master/README.md).
Fuzzer
------
Axiom has a fuzzer to assist checking the correctness of the adapter and datastore. To run the fuzzer execute the following:
```
bundle exec spec/fuzzer.rb
```
Make sure you run an ArangoDB instance on localhost at the default port!
Credits
-------
* [Markus Schirp (mbj)](https://github.com/mbj) Author
* [triAGENS](https://github.com/triAGENS) for sponsoring this work!
Contributing
-------------
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
future version unintentionally.
* Commit, do not mess with Rakefile or version
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.
License
-------
This gem is published under the MIT license. See `LICENSE` file.