<commit_before>== Welcome to Neography

Neography is a thin Ruby wrapper to the Neo4j Rest API, for more information:
* {Getting Started with Neo4j Server}[http://wiki.neo4j.org/content/Getting_Started_with_Neo4j_Server]
* {Neo4j Rest API Reference}[http://components.neo4j.org/neo4j-rest/]

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

=== Installation

  gem install 'neography'

After that, in your ruby script, do

  require 'rubygems'
  require 'neography'

in order to access the functionality.
=== Dependencies

  for use:
  json
  httparty 

  for development:
  rspec 
  net-http-spy 
  fakeweb 

==== Rails

Just add gem 'neography' to your Gemfile and run bundle install

=== Documentation

A thin ruby wrapper Neography::Rest which tries to mirror the Neo4j Rest API and returns JSON or Nil:

  #                            protocol,  server,        port,  log_file,           log_enabled
  @neo = Neography::Rest.new ('http://', '192.168.10.1', 7479, 'log/neography.log', true)

Default Parameters are:   

  @neo = Neography::Rest.new ('http://', 'localhost', 7474, '/neography.log', false)

To Use:

  @neo = Neography::Rest.new 

  @neo.get_root                                              # Get the root node
  node1 = @neo.create_node                                   # Create an empty node
  node2 = @neo.create_node("age" => 31, "name" => "Max")     # Create a node with some properties
  @neo.get_node(node2)                                       # Get a node and its properties
  @neo.delete_node(node2)                                    # Delete an unrelated node
  @neo.delete_node!(node2)                                   # Delete a node and all its relationships

  @neo.reset_node_properties(node1, {"age" => 31})           # Reset a node's properties
  @neo.set_node_properties(node1, {"weight" => 200})         # Set a node's properties
  @neo.get_node_properties(node1)                            # Get just the node properties
  @neo.get_node_properties(node1, ["weight","age"])          # Get some of the node properties
  @neo.remove_node_properties(node1)                         # Remove all properties of a node
  @neo.remove_node_properties(node1, "weight")               # Remove one property of a node
  @neo.remove_node_properties(node1, ["weight","age"])       # Remove multiple properties of a node

  rel1 = @neo.create_relationship("friends", node1, node2)   # Create a relationship between node1 and node2
  @neo.get_node_relationships(node1)                         # Get all relationships
  @neo.get_node_relationships(node1, "in")                   # Get only incoming relationships
  @neo.get_node_relationships(node1, "all", "enemies")       # Get all relationships of type enemies
  @neo.get_node_relationships(node1, "in", "enemies")        # Get only incoming relationships of type enemies
  @neo.delete_relationship(rel1)                             # Delete a relationship

  @neo.reset_relationship_properties(rel1, {"age" => 31})    # Reset a relationship's properties
  @neo.set_relationship_properties(rel1, {"weight" => 200})  # Set a relationship's properties
  @neo.get_relationship_properties(rel1)                     # Get just the relationship properties
  @neo.get_relationship_properties(rel1, ["since","met"])    # Get some of the relationship properties
  @neo.remove_relationship_properties(rel1)                  # Remove all properties of a relationship
  @neo.remove_relationship_properties(rel1, "since")         # Remove one property of a relationship
  @neo.remove_relationship_properties(rel1, ["since","met"]) # Remove multiple properties of a relationship

  @neo.list_indexes                                          # doesn't really seam to do what the api says it does
  @neo.add_to_index(key, value, node1)                       # adds a node to an index with the given key/value pair
  @neo.remove_from_index(key, value, node1)                  # removes a node to an index with the given key/value pair
  @neo.get_index(key, value)                                 # gets an index with the given key/value pair

  @neo.get_path(node1, node2, relationships, depth=4, algorithm="shortestPath") # finds the shortest path between two nodes 
  @neo.get_paths(node1, node2, relationships, depth=3, algorithm="allPaths")    # finds all paths between two nodes

  nodes = @neo.traverse(node1,                                              # the node where the traversal starts
                        "nodes",                                            # return_type (can be "nodes", "relationships" or "paths"
                        {"order" => "breadth first",                        # "breadth first" or "depth first" traversal order
                         "uniqueness" => "node global",                     # See Uniqueness in API documentation for options.
                         "relationships" => [{"type"=> "roommates",         # A hash containg a description of the traversal
                                              "direction" => "all"},        # two relationships. <commit_msg>readme changes<commit_after>== Welcome to Neography

Neography is a thin Ruby wrapper to the Neo4j Rest API, for more information:
* {Getting Started with Neo4j Server}[http://wiki.neo4j.org/content/Getting_Started_with_Neo4j_Server]
* {Neo4j Rest API Reference}[http://components.neo4j.org/neo4j-rest/]

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

=== Installation

  gem install 'neography'

After that, in your ruby script, do

  require 'rubygems'
  require 'neography'

in order to access the functionality.
=== Dependencies

  for use:
  json
  httparty 

  for development:
  rspec 
  net-http-spy 
  fakeweb 

==== Rails

Just add gem 'neography' to your Gemfile and run bundle install

=== Documentation

A thin ruby wrapper Neography::Rest which tries to mirror the Neo4j Rest API and returns JSON or Nil:

  #                            protocol,  server,        port,  log_file,           log_enabled
  @neo = Neography::Rest.new ('http://', '192.168.10.1', 7479, 'log/neography.log', true)

Default Parameters are:   

  @neo = Neography::Rest.new ('http://', 'localhost', 7474, '/neography.log', false)

To Use:

  @neo = Neography::Rest.new 

  @neo.get_root                                              # Get the root node
  node1 = @neo.create_node                                   # Create an empty node
  node2 = @neo.create_node("age" => 31, "name" => "Max")     # Create a node with some properties
  @neo.get_node(node2)                                       # Get a node and its properties
  @neo.delete_node(node2)                                    # Delete an unrelated node
  @neo.delete_node!(node2)                                   # Delete a node and all its relationships

  @neo.reset_node_properties(node1, {"age" => 31})           # Reset a node's properties
  @neo.set_node_properties(node1, {"weight" => 200})         # Set a node's properties
  @neo.get_node_properties(node1)                            # Get just the node properties
  @neo.get_node_properties(node1, ["weight","age"])          # Get some of the node properties
  @neo.remove_node_properties(node1)                         # Remove all properties of a node
  @neo.remove_node_properties(node1, "weight")               # Remove one property of a node
  @neo.remove_node_properties(node1, ["weight","age"])       # Remove multiple properties of a node

  rel1 = @neo.create_relationship("friends", node1, node2)   # Create a relationship between node1 and node2
  @neo.get_node_relationships(node1)                         # Get all relationships
  @neo.get_node_relationships(node1, "in")                   # Get only incoming relationships
  @neo.get_node_relationships(node1, "all", "enemies")       # Get all relationships of type enemies
  @neo.get_node_relationships(node1, "in", "enemies")        # Get only incoming relationships of type enemies
  @neo.delete_relationship(rel1)                             # Delete a relationship

  @neo.reset_relationship_properties(rel1, {"age" => 31})    # Reset a relationship's properties
  @neo.set_relationship_properties(rel1, {"weight" => 200})  # Set a relationship's properties
  @neo.get_relationship_properties(rel1)                     # Get just the relationship properties
  @neo.get_relationship_properties(rel1, ["since","met"])    # Get some of the relationship properties
  @neo.remove_relationship_properties(rel1)                  # Remove all properties of a relationship
  @neo.remove_relationship_properties(rel1, "since")         # Remove one property of a relationship
  @neo.remove_relationship_properties(rel1, ["since","met"]) # Remove multiple properties of a relationship

  @neo.list_indexes                                          # doesn't really seam to do what the api says it does
  @neo.add_to_index(key, value, node1)                       # adds a node to an index with the given key/value pair
  @neo.remove_from_index(key, value, node1)                  # removes a node to an index with the given key/value pair
  @neo.get_index(key, value)                                 # gets an index with the given key/value pair

  @neo.get_path(node1, node2, relationships, depth=4, algorithm="shortestPath") # finds the shortest path between two nodes 
  @neo.get_paths(node1, node2, relationships, depth=3, algorithm="allPaths")    # finds all paths between two nodes

  nodes = @neo.traverse(node1,                                              # the node where the traversal starts
                        "nodes",                                            # return_type "nodes", "relationships" or "paths"
                        {"order" => "breadth first",                        # "breadth first" or "depth first" traversal order
                         "uniqueness" => "node global",                     # See Uniqueness in API documentation for options.
                         "relationships" => [{"type"=> "roommates",         # A hash containg a description of the traversal
                                              "direction" => "all"},        # two relationships. 
{'fraction_non_alphanumeric': 0.09215743158301905, 'fraction_numerical': 0.01508558166521613, 'mean_word_length': 2.2542479546884833, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 36, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4569956', 'n_tokens_mistral': 2889, 'n_tokens_neox': 2688, 'n_words': 897}