GithubHelp home page GithubHelp logo

orientdb4r's Introduction

            _            _      _ _     _  _
  ___  _ __(_) ___ _ __ | |_ __| | |__ | || |  _ __
 / _ \| '__| |/ _ \ '_ \| __/ _` | '_ \| || |_| '__|
| (_) | |  | |  __/ | | | || (_| | |_) |__   _| |
 \___/|_|  |_|\___|_| |_|\__\__,_|_.__/   |_| |_|

Ruby binding for Orient DB

A Ruby client for the NoSQL Graph/Document database Orient DB (orientdb.org).

<img src=“https://badge.fury.io/rb/orientdb4r.svg” alt=“Gem Version” /> <img src=“https://secure.travis-ci.org/veny/orientdb4r.png” alt=“Build Status” /> <img src=“https://coveralls.io/repos/veny/orientdb4r/badge.svg?branch=master” alt=“Coverage Status” />

USAGE

see Wiki page for more sample at github.com/veny/orientdb4r/wiki

require 'orientdb4r'

DB = 'foo'
CLASS = 'myclass'

client = Orientdb4r.client  # equivalent for :host => 'localhost', :port => 2480, :ssl => false

client.database_exists? :database => DB, :user => 'admin', :password => 'admin'
=> false

client.create_database :database => DB, :storage => :memory, :user => 'root', :password => 'root'
=> false

client.connect :database => DB, :user => 'admin', :password => 'admin'
=> true

unless client.class_exists? CLASS
  client.create_class(CLASS) do |c|
    c.property 'prop1', :integer, :notnull => true, :min => 1, :max => 99
    c.property 'prop2', :string, :mandatory => true
    c.link     'users', :linkset, 'OUser' # by default: :mandatory => false, :notnull => false
  end
end

admin = client.query("SELECT FROM OUser WHERE name = 'admin'")[0]
1.upto(5) do |i|
  # insert link to admin only to first two
  client.command "INSERT INTO #{CLASS} (prop1, prop2, users) VALUES (#{i}, 'text#{i}', [#{admin['@rid'] if i<3}])"
end

puts client.query "SELECT FROM #{CLASS}"
=> {"@type"=>"d", "@rid"=>"#6:0", "@version"=>0, "@class"=>"myclass", "prop1"=>1, "prop2"=>"text1", "users"=>["#4:0"]}
=> {"@type"=>"d", "@rid"=>"#6:1", "@version"=>0, "@class"=>"myclass", "prop1"=>2, "prop2"=>"text2", "users"=>["#4:0"]}
=> {"@type"=>"d", "@rid"=>"#6:2", "@version"=>0, "@class"=>"myclass", "prop1"=>3, "prop2"=>"text3", "users"=>[]}
=> {"@type"=>"d", "@rid"=>"#6:3", "@version"=>0, "@class"=>"myclass", "prop1"=>4, "prop2"=>"text4", "users"=>[]}
=> {"@type"=>"d", "@rid"=>"#6:4", "@version"=>0, "@class"=>"myclass", "prop1"=>5, "prop2"=>"text5", "users"=>[]}

puts client.query "SELECT count(*) FROM #{CLASS}"
=> {"@type"=>"d", "@version"=>0, "count"=>5, "@fieldTypes"=>"count=l"}

puts client.query "SELECT max(prop1) FROM #{CLASS}"
=> {"@type"=>"d", "@version"=>0, "max"=>5}

puts client.query "TRAVERSE any() FROM (SELECT FROM #{CLASS} WHERE prop1 = 1)"
=> {"@type"=>"d", "@rid"=>"#6:0", "@version"=>0, "@class"=>"myclass", "prop1"=>1, "prop2"=>"text1", "users"=>["#4:0"]}
=> {"@type"=>"d", "@rid"=>"#4:0", "@version"=>0, "@class"=>"OUser", "name"=>"admin", "password"=>"{SHA-256}8C6976E5B5410415BDE908BD4DEE15DFB167A9C873FC4BB8A81F6F2AB448A918", "status"=>"ACTIVE", "roles"=>["#3:0"]}
=> {"@type"=>"d", "@rid"=>"#3:0", "@version"=>0, "@class"=>"ORole", "name"=>"admin", "mode"=>1, "rules"=>{}, "@fieldTypes"=>"mode=b"}

client.drop_class CLASS
client.disconnect
=> ["401 Unauthorized: Logged out", 401]

INSTALL

> sudo gem install orientdb4r

Important Upgrade Notice

  • see changelog.txt

FEATURES/PROBLEMS

  • Supports only REST API right now

REQUIREMENTS

  • Ruby 1.9.x+

  • OrientDB 1.0.x-1.3.x for v0.3.x

  • OrientDB 1.4.0+ for v0.4.x

  • OrientDB 1.6.0+ for v0.5.x

TESTS

> cd /path/to/repository
> bundle exec rake db:setup4test  # to create the temp DB which doesn't seem to be a default since v1.5
> bundle exec rake test

Make sure before starting the tests:

  • database server is running on localhost:2480

  • there is a root account with username=root and password=root; if your password is different, specify it with an ‘ORIENTDB_ROOT_PASS` environment variable

AUTHOR

LICENSE

CONTRIBUTING

  1. Fork it ( github.com/veny/orientdb4r/fork )

  2. Create your feature branch ( git checkout -b my-new-feature )

  3. Commit your changes ( git commit -am 'Add some feature' )

  4. Push to the branch ( git push origin my-new-feature )

  5. Create a new Pull Request

orientdb4r's People

Contributors

bdodova avatar kkaempf avatar lukeasrodgers avatar veny avatar zhbanton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orientdb4r's Issues

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can image, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.