<commit_before># Seraph.js

A terse & familiar binding to the [Neo4j](http://neo4j.org/) REST API that is 
idiomatic to [node.js](http://nodejs.org/).

## Quick Example

```javascript
var db = require("seraph").db("http://localhost:7474");

db.save({ name: "Test-Man", age: 40 }, function(err, node) {
  if (err) throw err;
  console.log("Test-Man inserted.");

  db.delete(node, function(err) {
    if (err) throw err;
    console.log("Test-Man away!");
  });
});
```

## Documentation

<a name="seraph.db_list" />
### Generic Operations

* [query](#query) - perform a cypher query and parse the results
* [rawQuery](#rawQuery) - perform a cypher query and return unparsed results
* ~~[traversal](#traversal) - perform a traversal~~

### API Communication Operations

* [operation](#operation) - create a representation of a REST API call
* [call](#call) - take an operation and call it
* ~~[batch](#batch) - perform multiple operations atomically~~

### Node Operations
* [save (node.save)](#node.save) - create or update a node
* [read (node.read)](#node.read) - read a node
* [find (node.find)](#node.find) - find a node using a predicate
* [delete (node.delete)](#node.delete) - delete a node
* [relate (node.relate)](#node.relate) - relate two nodes
* [relationships (node.relationships)](#node.relationships) - read the 
  relationships of a node
* [index (node.index)](#node.index) - add a node to an index

### Relationship Operations
* [rel.create](#rel.create) - create a relationship
* [rel.update](#rel.update) - update the properties of a relationship
* [rel.read](#rel.read) - read a relationship
* [rel.delete](#rel.delete) - delete a relationship

### Index Operations
* [index.create](#index.create) - create an index
* [index.add](#index.add) - add a nodes/rels to an index
* [index.read](#index.read) - read nodes/rels from an index
* [index.remove](#index.remove) - remove nodes/rels from an index
* [index.delete](#index.delete) - delete an index

## Compatibility

Seraph has been tested with Neo4j 1.8. As we progress in development, we will
begin adding some legacy support for the more recent versions.

## Testing

To test Seraph, download Neo4j and extract it in the seraph directory. Rename
the neo4j folder to `db`. Then:

    npm test

or, if you have started the test instance yourself and don't want the tests to
restart and clean the server every time:

    npm run-script quick-test

## Generic Operations

<a name="query" /><a name="rawQuery"/>
### query(query, [params,] callback), rawQuery(query, [params,] callback)

`rawQuery` performs a cypher query and returns the results directly from the
REST API.  
`query` performs a cypher query and map the columns and results together.

If you're doing queries on very large sets of data, it may be wiser to use
`rawQuery` and deal with neo4j's results directly.

__Arguments__

* query - Cypher query as a format string.
* params (optional, default=`{}`). Replace `{key}` parts in query string.  See 
  cypher documentation for details.
* callback - (err, result).  Result is an array of objects.

__Example__

Given database:

```javascript
{ name: 'Jon', age: 23, id: 1 }
{ name: 'Neil', age: 60, id: 2 }
{ name: 'Katie', age: 29, id: 3 }
// 1 --knows--> 2
// 1 --knows--> 3
```

Return all people Jon knows:

```javascript
var cypher = "START x = node({id}) "
           + "MATCH x -[r]-> n "
           + "RETURN n "
           + "ORDER BY n.name";

db.query(cypher, {id: 1}, function(err, result) {
  if (err) throw err;
  assert.deepEqual(result, [
    { name: 'Katie', age: 29, id: 3 },
    { name: 'Neil', age: 60, id: 2 }
  ]);
};

db.rawQuery(cypher, {id: 3}, function(err, result) {
  if (err) throw err;
  // result contains the raw response from neo4j's rest API. See
  // http://docs.neo4j.org/chunked/milestone/rest-api-cypher.html
  // for more info
})
```

__Note__: if you're performing large queries it may be advantageous to use
`queryRaw`, since `query` attempts to infer whole nodes and relationships that
are returned (in order to transform them into a nicer format).

---------------------------------------<commit_msg>removed duplicate note text for rawQuery<commit_after># Seraph.js

A terse & familiar binding to the [Neo4j](http://neo4j.org/) REST API that is 
idiomatic to [node.js](http://nodejs.org/).

## Quick Example

```javascript
var db = require("seraph").db("http://localhost:7474");

db.save({ name: "Test-Man", age: 40 }, function(err, node) {
  if (err) throw err;
  console.log("Test-Man inserted.");

  db.delete(node, function(err) {
    if (err) throw err;
    console.log("Test-Man away!");
  });
});
```

## Documentation

<a name="seraph.db_list" />
### Generic Operations

* [query](#query) - perform a cypher query and parse the results
* [rawQuery](#rawQuery) - perform a cypher query and return unparsed results
* ~~[traversal](#traversal) - perform a traversal~~

### API Communication Operations

* [operation](#operation) - create a representation of a REST API call
* [call](#call) - take an operation and call it
* ~~[batch](#batch) - perform multiple operations atomically~~

### Node Operations
* [save (node.save)](#node.save) - create or update a node
* [read (node.read)](#node.read) - read a node
* [find (node.find)](#node.find) - find a node using a predicate
* [delete (node.delete)](#node.delete) - delete a node
* [relate (node.relate)](#node.relate) - relate two nodes
* [relationships (node.relationships)](#node.relationships) - read the 
  relationships of a node
* [index (node.index)](#node.index) - add a node to an index

### Relationship Operations
* [rel.create](#rel.create) - create a relationship
* [rel.update](#rel.update) - update the properties of a relationship
* [rel.read](#rel.read) - read a relationship
* [rel.delete](#rel.delete) - delete a relationship

### Index Operations
* [index.create](#index.create) - create an index
* [index.add](#index.add) - add a nodes/rels to an index
* [index.read](#index.read) - read nodes/rels from an index
* [index.remove](#index.remove) - remove nodes/rels from an index
* [index.delete](#index.delete) - delete an index

## Compatibility

Seraph has been tested with Neo4j 1.8. As we progress in development, we will
begin adding some legacy support for the more recent versions.

## Testing

To test Seraph, download Neo4j and extract it in the seraph directory. Rename
the neo4j folder to `db`. Then:

    npm test

or, if you have started the test instance yourself and don't want the tests to
restart and clean the server every time:

    npm run-script quick-test

## Generic Operations

<a name="query" /><a name="rawQuery"/>
### query(query, [params,] callback), rawQuery(query, [params,] callback)

`rawQuery` performs a cypher query and returns the results directly from the
REST API.  
`query` performs a cypher query and map the columns and results together.

__Note__: if you're performing large queries it may be advantageous to use
`queryRaw`, since `query` attempts to infer whole nodes and relationships that
are returned (in order to transform them into a nicer format).

__Arguments__

* query - Cypher query as a format string.
* params (optional, default=`{}`). Replace `{key}` parts in query string.  See 
  cypher documentation for details.
* callback - (err, result).  Result is an array of objects.

__Example__

Given database:

```javascript
{ name: 'Jon', age: 23, id: 1 }
{ name: 'Neil', age: 60, id: 2 }
{ name: 'Katie', age: 29, id: 3 }
// 1 --knows--> 2
// 1 --knows--> 3
```

Return all people Jon knows:

```javascript
var cypher = "START x = node({id}) "
           + "MATCH x -[r]-> n "
           + "RETURN n "
           + "ORDER BY n.name";

db.query(cypher, {id: 1}, function(err, result) {
  if (err) throw err;
  assert.deepEqual(result, [
    { name: 'Katie', age: 29, id: 3 },
    { name: 'Neil', age: 60, id: 2 }
  ]);
};

db.rawQuery(cypher, {id: 3}, function(err, result) {
  if (err) throw err;
  // result contains the raw response from neo4j's rest API. See
  // http://docs.neo4j.org/chunked/milestone/rest-api-cypher.html
  // for more info
})
```

---------------------------------------
{'fraction_non_alphanumeric': 0.15256315918567573, 'fraction_numerical': 0.008952661270542065, 'mean_word_length': 3.662664379645512, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6376674', 'n_tokens_mistral': 2710, 'n_tokens_neox': 2495, 'n_words': 948}