neo4j-cypher 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +15 -0
- data/README.rdoc +71 -0
- data/lib/neo4j-cypher.rb +47 -0
- data/lib/neo4j-cypher/argument.rb +39 -0
- data/lib/neo4j-cypher/clause.rb +76 -0
- data/lib/neo4j-cypher/clause_list.rb +101 -0
- data/lib/neo4j-cypher/context.rb +411 -0
- data/lib/neo4j-cypher/create.rb +99 -0
- data/lib/neo4j-cypher/match.rb +343 -0
- data/lib/neo4j-cypher/mixins.rb +43 -0
- data/lib/neo4j-cypher/node_var.rb +65 -0
- data/lib/neo4j-cypher/operator.rb +130 -0
- data/lib/neo4j-cypher/predicate.rb +64 -0
- data/lib/neo4j-cypher/property.rb +106 -0
- data/lib/neo4j-cypher/rel_var.rb +128 -0
- data/lib/neo4j-cypher/result.rb +43 -0
- data/lib/neo4j-cypher/result_wrapper.rb +47 -0
- data/lib/neo4j-cypher/return.rb +124 -0
- data/lib/neo4j-cypher/root.rb +182 -0
- data/lib/neo4j-cypher/start.rb +88 -0
- data/lib/neo4j-cypher/version.rb +5 -0
- data/lib/neo4j-cypher/where.rb +16 -0
- data/lib/neo4j-cypher/with.rb +41 -0
- data/neo4j-cypher.gemspec +26 -0
- metadata +81 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
module Neo4j
|
2
|
+
module Cypher
|
3
|
+
class Where
|
4
|
+
include Clause
|
5
|
+
|
6
|
+
def initialize(clause_list, where_statement = nil)
|
7
|
+
super(clause_list, :where)
|
8
|
+
@where_statement = where_statement
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_cypher
|
12
|
+
@where_statement.to_s
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Neo4j
|
2
|
+
module Cypher
|
3
|
+
class With
|
4
|
+
include Clause
|
5
|
+
|
6
|
+
attr_reader :arg_list
|
7
|
+
|
8
|
+
def initialize(clause_list, where_or_match, *args, &cypher_dsl)
|
9
|
+
super(clause_list, :with, EvalContext)
|
10
|
+
|
11
|
+
clause_list.push
|
12
|
+
|
13
|
+
@args = create_clause_args_for(args)
|
14
|
+
@arg_list = @args.map { |a| a.return_value }.join(',')
|
15
|
+
@where_or_match = where_or_match
|
16
|
+
arg_exec = @args.map(&:eval_context)
|
17
|
+
|
18
|
+
RootClause::EvalContext.new(self).instance_exec(*arg_exec, &cypher_dsl)
|
19
|
+
|
20
|
+
@body = "#{@where_or_match.to_s.upcase} #{clause_list.to_cypher}"
|
21
|
+
clause_list.pop
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_cypher
|
25
|
+
@body ? "#{@arg_list} #{@body}" : @arg_list
|
26
|
+
end
|
27
|
+
|
28
|
+
class EvalContext
|
29
|
+
include Context
|
30
|
+
include Alias
|
31
|
+
include ReturnOrder
|
32
|
+
include Aggregate
|
33
|
+
include Comparable
|
34
|
+
include Returnable
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
lib = File.expand_path('../lib/', __FILE__)
|
2
|
+
$:.unshift lib unless $:.include?(lib)
|
3
|
+
|
4
|
+
require 'neo4j-cypher/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "neo4j-cypher"
|
8
|
+
s.version = Neo4j::Cypher::VERSION
|
9
|
+
s.required_ruby_version = ">= 1.8.7"
|
10
|
+
|
11
|
+
s.authors = "Andreas Ronge"
|
12
|
+
s.email = 'andreas.ronge@gmail.com'
|
13
|
+
s.homepage = "http://github.com/andreasronge/neo4j-cypher/tree"
|
14
|
+
s.rubyforge_project = 'neo4j-cypher'
|
15
|
+
s.summary = "A Ruby DSL for Cypher - the Neo4j Graph Query Language"
|
16
|
+
s.description = <<-EOF
|
17
|
+
This gem is used in the JRuby neo4j gem but should work on any Ruby implementation since it simply
|
18
|
+
translate a Ruby block (the dsl) to a cypher string.
|
19
|
+
EOF
|
20
|
+
|
21
|
+
s.require_path = 'lib'
|
22
|
+
s.files = Dir.glob("{bin,lib,config}/**/*") + %w(README.rdoc Gemfile neo4j-cypher.gemspec)
|
23
|
+
s.has_rdoc = true
|
24
|
+
s.extra_rdoc_files = %w( README.rdoc )
|
25
|
+
s.rdoc_options = ["--quiet", "--title", "Neo4j::Cypher", "--line-numbers", "--main", "README.rdoc", "--inline-source"]
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: neo4j-cypher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.rc1
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Andreas Ronge
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-20 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! 'This gem is used in the JRuby neo4j gem but should work on any Ruby
|
15
|
+
implementation since it simply
|
16
|
+
|
17
|
+
translate a Ruby block (the dsl) to a cypher string.
|
18
|
+
|
19
|
+
'
|
20
|
+
email: andreas.ronge@gmail.com
|
21
|
+
executables: []
|
22
|
+
extensions: []
|
23
|
+
extra_rdoc_files:
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- lib/neo4j-cypher/argument.rb
|
27
|
+
- lib/neo4j-cypher/clause.rb
|
28
|
+
- lib/neo4j-cypher/clause_list.rb
|
29
|
+
- lib/neo4j-cypher/context.rb
|
30
|
+
- lib/neo4j-cypher/create.rb
|
31
|
+
- lib/neo4j-cypher/match.rb
|
32
|
+
- lib/neo4j-cypher/mixins.rb
|
33
|
+
- lib/neo4j-cypher/node_var.rb
|
34
|
+
- lib/neo4j-cypher/operator.rb
|
35
|
+
- lib/neo4j-cypher/predicate.rb
|
36
|
+
- lib/neo4j-cypher/property.rb
|
37
|
+
- lib/neo4j-cypher/rel_var.rb
|
38
|
+
- lib/neo4j-cypher/result.rb
|
39
|
+
- lib/neo4j-cypher/result_wrapper.rb
|
40
|
+
- lib/neo4j-cypher/return.rb
|
41
|
+
- lib/neo4j-cypher/root.rb
|
42
|
+
- lib/neo4j-cypher/start.rb
|
43
|
+
- lib/neo4j-cypher/version.rb
|
44
|
+
- lib/neo4j-cypher/where.rb
|
45
|
+
- lib/neo4j-cypher/with.rb
|
46
|
+
- lib/neo4j-cypher.rb
|
47
|
+
- README.rdoc
|
48
|
+
- Gemfile
|
49
|
+
- neo4j-cypher.gemspec
|
50
|
+
homepage: http://github.com/andreasronge/neo4j-cypher/tree
|
51
|
+
licenses: []
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options:
|
54
|
+
- --quiet
|
55
|
+
- --title
|
56
|
+
- Neo4j::Cypher
|
57
|
+
- --line-numbers
|
58
|
+
- --main
|
59
|
+
- README.rdoc
|
60
|
+
- --inline-source
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.8.7
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>'
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.3.1
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project: neo4j-cypher
|
77
|
+
rubygems_version: 1.8.24
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: A Ruby DSL for Cypher - the Neo4j Graph Query Language
|
81
|
+
test_files: []
|