Which Ruby REST API client for neo4j? - ruby-on-rails

I wonder what the REST API clients are available for using from Ruby (not JRuby, so native bindings are not an option)?
Ideally, I would want the API similar to the neo4j gem or ActiveRecord (validations, migrations, observers etc).
Currently available (REST) tooling doesn't even come close to what we have, for example, in ActiveRecrod:
neograhy - just plain REST API. Nothing to do with models etc.
neology - is just a wrapper over neography and isn't a full featured ActiveModel.
architect4r - conforms to ActiveModel, but provides only one way to query data (Cypher language), also no indexes support.
I like the code of architect4r a little bit more (primarily because it uses ActiveModel).
But neology seems to be much more pragmatic choice as it already is using neography under the hood.
The choice is pretty small and tough.
Could you please tell when one should be used rather than the other?
Also any recommendations that would help me to decide on the gem are very welcome.
Thanks.

The short answer is that there is no any mature ActiveModel-like gems for RESTful neo4j.
The most common scenario is to just use Neography.

I haven't worked with neoj yet, but i do work with api's a lot.
I have found the same trouble as you and my solution was to create my own.
Maybe if you have time, you can check it out. ApiClient
It still in development, so let me know of any feature you may need. =)

I have only used Neography which does its job very well. Have not heard about architect4r, but it looks really pragmatic and pleasing - need to check it out!
/peter

I know this thread is a little old, but there is activity on the neo4j-core gem geared towards using its API for the standalone database server in addition to the embedded database. Thought this might help people who find this thread when searching around.
https://github.com/andreasronge/neo4j-core/tree/3.0
Note: Before anyone yells at me for not making this a comment instead of an answer, I don't have the required reputation for doing so. Sorry.

Have you looked at REST-Client? https://github.com/archiloque/rest-client
it seems like it might be a very easy to to create and examine the responses from calls to a REST API. but maybe you need more than that?
(I was searching for answers and found your question, so far rest-client seems like the top candidate for what I need, figured it might help you also.

There is also activerecord-neo4j-adapter, but I have no experience with it.
https://github.com/digitalbias/activerecord-neo4j-adapter

Another option is Keymaker, which provides ActiveModel support for Neo4j.
Problem is, docs are non-existent, so you have to search out slideshows/presentations to find actual examples.

Related

What's the best way to do classical forms over data using Node.js?

I am in the need of creating a classical forms-over-data application using Node.js, including server-side rendering. I know that this is definitely not a good use case for Node.js for various reasons, nevertheless, I have to do it.
So let's please avoid discussion whether this is meaningful, or similar things - just take it as given.
Now I wonder what's the best way to fulfill this task. Of course, I could create such an app completely manually, using Express and MongoDB, and hand-writing routes and controllers, and stuff like this. It's basically not a big deal, but this compares quite bad to solutions such as ASP.NET MVC (which I'd prefer for this kind of task, to be true).
Now I found out about Sails.js, which is a heavily Rails-inspired MVC framework for Node.js, and which looks quite good. But before I now start experimenting in more depth with Sails.js, I wanted to ask what other options might be viable?
Any suggestions?
If you have ruby on rails 2.x background then check this out http://compoundjs.com/
rails 3.x check this http://tower.github.io/ or sails.js or geddyjs

Ruby on Rails: Is it better to use outdated plugin, or use your own code?

When you are facing with this kind of dilemma, what do you usually do, and why?
In my case, I want to create a user authorization system that works with facebook connect and openID.
Authlogic is working, but unfortunately authlogic-openid is no longer supported (they really should clean up ancient codes on github!)
Thanks!
It's better to use whatever works.
During the time you're building website, luck of continuous development shouldn't be a problem: you just need to see whether this version works.
And if later in production, for example, facebook outdates part of its API, you'll have lots of time to find solution.
There's general philosophy behind it, which I summarize as "do not solve problem before it appears" :)
I I think the best way is to contribute to the existing plugin with your required code implementation. Advantages are
1 - you will get what you want
2 - Plugin will be more rich and active
3 - You will not repeat the work that plugin authors has done already (which saves your time)
Thanks
cheers
sameera
You're just going to have to make an assessment. It's not like the plugin is going to stop working one day (barring changes to OpenID or something), but it may limit which versions of Rails you'll be able to use it with. If you think that its limitations are a problem, then find another solution.
Thankfully, most plugins aren't that big. You can usually extract the functionality you need and keep it up to date yourself without that much work. But it is work, and it takes time. So whether it's worth it to you is really up to you.

Ruby's File class vs. Rails' FileUtils

Now about 2 weeks into learning Ruby and Rails, I've found myself using the File class a lot for things like File.join, File.open, etc. Then I bumped into a need for File.copy only to find out that no such method exists. A little more looking uncovered Rails' FileUtils class and now I'm a little confused.
There are differences, of course, but there are also what appear to be redundancies. Is one preferred over the other where there are differences? Why do both exist (is it solely to handle the omissions in the Ruby core class)?
I'd just like to get a feel for how these things work together or conflict so I know how to move forward.
Thanks.
FileUtils is part of the Ruby Core API. It's not Rails specific. Also, it's a module, so you could mix in some of the abilities it has to offer into another class. Your best bet is to probably read the File RDoc, as well as the FileUtils RDoc. Hope this helps you out a bit. Cheers.
Edit:
Is one preferred over the other where there are differences?
I don't know if there is much consensus over which to use when the methods have the same ultimate end–result, such as File.makedirs vs. FileUtils.mkdir_p, but I often see the latter in other peoples code. I think you will almost always use the two (File & FileUtils) in conjunction.

Anybody using ruby without any framework?

I am experimenting with Ruby and Rails. I like Ruby, but not Rails. I have Java/PHP background, I have used some frameworks, but never totally liked any of them.
Anybody using Ruby to build web apps, but not any of the frameworks? (rails, merb etc). If yes, can you point me to some resources to learn it?
It might be wise to at least leverage Rack, and maybe Sinatra gets enough out of your way for you to feel comfortable. Sinatra isn't much more than a very small, simple wrapper around the rack handler afaik.
Doing Web apps in Ruby without using a framework is like cooking without heat. I question the sense of trying this.
That said, you could probably hook up Apache to call a Ruby program as a CGI. I suspect it would be dog slow, though.
Edit: Apparently you're not the only one crazy enough to attempt this, though: I found a tutorial on Simple Ruby CGI. The author claims as his rationale that "he has nothing better to do."
Your question looks quite similar to Ruby off the rails, so you probably should read the answers of that one.
I'm using ruby instead of bash and python on my ubuntu server for sysadmin tasks.
I've found Ruby a particularly clean and powerful replacement for the places I'd have previously used bash and python in sysadmin.
I personally found one thing for myself. When I prepare some interview or I am gonna build something from scratch, in most cases I need some basic features included in Rails. That usually happens when you build something not complex, but still non trivial. In 99% of cases I need ActiveRecord, ActiveSupport etc. It is easy to get those things in your Gemfile and play with them. One thing you will always repeat is basic application structure, easy console access with preloaded libs, rakes... I created minimal gem for myself to organise this process though.. :) If you read sources you'll see what I constantly do to start something new. It is not a big deal not to use any framework at all.
https://github.com/einzige/framework

What's the best option for searching in Ruby on Rails? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
There are several plugin options for building a search engine into your Ruby on Rails application. Which of these is the best?
Thinking Sphinx
UltraSphinx
Sphincter
acts_as_sphinx
acts_as_ferret
Ferret
acts_as_xapian
acts_as_solr
Hyper Estraier
Thinking Sphinx has more concise syntax to define which fields and which models are indexed.
Both UltraSphinx and Thinking Sphinx (recently) have ultra-cool feature which takes into account geographical proximity of objects.
UltraSphinx has annoying problems with how it loads models (it does not load entire Rails stack, so you could get strange and hard to diagnose errors, which are handled by adding explicit require statements).
We use Thinking Sphinx on new projects, and UltraSphinx on projects which use geo content.
A solid option used by one of my friends is Solr, a search engine using the original Java-based Lucene. To use it with Rails, there's, of course an acts_as plugin, acts_as_solr.
He presented the combo recently at Montreal on Rails and gives a nice and thorough overview of how to use acts_as_solr on his blog.
It apparently supports french accents very well, too.
I'm going through this exact process right now so while I don't have actual experience, I've spent many hours researching all the options. Here's what I've learned so far:
*Sphinx - good reputation for speed and functionality but Sphinx needs integer keys and my model uses GUID; ThinkingSphinx recently announced support for GeoSpatial
Acts_As_Solr - recommended by a friend with a high-volume site; original creators have stopped working on it and documentation is hard to find; requires a Java servlet
Acts_As_Ferret - looks easy to use, but lots of detractors that say its unstable
Two others with limited information are Acts_As_Indexed and Acts_As_Searchable
I have a spreadsheet with my attempt at documenting the advantages and disadvantages of all of them. If anyone is interested in seeing it and/or helping me correct it, just contact me. I'll post it somewhere once I know its accurate.
My recommendation would be to try UltraSphinx or Thinking Sphinx if you have normal primary keys. I'm going to try Acts_As_Xapian based on the good documentation, feature set, and how active the project seems to be.
I have only used the Ferret/acts_as_ferret combo (legacy decision) on a client project. I strongly recommend looking at the other options first.
aaf is very fragile and can bring your Rails app to a screeching halt if you make a mistake in the config or if for some reason you hit a bug in aaf.
In such a case, instead of simply having the search functionality crapping out, any controller action touching an indexed model will completely fail and raise an exception. Which is baaad, hmkay?
I use the acts_as_xapian plugin. I followed this tutorial:
http://locomotivation.com/2008/07/23/simple-ruby-on-rails-full-text-search-using-xapian
Works very well.
I'm using acts_as_ferret. It's easy to configure and generally fast. The built-in active record find functionality is quite useful: you can apply any conditions or join other models after your search finds the matching records.
Unlike sphinx, you don't have to re-index ALL of your records when you add new data. There are after_save and after_update hooks that will insert your new record into the ferret db. This was one of the big selling points for me.
When you do have to mass index your data, ferret is definitely slower than acts_as_sphinx (by a factor of 3). I ended up writing my own method to re-index models which works as fast as sphinx -- it basically preloads all the data from the DB instead of going record by record to create the new index.
The ferret documentation is good for the basics, but it's a bit sparse once you get into more complex searches, sorts and using a dRb server to host a remote index. That being said, it feels a much more mature product than acts_as_sphinx, although I have limited experience with sphinx.
If you are using a shared hosting service like me (Bluehost), your options may be limited to what the provider offers. In my case, I couldn't find a good and reliable way to start and keep a separate server running, such as Lucene or Solr.
Therefore, I went with Xapian and it's been working well for me. There are 2 plugins for rails I've researched: acts_as_xapian and xapian_fu.
The first will get you going quickly, but it doesn't seem to be maintained anymore. I've just begun working with xapian_fu.
In case anyone is still interested, the latest thing to use now is elasticsearch. There are gems available for it like tire or elasticsearch-rails. It is also based on Lucene like Solr, Java-based. Solr is actually integrated with this project now...
I've used Thinking Sphinx and it seems pretty good, but I haven't had the time to evaluate all of the options.
I recommend Thinking Sphinx. It is the fastest option in my opinion.
I've used Ferret and it worked well for my purposes, but I have not evaluated the other options.
An option I haven't tried is the C++ based Xapian
We're using http://hyperestraier.sourceforge.net/, which was inherited. Haven't looked into other engines, but hyperestraier provides all the hooks necessary. Setting up the search index is complicated though. Probably easier options available.
It depends on what database you are using. I would recommend using Solr as it offers up a lot of nice options for fuzzy search and has a great query parser. The downside is you have to run a separate process for it. I have used Ferret as well, but found it to be less stable in terms of multi-threaded access to the index. I haven't tried Sphinx because it only works with MySQL and Postgres.
I'm using a different option which was worked out amazingly well. I'm using jruby and talking to lucene directly.
I've used acts_as_solr in the past and ran into some issues. mainly it makes a synchronous call for each AR save. This isn't too bad, but in my situation a save sometimes caused many synchronous calls to solr and would occasionally take longer than mongrel would allow and I'd get a mongrel timeout exception (or something like that)
Thinking Sphinx is a better alternative than Ultrasphinx, which seems abandoned, but, in general, Xapian has a more powerful engine than Sphinx and is easier for implementing realtime search.
I recommend acts_as_ferret. But though the tough part is to get it up and running successfully in your server, once done you hardly have any problem as ferret server will be running as separate background process to update your index every time there is any new update. Also, its working great in mongrel with apache for us.
I've been looking for the perfect solution as well. At first I went with Thinking Sphinx, which worked fine. But since I intent to host my webapp on Heroku, the only option is to use Solr. The biggest drawback, however, is that development of the main acts_as_solr gem seems to have stopped after May 2008. So that's too old for my taste. I just found Sunspot as an advanced alternative and with recent updates, so that's one I'm going to consider.
Another option Heroku offers is to go for a hosted index server based on Solr, named Websolr. The required gem websolr-acts_as_solr is also luckily very much up-to-date.

Resources