Giter Site home page Giter Site logo

neography's Introduction

Neography

  • Gem Version
  • Build Status
  • Code Climate
  • Coverage Status

Welcome to Neography

Neography is a thin Ruby wrapper to the Neo4j Rest API, for more information:

If you want to utilize the full power of Neo4j, you will want to use JRuby and the excellent Neo4j.rb gem at https://github.com/andreasronge/neo4j by Andreas Ronge

Installation

Gemfile

Add neography to your Gemfile:

gem 'neography'

And run Bundler:

$ bundle

Manually:

Or install neography manually:

$ gem install 'neography'

And require the gem in your Ruby code:

require 'rubygems'
require 'neography'

Read the wiki for information about dependencies.

Rake tasks are available for downloading, installing and running Neo4j.

Usage

Configuration and initialization

Configure Neography as follows:

# these are the default values:
Neography.configure do |config|
  config.protocol             = "http"
  config.server               = "localhost"
  config.port                 = 7474
  config.directory            = ""  # prefix this path with '/'
  config.cypher_path          = "/cypher"
  config.gremlin_path         = "/ext/GremlinPlugin/graphdb/execute_script"
  config.log_file             = "neography.log"
  config.log_enabled          = false
  config.slow_log_threshold   = 0    # time in ms for query logging
  config.max_threads          = 20
  config.authentication       = nil  # 'basic' or 'digest'
  config.username             = nil
  config.password             = nil
  config.parser               = MultiJsonParser
  config.http_send_timeout    = 1200
  config.http_receive_timeout = 1200
  config.persistent           = true
  end

Then initialize a Rest instance:

@neo = Neography::Rest.new
@neo = Neography::Rest.new({:authentication => 'basic', :username => "neo4j", :password => "swordfish"})
@neo = Neography::Rest.new("http://neo4j:swordfish@localhost:7474")

For overriding these default and other initialization methods, see the configuration and initialization page in the Wiki.

REST API

Neography supports the creation and retrieval of nodes and relationships through the Neo4j REST interface. It supports indexes, Gremlin scripts, Cypher queries and batch operations.

Some of this functionality is shown here, but all of it is explained in the following Wiki pages:

2.0 Only features:

1.8+ features:

Some example usage:

# Node creation:
node1 = @neo.create_node("age" => 31, "name" => "Max")
node2 = @neo.create_node("age" => 33, "name" => "Roel")

# Node properties:
@neo.set_node_properties(node1, {"weight" => 200})

# Relationships between nodes:
@neo.create_relationship("coding_buddies", node1, node2)

# Get node relationships:
@neo.get_node_relationships(node2, "in", "coding_buddies")

# Use indexes:
@neo.add_node_to_index("people", "name", "max", node1)
@neo.get_node_index("people", "name", "max")

# Batches:
@neo.batch [:create_node, {"name" => "Max"}],
           [:create_node, {"name" => "Marc"}]
           
# Cypher queries:
@neo.execute_query("start n=node(0) return n")
           

You can also use the cypher gem instead of writing cypher as text.

node(1).outgoing(rel(:friends).where{|r| r[:since] == 1994})

would become:

START me=node(1) 
MATCH (me)-[friend_rel:`friends`]->(friends) 
WHERE (friend_rel.since = 1994) 
RETURN friends

This is just a small sample of the full API, see the Wiki documentation for the full API.

Neography raises REST API errors as Ruby errors, see the wiki page about errors. (Note: older versions of Neography did not raise any errors!)

Phase 2

Trying to mimic the Neo4j.rb API.

Now we are returning full objects. The properties of the node or relationship can be accessed directly (node.name). The Neo4j ID is available by using node.neo_id.

Some of this functionality is shown here, but all of it is explained in the following Wiki pages:

# create two nodes:
n1 = Neography::Node.create("age" => 31, "name" => "Max")
n2 = Neography::Node.create("age" => 33, "name" => "Roel")

n1.exist? # => true

# get and change some properties:
n1[:age]         # => 31
n1.name          # => "Max"
n1[:age]  = 32   # change property
n1.weight = 190  # new property
n1.age    = nil  # remove property

# add a relationship between nodes:
new_rel = Neography::Relationship.create(:coding_buddies, n1, n2)

# remove a relationship:
new_rel.del

# add a relationship on nodes:
n1.outgoing(:coding_buddies) << n2

# more advanced relationship traversal:
n1.outgoing(:friends)                                                # Get nodes related by outgoing friends relationship
n1.outgoing(:friends).depth(2).include_start_node                    # Get n1 and nodes related by friends and friends of friends

n1.rel?(:outgoing, :friends)                                         # Has outgoing friends relationship
n1.rels(:friends,:work).outgoing                                     # Get outgoing friends and work relationships

n1.all_paths_to(n2).incoming(:friends).depth(4)                      # Gets all paths of a specified type
n1.shortest_path_to(n2).incoming(:friends).depth(4).nodes            # Gets just nodes in path

This is just a small sample of the full API, see the Wiki documentation for the full API.

More

Examples

Some example code.

Testing

Some tips about testing.

Related Neo4j projects

Complement to Neography are the:

An alternative to Neography is Architect4r by Maximilian Schulz

Neography in the Wild

Getting started with Neography

Contributing

Please create a new issue if you run into any bugs.

Contribute patches via pull requests.

Help

If you are just starting out, or need help send me an e-mail at [email protected].

Check you my blog at http://maxdemarzi.com where I have more Neography examples.

Licenses

neography's People

Contributors

calamitas avatar dchelimsky avatar degzcs avatar digitalbias avatar erez-rabih avatar ifesdjeen avatar jayniz avatar jazminschroeder avatar karabijavad avatar kelseymok avatar klobuczek avatar leosoto avatar lightpower avatar loganhasson avatar markburns avatar maxdemarzi avatar pablof7z avatar pboling avatar pete avatar pushbang avatar pwaleczek avatar radford avatar rdvdijk avatar samirahmed avatar simpsonjulian avatar sosiouxme avatar sundbp avatar tbaum avatar ujjwalt avatar zengardendubai 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  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  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  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

neography's Issues

neo4j download url changed

Hi Maxdemarzi,

I just noticed that the download url of neo4j is changed now, so http://dist.neo4j.org won't work anymore in tasks. I'm not sure if you have planned to change it already. :-)

I love your work.

Thanks a lot.

Running find_and_require_user_defined_code on require is wrong

Wrong is perhaps a harsh word, but I don't think a library should be requiring user defined code at all, let alone automatically.

This caused a problem when I deployed something in production and monitored it with monit. Suddenly the lack of a HOME in the default monit environment prevents the application from running.

If one of my coworkers would start using this helpful method to load helper code he might start relying on it. Code would break on other people's machines (I know, unit tests, but still when that coworker would be running tests he wouldn't encounter the issue, muddling the source of the errors).

Worse, I have no way to prevent this loading of untested code from outside my application. The only way to avoid loading code is by specifying a foldername to ENV["neography_extensions"] that does not exist and then hope that no-one is ever going to create it (either on purpose or by accident).

The only useful role that I see for something like this is when working in an interactive environment, in that case it might be better to have either a separate require file that would do a normal require of neography.rb and then load the "extensions" separately.

Perhaps the worst part of this feature is that it's not documented at all (as far as I can see). So only people who read the code of all libraries they require will even know about it until they encounter an issue like I did with monit.

Wrong HTTP option name in rest.rb

The "max depth" option name given in the traverse, get_path and get_paths methods should be "max_depth" (note underscore). Otherwise Neo4j 1.4 defaults to a depth of 1 and very uninteresting traversals :)

Getting a split issue

Hi there,
I am trying to do do

require 'rubygems'
require 'neography'

@neo = Neography::Rest.new # Inialize using all default parameters

root = @neo.get_root # Get the root node
puts root
max = @neo.create_node("age" => 31, "name" => "Max") # Create a node with some properties
puts max
@neo.create_relationship("friends", root, max)

/Users/peterneubauer/.rvm/gems/jruby-1.5.5/gems/neography-0.0.12/lib/neography/rest.rb:377:in get_id': private methodsplit' called for nil:NilClass (NoMethodError)
from /Users/peterneubauer/.rvm/gems/jruby-1.5.5/gems/neography-0.0.12/lib/neography/rest.rb:172:in `create_relationship'
from presentation.rb:10

I am using the latest neo4j 1.3.

Thanks for the awesome bindings!

neography shouldn't swallow status-code 500

I had a case when the REST-interface returned a status-code 500.

response.code=>500
response.body=>"{ "message" : "Invalid UTF-8 start byte 0xa0\n at [Source: org.mortbay.jetty.HttpParser$Input@50cc63; line: 1, column: 1389]", "exception" : "org.codehaus.jackson.JsonParseException: Invalid UTF-8 start byte 0xa0\n at [Source: etc.........

I see that Connection#evaluate_response swallows that error. Since this is a serious error, I think neography should handle it the same way as 4xx-errors.

Could you please handle status-code 500 and raise an exception?

Thanks a lot
Jorg

Catch exception when executing Cypher script

Using "execute_script" with a cypher query :

When i try to CREATE UNIQUE a relation which does already exists there is no way to know if neo4j has answered : UniquePathNotUniqueException

Is there a way to get errors from neo4j using @neo.execute_query("") ?

NotImplementedError: MultiJsonParser has not implemented a parsing method for the :json format.

I'm having an error when adding data via neography, any suggestions?

$ irb

require 'bundler/setup'
=> true
require 'neography'
=> true
@neo = Neography::Rest.new
=> #<Neography::Rest:0x007faaba97d170 @protocol="http://", @server="localhost", @PORT=7474, @Directory="", @cypher_path="/cypher", @gremlin_path="/ext/GremlinPlugin/graphdb/execute_script", @log_file="neography.log", @log_enabled=false, @max_threads=20, @authentication={}, @parser={:parser=>MultiJsonParser}, @user_agent={"User-Agent"=>"Neography/0.0.31"}>

?> def create_person(name)
@neo.create_node("name" => name)
end
=> nil
johnathan = create_person('Johnathan')
NotImplementedError: MultiJsonParser has not implemented a parsing method for the :json format.
from /Users/drewgilliam/Documents/Labs/Labs7/EmergingTechRadar/vendor/ruby/1.9.1/gems/neography-0.0.31/lib/neography/multi_json_parser.rb:13:in json' ... from (irb):6:increate_person'
from (irb):8
from /Users/drewgilliam/.rvm/rubies/ruby-1.9.3-head/bin/irb:16:in `

'

remove_node_from_index only works for entire node

This may be another Neo4j bug, but I can't seem to remove a node from an index unless I remove the entire node. remove_node_from_index('my_index', my_node) works and completely removes all references to the node from the index.

However, remove_node_from_index('my_index', 'my_key', my_node) and the variant that supplies an explicit value both seem to silently fail. After calling either, I can do a find_node_index('my_index', 'my_key', 'removed_value') and still find the index entry that should have been removed.

Batch streaming doesn't seam to work

I am using the batch feature to send batches of operations. When my batch is less than 1600 instructions, it works OK. When it has 2000, the request is failing with "HTTPClient::SendTimeoutError: execution expired"

Using 'batch_not_streaming' with the same batch works, and is faster.

After looking a little bit at the code I might have found the reason: when using "batch" method the http headers are set to "stream=true" (batch.rb), but the post via HttpClient is done using post method, and not 'post_async' as I imagine it should.

create unique node with a property value as array will not create the node

NEO4J.batch [:create_unique_node, "properties_checksum", "properties_checksum", "076da301619e83cff84025301cf9b4adaa34a8251", {"measure_value"=>[50, 60], "properties_checksum"=>"076da301619e83cff84025301cf9b4adaa34a825"}]
return nil
if run NEO4J.batch [:create_unique_node, "properties_checksum", "properties_checksum", "076da301619e83cff84025301cf9b4adaa34a8251", {"measure_value"=>[50, 60].to_s, "properties_checksum"=>"076da301619e83cff84025301cf9b4adaa34a825"}]
will create a node

Neography should return better status information

Currently, all responses are handled by the evaluate_response method which returns either a response or nil. This makes it difficult to tell whether a request was successful, but contained no body (204) or whether a request was unsuccessful (e.g. 40x). One could look in the log (if logging is enabled), but that's not really sufficient. Furthermore, This code doesn't appear to handle other error conditions (e.g. additional 40x or 50x status).

It would be great if the caller could get at the full HTTP response, especially the status code.

Authorization header is missing in 1.0.9

Neography 1.0.9 is not sending the authentication headers

The following code

require "neography"
neo = Neography::Rest.new("http://user:pw@host")
p neo.execute_query("start n = node(*) return count(n)")

Works with 1.0.8 (and older), but not with 1.0.9.

With ngrep, I see this request in 1.0.8

T 192.168.1.103:52100 -> 12.345.678.123:80 [AP]
POST /db/data/cypher HTTP/1.1.
Content-Type: application/json.
Accept: application/json;stream=true.
User-Agent: Neography/1.0.8.
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Connection: close.
Host: xxxxxxxxxxxxxxxxxxx.
Content-Length: 57.
.

##
T 192.168.1.103:52100 -> 12.345.678.123:80 [AP]
{"query":"start n = node(*) return count(n)","params":{}}
##

Version 1.0.9 sends this:

T 192.168.1.103:52152 -> 12.345.678.123:80 [AP]
POST /db/data/cypher HTTP/1.1.
Content-Type: application/json.
Accept: application/json;stream=true.
User-Agent: Neography/1.0.9.
Date: Fri, 22 Mar 2013 00:15:15 GMT.
Content-Length: 57.
Host: xxxxxxxxxxxxxxxxxxx.
.
{"query":"start n = node(*) return count(n)","params":{}}
##

The Authorization header is missing

Since there is no authorization, the server responds with a 401, and Neography throws the following error:

[...]/neography-1.0.9/lib/neography/connection.rb:146:in `handle_4xx_500_response': Neography::UnauthorizedError
    from [...]/neography-1.0.9/lib/neography/connection.rb:112:in `evaluate_response'
    from [...]/gems/neography-1.0.9/lib/neography/connection.rb:42:in `post'
...

Cannot add nodes to an index

I'm using neography to access Neo4j from rails and I have this test case that keep failing:

require 'spec_helper'

describe Graph do

before(:each) do
@neo = Neography::Rest.new
end

it "add node to index" do
test_index = @neo.create_node_index("test_index")
key = generate_text(6)
value = generate_text
response = @neo.create_node
new_index = @neo.add_node_to_index(test_index, key, value, response)
new_index.should_not be_nil
@neo.remove_node_from_index(test_index, key, value, response)
end

end

The index is created on the server, but no nodes are added, here is the rspec failure:

  1. Graph add node to index
    Failure/Error: new_index.should_not be_nil
    expected: not nil
    got: nil

    ./spec/models/graph_spec.rb:39:in `block (2 levels) in <top (required)>'

Difficult to delete a specific relationship

Once a relationship has been created, it's difficult to find and remove it. Let's say I have a relationship between a teacher and a student:

@neo.create_relationship(teacher, student)

There could potentially be a very large number of related nodes. In order to find the relationship and remove it, you have to grab all the related nodes, iterate over them, and fire off a request to Neo4j over rest for each one using the "self" property to get the node's attributes:

rels = @neo.get_node_relationships(teacher, "out")
...

I can't help but think there's a more efficient method - does Neography already have this functionality?

Issue with batch interface

I've created a pull request with an example here: #90

Basically, the behavior I've experienced is that a batch will fail quietly without raising an error.

Best,
Dave

neography breaks on jruby because of oj dependency (C-extension)

Thank you for the awesome neography gem!

I am having trouble using the current version (0.0.28) on jruby 1.6.7.2. It breaks because of oj's native c-extension. C-extensions are not supported in jruby.

The neography gem works fine at version 0.0.26 (when you still used crack instead of oj).

Do you have plans to make it compatible with jruby again?

Thanks and cheers

Jo

Support batch operations

Batch operations are absolutely crucial with REST, where transactions are only available within a single request.

Would be great to have an API for that.

I can approximately see how to use it.

Instead of:

nodes = (1..1000).map { |n| Neography::Node.create("age" => n % 30 + 20, "name" => "Max #{n}") }
# all nodes are avilable, it executes 1000 requests

We would write something among:

nodes = Neography::Batch.start do
  (1..1000).map { |n| Neography::Node.create("age" => n % 30 + 20, "name" => "Max #{n}") }
end
# all nodes are created and available here. Only 1 batch operation request is executed.

So when we are within a batch operation, all the requests would be accumulated instead of actually sent.
Then dispatch at the end.

In "Phase 2" functionality, how to find/get nodes?

Hi -- this may not be implemented yet, but I wanted to check. When using the "Phase 2" style that mimics neo4j.rb, is there a way to find/get using an index? Without that, I'm trying to determine how to do this:

someone = @neo.get_node_index("people", "name", "Bob")[0]
=> Hash containing the node info
someone_node = Neography::Node.load(id)

Obviously this isn't ideal since it's two calls, but also, the Hash returned from the get_node_index() call doesn't actually have the ID in an easy-to-get place -- it seems like I'd have to take "self" and parse out the ID from the end of the URL. Not great.

Is there something in the "Phase 2" functionality that I haven't stumbled on yet? Just curious where this stands. Thanks for the great work on neography!

set property in batch doesn't work with special neo4j references

When using a set_property in a batch, if it uses a reference to a previous instruction by using the "{X}" syntax, both "{" and "}" will be escaped and the url sent to neo4j will look like "/node/%7BX%7D/properties/". This results in errors on the neo4j side, as it doesn't recognize the reference.

issue about passing neo4j location on command-line

I have neo4j -version 1.8.1- installed on Ubuntu 12.10 from official deb repository. I wanted to give a try neography, first I passed "rake neo4j:install" because it's already installed but next I couldn't run "rake neo4j:start" beacuse it couldn't find location of neo4j. I couldn't find the command that I could pass location of it like:
"rake neo4j:install --dir=/path/to/neo4j"

string shouldn't be automatically converted to ruby-symbol

Following tests fails

describe Neography do
  subject { Neography::Rest.new({:port => 7475, :log_enabled => false}) }
  describe 'create_node' do
    it 'should not convert strings to symbol' do
      node = subject.create_node({:text => ':1456'})

      node['data']['text'].class.should == String # fails! expected: String got: Symbol (using ==)
      node['data']['text'].should == ':1456'
    end
  end
end

The string is correctly stored as ':1456' in the database, but I expect it to be returned as a string and not to be converted to a ruby-symbol. I analyzed it on get_node() and I saw that the Oj-library is doing the deserialization but I couldn't see how I could override that behaviour easily.

How could I change that behaviour? Shouldn't neography always return strings?

Cheers
Jorg

JSON parse error

Something of a fringe case, but here goes:

When deleting a node from an index using "remove_node_from_index", if the value param is "" then the server returns a 404 message with an empty body. "handle_4xx_500_response" expects some JSON to return from the server, so you get a JSON error as opposed to some other kind of error from neography.

I've fixed it in my fork and can submit a pull request if that fits with how you want to handle it. Test spec is included.

Need to assign twice a new property of a Node

Only on the second node.property = "value" it write the value.
Doesn't work with node[:property] at all. Running w/ latest git code.

> n = Node.create(name: "Test")   # => #<Neography::Node name="Test"> 
> n.prop = 1                      # => 1 
> n.prop                          # => *** nil ***: First time, value still nil
> n.prop = 1                      # => 1 
> n.prop                          # => 1: Second time, value written
> n[:prop]                        # => 1 
> n[:prop2] = 2                   # => 2 
> n[:prop2]                       # => *** nil ***
> n[:prop2] = 2                   # => 2 
> n[:prop2]                       # => *** nil ***
> n.name                          # => "Test" 
> n.name = "New Name"             # => "New Name" 
> n.name                          # => "New Name" (That's an existing property, it works)

Related to get_node_index

This is running properly ---> nodes = @neo.get_node_index("Customer","id","4")
But this is creating error---->nodes = @neo.batch [:get_node_index, "Customer" ,"id" ,"4"]
Can anyone suggest me why this is creating problem ???
Please suggest me a more better way to find the existing node

Example Parser config in README doesn't work anymore

On the main page, you have this in the config:

config.parser         = {:parser => MultiJsonParser}

But I think that it needs to be:

config.parser         =  MultiJsonParser

Sorry for being lazy and not doing a pull request :)

neo_server not available on Relationships

Hi, I just stumbled upon a little problem when changing an attribute on a relationship. In property.rb we call neo_server.set_relationship_properties but neo_server is not available for Relationships. I will add a suggested fix, but I am not sure if this will be the way it should be ;)

offline mode to use as mock in testing

neography is a component that falls perfectly in the definition of what needs to be mocked when doing TDD.
Having an offline mode (think airplane-mode for iPads, or sqlite) that I could instantiate from a file and work only on memory could be a great help when testing and avoid setting multiple neo4j instances.

When we traverse nodes it don't show interlinking in data

What i have to do is to get the parents => grand parents => like this kind of tree interrelated to each other.

I m doing something like this

@neo.traverse(self.node_id, "nodes", {"order" => "depth first",
"relationships" => [{"type"=> "father",
"direction" => "out"},
{"type"=> "mother",
"direction" => "out"}],
"depth" => 4})

It fetched accurately but don't have any relationships with the data returned means it only contains the stored value not the relationship id or related node there Can we get that ?

Here is the output

[{"paged_traverse"=>"http://localhost:7474/db/data/node/2/paged/traverse/{returnType}{?pageSize,leaseTime}", "outgoing_relationships"=>"http://localhost:7474/db/data/node/2/relationships/out", "data"=>{"id"=>101, "name"=>"Msee", "dob"=>"Oct 03, 1934"}, "all_typed_relationships"=>"http://localhost:7474/db/data/node/2/relationships/all/{-list|&|types}", "traverse"=>"http://localhost:7474/db/data/node/2/traverse/{returnType}", "self"=>"http://localhost:7474/db/data/node/2", "all_relationships"=>"http://localhost:7474/db/data/node/2/relationships/all", "property"=>"http://localhost:7474/db/data/node/2/properties/{key}", "outgoing_typed_relationships"=>"http://localhost:7474/db/data/node/2/relationships/out/{-list|&|types}", "properties"=>"http://localhost:7474/db/data/node/2/properties", "incoming_relationships"=>"http://localhost:7474/db/data/node/2/relationships/in", "incoming_typed_relationships"=>"http://localhost:7474/db/data/node/2/relationships/in/{-list|&|types}", "extensions"=>{}, "create_relationship"=>"http://localhost:7474/db/data/node/2/relationships"}]

Exception raised when getting related nodes (and receiver node has no relationships)

I've only just started playing around with Neography (and Neo4J), so not sure if this expected behaviour, but if I do the following:

node = Neography::Node.create("age" => 31, "name" => "Max")
node.both.size #or any array-type functions

I get

NoMethodError: undefined method `collect' for nil:NilClass

This appears to be caused by this line:

return nil if node_relationships.empty?

which is expected to be something that responds to collect.

Happy to do a spec/patch/pull request if this is a bug rather than expected behaviour

uninitialized constant OS

Trying to use bundle exe rake neo4j:install task gives me the error uninitialized constant OS

> bundle install
Fetching source index for http://rubygems.org/
sing rake (0.9.2.2) 
Using crack (0.1.8) 
Using httparty (0.7.8) 
Using json (1.6.2) 
Using os (0.9.4) 
Using rubyzip (0.9.5) 
Using neography (0.0.16) 
Using bundler (1.0.21) 

> bundle exec rake neo4j:install --trace
** Invoke neo4j:install (first_time)
** Execute neo4j:install
Installing Neo4j...
rake aborted!
uninitialized constant OS
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/neography-0.0.16/lib/neography/tasks.rb:8:in `block (2 levels) in <top (required)>'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/dnagir/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `load'
/Users/dnagir/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `<main>'
Tasks: TOP => neo4j:install
# Rakefile
require 'neography/tasks'
# Gemfile
source 'http://rubygems.org'

gem 'rake'
gem 'neography'

Batch Requests do not escape paths

First off, I love this gem. I have been using Neography for the past two weeks now and it has been great. Can't wait for the streaming updates.

Now, I think I have found an issue, but if it's not please don't bite :)

I have been trying to use more batch requests, however I noted that it seems like the batch function does not escape the paths.

In my case I have key/value pairs on indicies with spaces, so the requests end up having spaces in the paths since they don't go through the get/post functions that would URI.encode the paths.

I hope I am not too wrong.

Email address doesn't work

[email protected] seems to be offline?

I used this to confirm: http://verify-email.org/

Your message cannot be delivered to the following recipients:

Recipient address: [email protected]
Reason: Remote SMTP server has rejected address
Diagnostic code: smtp;550-5.1.1 The email account that you tried to reach does not exist. Please try the recipient's email address for typos or spaces. Learn more at http://support.google.com/mail/bin/answer.py?answer=6596 s4si2643652
Remote system: dns;gmail-smtp-in.l.google.com (TCP|17.148.16.98|64210|74.125.127.26|25) (mx.google.com ESMTP s4si26436520pbc.345)

Original-envelope-id: [email protected]
Reporting-MTA: dns;nk11r10mm-asmtp023.mac.com (tcp-daemon)
Arrival-date: Tue, 21 Feb 2012 23:42:07 +0000 (GMT)

Two errors running specs

Hi Max,

I get these two errors when I run your specs. Do you get these too?

FF....................................................................................................................................................................................

Failures:
  1) Neography::Relationship find can index when Neography::Relationships are created
     Failure/Error: Neography::Relationship.index(:strength)
     undefined method `index' for Neography::Relationship:Class
     # ./spec/integration/index_spec.rb:5:in `block (2 levels) in <top (required)>'

  2) Neography::Relationship find can remove index when Neography::Relationship is deleted, just like nodes
     Failure/Error: Neography::Relationship.index(:strength)
     undefined method `index' for Neography::Relationship:Class
     # ./spec/integration/index_spec.rb:5:in `block (2 levels) in <top (required)>'

create_relationship causes batch to fail (returns nil)

I'm unable to create relationships in a batch. The moment I add a :create_relationship call to a batch, @neo.batch returns nil and nothing is created in my graph.

The following fails:

[:create_unique_node, "person", "ssn", "000-00-0001", {:first_name=>"Jane", :last_name=>"Doe", :ssn=>"000-00-0001", :_type=>"Person", :created_at=>1335269478}],
[:add_node_to_index, "person_ssn", "ssn", "000-00-0001", "{0}"],
[:create_node, {:street1=>"94437 Kemmer Crossing", :street2=>"Apt. 333", :city=>"Abshireton", :state=>"AA", :zip=>"65820", :_type=>"Address", :created_at=>1335269478}],
[:create_relationship, "has", "{0}", "{2}", {}]

However, the nodes get created (without the relationship) if I just run:

[:create_unique_node, "person", "ssn", "000-00-0001", {:first_name=>"Jane", :last_name=>"Doe", :ssn=>"000-00-0001", :_type=>"Person", :created_at=>1335269478}],
[:add_node_to_index, "person_ssn", "ssn", "000-00-0001", "{0}"],
[:create_node, {:street1=>"94437 Kemmer Crossing", :street2=>"Apt. 333", :city=>"Abshireton", :state=>"AA", :zip=>"65820", :_type=>"Address", :created_at=>1335269478}]

I've tried [:create_relationship, "has", "{0}", "{2}"] instead with the same failing result. Since there is no error raised when my batch fails, I've been unable to track down exactly what is going wrong.

NoMethodError: undefined method `json' for {:parser=>MultiJsonParser}:Hash

I don't understand this error. I am not even sure where the error is coming from in my code exactly because the backtrace is very skimpy:

/app/vendor/bundle/ruby/1.9.1/bundler/gems/neography-e0f56c3900f9/lib/neography/connection.rb:104:in `evaluate_response'
/app/vendor/bundle/ruby/1.9.1/bundler/gems/neography-e0f56c3900f9/lib/neography/connection.rb:37:in `get'

I am also using Neoid, but I am not sure if that is involved here.

Active record ConnectionNotEstablished

Hi

I installed neography. It works until I want load a page.
Neo4j it was installed without error and it start without error.
But when I load my index page I have an error who say:
ActiveRecord::ConnectionNotEstablished

I think it's because I try pass a project between the gem neo4j.rb to neography. But to avoid issues I created a new project and take the principal file. (controller, views but not config file.)
I use ruby 1.9.3

If you have an idea to help me to find why I have this issues, say it.
Best regard.

curl support

This gist https://gist.github.com/3395490 replaces HTTParty with curl/curb, which effectively should support pipelining and kept-alive connections. I use this code in a project of mine, which has close to 99% test coverage, and I haven't seen any problems so far with both authenticated and non-authenticated connections to 1.7.x servers, with batches and non-batched commands. Didn't try https though.

The speedup obviously depends on the connection: I found the curb version ~30% faster when crossing the atlantic, and not faster at all for localhost connections. No surprise here...

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.