cayley 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 793eed313948db158c0686987ee9309a9f9b94db
4
- data.tar.gz: f3f73cf8f68ec5b912e0c4f44cc731ee3b740e2a
3
+ metadata.gz: 6edc2d8561567249b938a90c78155d8a0cb22129
4
+ data.tar.gz: f0b335b5931de3997973f62ca86c8e1c8a6b89e3
5
5
  SHA512:
6
- metadata.gz: d923514bf7c0923317505b37f72d2cc55f193b2da5bdea3e4d169a429d0636553d6002e206f3585b47f0d07519518d5de7e8b5408476827288695d1aaea271f0
7
- data.tar.gz: a30a1142bb6ca416ba802f38ba01a5f11c8020e53236bce64ad61626f6d8773af1b0bdb71250aa50fdc065ad6739629d58cea6a01f3a8bfe5ed436f3ca755c00
6
+ metadata.gz: c46b590a9fe0a3f43d3f950e738df166bc402cacb8266f2baf59731bf099fb1f390a2ff397f2d7bcb0759b2d146176c5d222f88bb6578e5895d7dda157fa72f9
7
+ data.tar.gz: 567016c5b338504a7bd0b07887a8459d9a0c5c0f4add42278d2d9ea74baa93a8e42d9e89f363f86716bda44c3408568bff541f12c124b462553bd7ea5bb00535
data/README.md CHANGED
@@ -18,7 +18,7 @@ Start your Cayley
18
18
 
19
19
  ```bash
20
20
  # example using 30kmoviedata from cayley's repository
21
- ./cayley http --dbpath=30kmoviedata.nt
21
+ ./cayley http --dbpath=30kmoviedata.nq.gz
22
22
  ```
23
23
 
24
24
  You can use methods from
@@ -41,7 +41,7 @@ Then using **30kmovies.nt** db from cayley's repository you can do this
41
41
  ```ruby
42
42
  graph.vertex.get_limit(5)
43
43
 
44
- graph.vertex('Humphrey Bogart').lll
44
+ graph.vertex('Humphrey Bogart').all
45
45
 
46
46
  graph.v('Humphrey Bogart').all
47
47
 
@@ -49,7 +49,7 @@ graph.v('Humphrey Bogart').in('name').all
49
49
 
50
50
  graph.v('Casablanca').in('name').all
51
51
 
52
- graph.v().has('name', 'Casablanca').all
52
+ graph.v.has('name', 'Casablanca').all
53
53
  ```
54
54
 
55
55
  You can also use morphism
@@ -3,7 +3,6 @@ module Cayley
3
3
  class Graph
4
4
  API_PATH = '/api/v1/query/gremlin'
5
5
 
6
-
7
6
  def initialize params
8
7
  @host = params[:host] || 'localhost'
9
8
  @port = params[:port] || 64210
@@ -7,6 +7,7 @@ module Cayley
7
7
  :out, :in, :both, :is, :has, # basic
8
8
  :tag, :back, :save, # tags
9
9
  :intersect, :union, # joining
10
+ :and, :or, # joining aliases
10
11
  ]
11
12
 
12
13
  def self.vertex graph, *args
@@ -19,14 +20,15 @@ module Cayley
19
20
  Path.new(graph)
20
21
  end
21
22
 
22
- def initialize graph=nil
23
+ def initialize graph=nil, calls=[]
23
24
  @graph = graph
24
- @calls = []
25
+ @calls = calls
25
26
  end
26
27
 
27
28
  def method_missing name, *args
28
29
  return super unless METHODS.include?(name)
29
- add(name, *args)
30
+ path = Path.new(@graph, @calls.dup)
31
+ path.add(name, *args)
30
32
  end
31
33
 
32
34
  def add name, *args
@@ -35,22 +37,23 @@ module Cayley
35
37
  end
36
38
 
37
39
  def follow path
38
- path.calls.each { |c| @calls << c }
39
- self
40
+ Path.new(@graph, @calls.dup + path.calls)
40
41
  end
41
42
 
42
43
  def + path
43
- clone.follow(path)
44
+ follow(path)
44
45
  end
45
46
 
46
47
  def all
47
- add(:all)
48
- @graph.perform(self)
48
+ copy.add(:all).perform
49
49
  end
50
50
 
51
51
  def get_limit limit
52
- add(:get_limit, limit)
53
- @graph.perform(self)
52
+ copy.add(:get_limit, limit).perform
53
+ end
54
+
55
+ def limit l
56
+ get_limit(l)
54
57
  end
55
58
 
56
59
  def construct
@@ -61,6 +64,14 @@ module Cayley
61
64
  end
62
65
  'graph.' + calls.join('.')
63
66
  end
67
+
68
+ def perform
69
+ @graph.perform(self)
70
+ end
71
+
72
+ def copy
73
+ Path.new(@graph, @calls.dup)
74
+ end
64
75
  end
65
76
 
66
77
  end
@@ -1,3 +1,3 @@
1
1
  module Cayley
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cayley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rene Klacan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-20 00:00:00.000000000 Z
11
+ date: 2014-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '3.1'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '3.1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec-mocks
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: '3.0'
89
+ version: '3.1'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ~>
95
95
  - !ruby/object:Gem::Version
96
- version: '3.0'
96
+ version: '3.1'
97
97
  description: Ruby library for working with Google's Cayley graph database
98
98
  email: rene@klacan.sk
99
99
  executables: []