gremlin 3.7.5 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/doc/AnonymousTraversalSource.html +82 -20
- package/doc/Authenticator.html +2 -2
- package/doc/Bytecode.html +2 -2
- package/doc/CardinalityValue.html +6 -6
- package/doc/Client.html +2 -2
- package/doc/Connection.html +5 -5
- package/doc/DriverRemoteConnection.html +2 -2
- package/doc/EdgeLabelVerificationStrategy.html +3 -17
- package/doc/Graph.html +2 -2
- package/doc/GraphSON2Reader.html +2 -2
- package/doc/GraphSON2Writer.html +2 -2
- package/doc/GraphSON3Reader.html +2 -2
- package/doc/GraphSON3Writer.html +2 -2
- package/doc/GraphTraversal.html +667 -333
- package/doc/GraphTraversalSource.html +23 -174
- package/doc/HaltedTraverserStrategy.html +2 -2
- package/doc/MatchAlgorithmStrategy.html +3 -3
- package/doc/P.html +147 -2
- package/doc/PartitionStrategy.html +3 -3
- package/doc/Path.html +3 -3
- package/doc/PlainTextSaslAuthenticator.html +2 -2
- package/doc/ProductiveByStrategy.html +7 -37
- package/doc/RemoteConnection.html +2 -2
- package/doc/RemoteStrategy.html +2 -2
- package/doc/RemoteTraversal.html +2 -2
- package/doc/ReservedKeysVerificationStrategy.html +3 -21
- package/doc/ResponseError.html +2 -2
- package/doc/ResultSet.html +2 -2
- package/doc/SaslAuthenticator.html +2 -2
- package/doc/SaslMechanismBase.html +2 -2
- package/doc/SaslMechanismPlain.html +2 -2
- package/doc/SeedStrategy.html +3 -3
- package/doc/SubgraphStrategy.html +3 -3
- package/doc/TextP.html +12 -12
- package/doc/Transaction.html +2 -2
- package/doc/Translator.html +2 -2
- package/doc/TraversalStrategies.html +2 -2
- package/doc/TraversalStrategy.html +2 -2
- package/doc/TypeSerializer.html +2 -2
- package/doc/driver_auth_authenticator.js.html +2 -2
- package/doc/driver_auth_mechanisms_sasl-mechanism-base.js.html +2 -2
- package/doc/driver_auth_mechanisms_sasl-mechanism-plain.js.html +2 -2
- package/doc/driver_auth_plain-text-sasl-authenticator.js.html +2 -2
- package/doc/driver_auth_sasl-authenticator.js.html +2 -2
- package/doc/driver_client.js.html +2 -2
- package/doc/driver_connection.js.html +9 -6
- package/doc/driver_driver-remote-connection.js.html +2 -2
- package/doc/driver_remote-connection.js.html +2 -2
- package/doc/driver_response-error.js.html +2 -2
- package/doc/driver_result-set.js.html +2 -2
- package/doc/global.html +91 -3
- package/doc/index.html +3 -3
- package/doc/module.exports.html +2 -2
- package/doc/process_anonymous-traversal.js.html +28 -18
- package/doc/process_bytecode.js.html +2 -2
- package/doc/process_graph-traversal.js.html +35 -34
- package/doc/process_transaction.js.html +2 -2
- package/doc/process_translator.js.html +2 -2
- package/doc/process_traversal-strategy.js.html +95 -33
- package/doc/process_traversal.js.html +21 -4
- package/doc/structure_graph.js.html +11 -21
- package/doc/structure_io_binary_internals_DataType.js.html +3 -2
- package/doc/structure_io_binary_internals_GraphBinaryReader.js.html +2 -2
- package/doc/structure_io_binary_internals_GraphBinaryWriter.js.html +2 -2
- package/doc/structure_io_graph-serializer.js.html +5 -3
- package/doc/structure_io_type-serializers.js.html +70 -8
- package/doc/utils.js.html +3 -3
- package/docker-compose.yml +2 -1
- package/lib/driver/connection.js +7 -4
- package/lib/process/anonymous-traversal.js +26 -16
- package/lib/process/graph-traversal.js +33 -32
- package/lib/process/traversal-strategy.js +93 -31
- package/lib/process/traversal.js +19 -2
- package/lib/structure/graph.js +9 -19
- package/lib/structure/io/binary/GraphBinary.js +3 -2
- package/lib/structure/io/binary/internals/AnySerializer.js +3 -0
- package/lib/structure/io/binary/internals/ClassSerializer.js +60 -0
- package/lib/structure/io/binary/internals/DataType.js +1 -0
- package/lib/structure/io/binary/internals/EnumSerializer.js +1 -0
- package/lib/structure/io/binary/internals/NumberSerializationStrategy.js +6 -1
- package/lib/structure/io/binary/internals/OffsetDateTimeSerializer.js +151 -0
- package/lib/structure/io/binary/internals/SetSerializer.js +134 -0
- package/lib/structure/io/binary/internals/TraversalStrategySerializer.js +1 -6
- package/lib/structure/io/graph-serializer.js +3 -1
- package/lib/structure/io/type-serializers.js +68 -6
- package/lib/utils.js +1 -1
- package/package.json +10 -6
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
const { Traversal, cardinality } = require('./traversal');
|
|
26
26
|
const { Transaction } = require('./transaction');
|
|
27
|
-
const remote = require('../driver/remote-connection');
|
|
28
27
|
const Bytecode = require('./bytecode');
|
|
29
28
|
const { TraversalStrategies, VertexProgramStrategy, OptionsStrategy } = require('./traversal-strategy');
|
|
30
29
|
|
|
@@ -46,30 +45,10 @@ class GraphTraversalSource {
|
|
|
46
45
|
this.bytecode = bytecode || new Bytecode();
|
|
47
46
|
this.graphTraversalSourceClass = graphTraversalSourceClass || GraphTraversalSource;
|
|
48
47
|
this.graphTraversalClass = graphTraversalClass || GraphTraversal;
|
|
49
|
-
|
|
50
|
-
// in order to keep the constructor unchanged within 3.5.x we can try to pop the RemoteConnection out of the
|
|
51
|
-
// TraversalStrategies. keeping this unchanged will allow user DSLs to not take a break.
|
|
52
|
-
// TODO: refactor this to be nicer in 3.6.0 when we can take a breaking change
|
|
53
48
|
const strat = traversalStrategies.strategies.find((ts) => ts.fqcn === 'js:RemoteStrategy');
|
|
54
49
|
this.remoteConnection = strat !== undefined ? strat.connection : undefined;
|
|
55
50
|
}
|
|
56
51
|
|
|
57
|
-
/**
|
|
58
|
-
* @param {RemoteConnection} remoteConnection
|
|
59
|
-
* @returns {GraphTraversalSource}
|
|
60
|
-
*/
|
|
61
|
-
withRemote(remoteConnection) {
|
|
62
|
-
const traversalStrategy = new TraversalStrategies(this.traversalStrategies);
|
|
63
|
-
traversalStrategy.addStrategy(new remote.RemoteStrategy(remoteConnection));
|
|
64
|
-
return new this.graphTraversalSourceClass(
|
|
65
|
-
this.graph,
|
|
66
|
-
traversalStrategy,
|
|
67
|
-
new Bytecode(this.bytecode),
|
|
68
|
-
this.graphTraversalSourceClass,
|
|
69
|
-
this.graphTraversalClass,
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
52
|
/**
|
|
74
53
|
* Spawn a new <code>Transaction</code> object that can then start and stop a transaction.
|
|
75
54
|
* @returns {Transaction}
|
|
@@ -454,6 +433,16 @@ class GraphTraversal extends Traversal {
|
|
|
454
433
|
return this;
|
|
455
434
|
}
|
|
456
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Graph traversal asBool method.
|
|
438
|
+
* @param {...Object} args
|
|
439
|
+
* @returns {GraphTraversal}
|
|
440
|
+
*/
|
|
441
|
+
asBool(...args) {
|
|
442
|
+
this.bytecode.addStep('asBool', args);
|
|
443
|
+
return this;
|
|
444
|
+
}
|
|
445
|
+
|
|
457
446
|
/**
|
|
458
447
|
* Graph traversal asDate method.
|
|
459
448
|
* @param {...Object} args
|
|
@@ -464,6 +453,16 @@ class GraphTraversal extends Traversal {
|
|
|
464
453
|
return this;
|
|
465
454
|
}
|
|
466
455
|
|
|
456
|
+
/**
|
|
457
|
+
* Graph traversal asNumber method.
|
|
458
|
+
* @param {...Object} args
|
|
459
|
+
* @returns {GraphTraversal}
|
|
460
|
+
*/
|
|
461
|
+
asNumber(...args) {
|
|
462
|
+
this.bytecode.addStep('asNumber', args);
|
|
463
|
+
return this;
|
|
464
|
+
}
|
|
465
|
+
|
|
467
466
|
/**
|
|
468
467
|
* Graph traversal asString method.
|
|
469
468
|
* @param {...Object} args
|
|
@@ -693,6 +692,16 @@ class GraphTraversal extends Traversal {
|
|
|
693
692
|
return this;
|
|
694
693
|
}
|
|
695
694
|
|
|
695
|
+
/**
|
|
696
|
+
* Graph traversal discard method.
|
|
697
|
+
* @param {...Object} args
|
|
698
|
+
* @returns {GraphTraversal}
|
|
699
|
+
*/
|
|
700
|
+
discard(...args) {
|
|
701
|
+
this.bytecode.addStep('discard', args);
|
|
702
|
+
return this;
|
|
703
|
+
}
|
|
704
|
+
|
|
696
705
|
/**
|
|
697
706
|
* Graph traversal disjunct method.
|
|
698
707
|
* @param {...Object} args
|
|
@@ -1472,16 +1481,6 @@ class GraphTraversal extends Traversal {
|
|
|
1472
1481
|
return this;
|
|
1473
1482
|
}
|
|
1474
1483
|
|
|
1475
|
-
/**
|
|
1476
|
-
* Graph traversal store method.
|
|
1477
|
-
* @param {...Object} args
|
|
1478
|
-
* @returns {GraphTraversal}
|
|
1479
|
-
*/
|
|
1480
|
-
store(...args) {
|
|
1481
|
-
this.bytecode.addStep('store', args);
|
|
1482
|
-
return this;
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
1484
|
/**
|
|
1486
1485
|
* Graph traversal subgraph method.
|
|
1487
1486
|
* @param {...Object} args
|
|
@@ -1761,7 +1760,9 @@ const statics = {
|
|
|
1761
1760
|
and: (...args) => callOnEmptyTraversal('and', args),
|
|
1762
1761
|
any: (...args) => callOnEmptyTraversal('any', args),
|
|
1763
1762
|
as: (...args) => callOnEmptyTraversal('as', args),
|
|
1763
|
+
asBool: (...args) => callOnEmptyTraversal('asBool', args),
|
|
1764
1764
|
asDate: (...args) => callOnEmptyTraversal('asDate', args),
|
|
1765
|
+
asNumber: (...args) => callOnEmptyTraversal('asNumber', args),
|
|
1765
1766
|
asString: (...args) => callOnEmptyTraversal('asString', args),
|
|
1766
1767
|
barrier: (...args) => callOnEmptyTraversal('barrier', args),
|
|
1767
1768
|
both: (...args) => callOnEmptyTraversal('both', args),
|
|
@@ -1783,6 +1784,7 @@ const statics = {
|
|
|
1783
1784
|
dateDiff: (...args) => callOnEmptyTraversal('dateDiff', args),
|
|
1784
1785
|
dedup: (...args) => callOnEmptyTraversal('dedup', args),
|
|
1785
1786
|
difference: (...args) => callOnEmptyTraversal('difference', args),
|
|
1787
|
+
discard: (...args) => callOnEmptyTraversal('discard', args),
|
|
1786
1788
|
disjunct: (...args) => callOnEmptyTraversal('disjunct', args),
|
|
1787
1789
|
drop: (...args) => callOnEmptyTraversal('drop', args),
|
|
1788
1790
|
element: (...args) => callOnEmptyTraversal('element', args),
|
|
@@ -1853,7 +1855,6 @@ const statics = {
|
|
|
1853
1855
|
simplePath: (...args) => callOnEmptyTraversal('simplePath', args),
|
|
1854
1856
|
skip: (...args) => callOnEmptyTraversal('skip', args),
|
|
1855
1857
|
split: (...args) => callOnEmptyTraversal('split', args),
|
|
1856
|
-
store: (...args) => callOnEmptyTraversal('store', args),
|
|
1857
1858
|
subgraph: (...args) => callOnEmptyTraversal('subgraph', args),
|
|
1858
1859
|
substring: (...args) => callOnEmptyTraversal('substring', args),
|
|
1859
1860
|
sum: (...args) => callOnEmptyTraversal('sum', args),
|
|
@@ -102,7 +102,7 @@ class HaltedTraverserStrategy extends TraversalStrategy {
|
|
|
102
102
|
/**
|
|
103
103
|
* @param {String} haltedTraverserFactory full qualified class name in Java of a {@code HaltedTraverserFactory} implementation
|
|
104
104
|
*/
|
|
105
|
-
constructor(haltedTraverserFactory) {
|
|
105
|
+
constructor({ haltedTraverserFactory } = {}) {
|
|
106
106
|
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy');
|
|
107
107
|
if (haltedTraverserFactory !== undefined) {
|
|
108
108
|
this.configuration['haltedTraverserFactory'] = haltedTraverserFactory;
|
|
@@ -110,9 +110,20 @@ class HaltedTraverserStrategy extends TraversalStrategy {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
class MessagePassingReductionStrategy extends TraversalStrategy {
|
|
114
|
+
constructor() {
|
|
115
|
+
super(
|
|
116
|
+
'org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.MessagePassingReductionStrategy',
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
113
121
|
class OptionsStrategy extends TraversalStrategy {
|
|
114
122
|
constructor(options) {
|
|
115
|
-
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.OptionsStrategy'
|
|
123
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.OptionsStrategy');
|
|
124
|
+
if (options !== undefined) {
|
|
125
|
+
this.configuration = options;
|
|
126
|
+
}
|
|
116
127
|
}
|
|
117
128
|
}
|
|
118
129
|
|
|
@@ -129,6 +140,24 @@ class PartitionStrategy extends TraversalStrategy {
|
|
|
129
140
|
}
|
|
130
141
|
}
|
|
131
142
|
|
|
143
|
+
class ProfileStrategy extends TraversalStrategy {
|
|
144
|
+
constructor() {
|
|
145
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
class SeedStrategy extends TraversalStrategy {
|
|
150
|
+
/**
|
|
151
|
+
* @param {Object} [options]
|
|
152
|
+
* @param {number} [options.seed] the seed to provide to the random number generator for the traversal
|
|
153
|
+
*/
|
|
154
|
+
constructor(options) {
|
|
155
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SeedStrategy', {
|
|
156
|
+
seed: options?.seed,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
132
161
|
class SubgraphStrategy extends TraversalStrategy {
|
|
133
162
|
/**
|
|
134
163
|
* @param {Object} [options]
|
|
@@ -151,13 +180,9 @@ class SubgraphStrategy extends TraversalStrategy {
|
|
|
151
180
|
}
|
|
152
181
|
}
|
|
153
182
|
|
|
154
|
-
class
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
* @param {Array<String>} [options.productiveKeys] set of keys that will always be productive
|
|
158
|
-
*/
|
|
159
|
-
constructor(options) {
|
|
160
|
-
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ProductiveByStrategy', options);
|
|
183
|
+
class ReferenceElementStrategy extends TraversalStrategy {
|
|
184
|
+
constructor() {
|
|
185
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ReferenceElementStrategy');
|
|
161
186
|
}
|
|
162
187
|
}
|
|
163
188
|
|
|
@@ -171,7 +196,7 @@ class MatchAlgorithmStrategy extends TraversalStrategy {
|
|
|
171
196
|
/**
|
|
172
197
|
* @param matchAlgorithm
|
|
173
198
|
*/
|
|
174
|
-
constructor(matchAlgorithm) {
|
|
199
|
+
constructor({ matchAlgorithm } = {}) {
|
|
175
200
|
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.MatchAlgorithmStrategy');
|
|
176
201
|
if (matchAlgorithm !== undefined) {
|
|
177
202
|
this.configuration['matchAlgorithm'] = matchAlgorithm;
|
|
@@ -179,12 +204,24 @@ class MatchAlgorithmStrategy extends TraversalStrategy {
|
|
|
179
204
|
}
|
|
180
205
|
}
|
|
181
206
|
|
|
207
|
+
class ComputerFinalizationStrategy extends TraversalStrategy {
|
|
208
|
+
constructor() {
|
|
209
|
+
super('org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.finalization.ComputerFinalizationStrategy');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
182
213
|
class AdjacentToIncidentStrategy extends TraversalStrategy {
|
|
183
214
|
constructor() {
|
|
184
215
|
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.AdjacentToIncidentStrategy');
|
|
185
216
|
}
|
|
186
217
|
}
|
|
187
218
|
|
|
219
|
+
class ByModulatorOptimizationStrategy extends TraversalStrategy {
|
|
220
|
+
constructor() {
|
|
221
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ByModulatorOptimizationStrategy');
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
188
225
|
class FilterRankingStrategy extends TraversalStrategy {
|
|
189
226
|
constructor() {
|
|
190
227
|
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.FilterRankingStrategy');
|
|
@@ -239,6 +276,17 @@ class PathRetractionStrategy extends TraversalStrategy {
|
|
|
239
276
|
}
|
|
240
277
|
}
|
|
241
278
|
|
|
279
|
+
class ProductiveByStrategy extends TraversalStrategy {
|
|
280
|
+
/**
|
|
281
|
+
* @param {Object} [options]
|
|
282
|
+
* @param {Array<String>} productiveKeys set of keys that will always be productive
|
|
283
|
+
*/
|
|
284
|
+
constructor({ productiveKeys = [] } = {}) {
|
|
285
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.ProductiveByStrategy');
|
|
286
|
+
this.configuration['productiveKeys'] = productiveKeys;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
242
290
|
class CountStrategy extends TraversalStrategy {
|
|
243
291
|
constructor() {
|
|
244
292
|
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.CountStrategy');
|
|
@@ -253,7 +301,7 @@ class RepeatUnrollStrategy extends TraversalStrategy {
|
|
|
253
301
|
|
|
254
302
|
class GraphFilterStrategy extends TraversalStrategy {
|
|
255
303
|
constructor() {
|
|
256
|
-
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.GraphFilterStrategy');
|
|
304
|
+
super('org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.GraphFilterStrategy');
|
|
257
305
|
}
|
|
258
306
|
}
|
|
259
307
|
|
|
@@ -263,6 +311,12 @@ class EarlyLimitStrategy extends TraversalStrategy {
|
|
|
263
311
|
}
|
|
264
312
|
}
|
|
265
313
|
|
|
314
|
+
class ComputerVerificationStrategy extends TraversalStrategy {
|
|
315
|
+
constructor() {
|
|
316
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategy');
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
266
320
|
class LambdaRestrictionStrategy extends TraversalStrategy {
|
|
267
321
|
constructor() {
|
|
268
322
|
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.LambdaRestrictionStrategy');
|
|
@@ -280,11 +334,10 @@ class EdgeLabelVerificationStrategy extends TraversalStrategy {
|
|
|
280
334
|
* @param {boolean} logWarnings determines if warnings should be written to the logger when verification fails
|
|
281
335
|
* @param {boolean} throwException determines if exceptions should be thrown when verifications fails
|
|
282
336
|
*/
|
|
283
|
-
constructor(logWarnings = false, throwException = false) {
|
|
284
|
-
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.EdgeLabelVerificationStrategy'
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
});
|
|
337
|
+
constructor({ logWarnings = false, throwException = false } = {}) {
|
|
338
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.EdgeLabelVerificationStrategy');
|
|
339
|
+
this.configuration['logWarnings'] = logWarnings;
|
|
340
|
+
this.configuration['throwException'] = throwException;
|
|
288
341
|
}
|
|
289
342
|
}
|
|
290
343
|
|
|
@@ -294,24 +347,25 @@ class ReservedKeysVerificationStrategy extends TraversalStrategy {
|
|
|
294
347
|
* @param {boolean} throwException determines if exceptions should be thrown when verifications fails
|
|
295
348
|
* @param {Array<String>} keys the list of reserved keys to verify
|
|
296
349
|
*/
|
|
297
|
-
constructor(logWarnings = false, throwException = false, keys = ['id', 'label']) {
|
|
298
|
-
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReservedKeysVerificationStrategy'
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
});
|
|
350
|
+
constructor({ logWarnings = false, throwException = false, keys = ['id', 'label'] } = {}) {
|
|
351
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReservedKeysVerificationStrategy');
|
|
352
|
+
this.configuration['logWarnings'] = logWarnings;
|
|
353
|
+
this.configuration['throwException'] = throwException;
|
|
354
|
+
this.configuration['keys'] = keys;
|
|
303
355
|
}
|
|
304
356
|
}
|
|
305
357
|
|
|
306
|
-
class
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
358
|
+
class VertexProgramRestrictionStrategy extends TraversalStrategy {
|
|
359
|
+
constructor() {
|
|
360
|
+
super(
|
|
361
|
+
'org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.verification.VertexProgramRestrictionStrategy',
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
class StandardVerificationStrategy extends TraversalStrategy {
|
|
367
|
+
constructor() {
|
|
368
|
+
super('org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.StandardVerificationStrategy');
|
|
315
369
|
}
|
|
316
370
|
}
|
|
317
371
|
|
|
@@ -319,11 +373,15 @@ module.exports = {
|
|
|
319
373
|
TraversalStrategies: TraversalStrategies,
|
|
320
374
|
TraversalStrategy: TraversalStrategy,
|
|
321
375
|
// decoration
|
|
376
|
+
ComputerFinalizationStrategy: ComputerFinalizationStrategy,
|
|
322
377
|
ConnectiveStrategy: ConnectiveStrategy,
|
|
323
378
|
ElementIdStrategy: ElementIdStrategy,
|
|
324
379
|
HaltedTraverserStrategy: HaltedTraverserStrategy,
|
|
380
|
+
MessagePassingReductionStrategy: MessagePassingReductionStrategy,
|
|
325
381
|
OptionsStrategy: OptionsStrategy,
|
|
326
382
|
PartitionStrategy: PartitionStrategy,
|
|
383
|
+
ProfileStrategy: ProfileStrategy,
|
|
384
|
+
ReferenceElementStrategy: ReferenceElementStrategy,
|
|
327
385
|
SeedStrategy: SeedStrategy,
|
|
328
386
|
SubgraphStrategy: SubgraphStrategy,
|
|
329
387
|
VertexProgramStrategy: VertexProgramStrategy,
|
|
@@ -331,6 +389,7 @@ module.exports = {
|
|
|
331
389
|
MatchAlgorithmStrategy: MatchAlgorithmStrategy,
|
|
332
390
|
// optimization
|
|
333
391
|
AdjacentToIncidentStrategy: AdjacentToIncidentStrategy,
|
|
392
|
+
ByModulatorOptimizationStrategy: ByModulatorOptimizationStrategy,
|
|
334
393
|
FilterRankingStrategy: FilterRankingStrategy,
|
|
335
394
|
IdentityRemovalStrategy: IdentityRemovalStrategy,
|
|
336
395
|
IncidentToAdjacentStrategy: IncidentToAdjacentStrategy,
|
|
@@ -346,8 +405,11 @@ module.exports = {
|
|
|
346
405
|
GraphFilterStrategy: GraphFilterStrategy,
|
|
347
406
|
EarlyLimitStrategy: EarlyLimitStrategy,
|
|
348
407
|
// verification
|
|
408
|
+
ComputerVerificationStrategy: ComputerVerificationStrategy,
|
|
349
409
|
EdgeLabelVerificationStrategy: EdgeLabelVerificationStrategy,
|
|
350
410
|
LambdaRestrictionStrategy: LambdaRestrictionStrategy,
|
|
351
411
|
ReadOnlyStrategy: ReadOnlyStrategy,
|
|
352
412
|
ReservedKeysVerificationStrategy: ReservedKeysVerificationStrategy,
|
|
413
|
+
StandardVerificationStrategy: StandardVerificationStrategy,
|
|
414
|
+
VertexProgramRestrictionStrategy: VertexProgramRestrictionStrategy,
|
|
353
415
|
};
|
package/lib/process/traversal.js
CHANGED
|
@@ -84,7 +84,7 @@ class Traversal {
|
|
|
84
84
|
* @returns {Promise}
|
|
85
85
|
*/
|
|
86
86
|
iterate() {
|
|
87
|
-
this.bytecode.addStep('
|
|
87
|
+
this.bytecode.addStep('discard');
|
|
88
88
|
return this._applyStrategies().then(() => {
|
|
89
89
|
let it;
|
|
90
90
|
while ((it = this._getNext()) && !it.done) {
|
|
@@ -345,6 +345,11 @@ class P {
|
|
|
345
345
|
return createP('outside', args);
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
/** @param {...Object} args */
|
|
349
|
+
static typeOf(...args) {
|
|
350
|
+
return createP('typeOf', args);
|
|
351
|
+
}
|
|
352
|
+
|
|
348
353
|
/** @param {...Object} args */
|
|
349
354
|
static test(...args) {
|
|
350
355
|
return createP('test', args);
|
|
@@ -487,6 +492,14 @@ function toDirectionEnum(typeName, keys) {
|
|
|
487
492
|
return result;
|
|
488
493
|
}
|
|
489
494
|
|
|
495
|
+
function toGTypeEnum(typeName, keys) {
|
|
496
|
+
const result = {};
|
|
497
|
+
keys.split(' ').forEach((k) => {
|
|
498
|
+
result[k] = new EnumValue(typeName, k.toUpperCase());
|
|
499
|
+
});
|
|
500
|
+
return result;
|
|
501
|
+
}
|
|
502
|
+
|
|
490
503
|
class EnumValue {
|
|
491
504
|
constructor(typeName, elementName) {
|
|
492
505
|
this.typeName = typeName;
|
|
@@ -512,12 +525,16 @@ module.exports = {
|
|
|
512
525
|
column: toEnum('Column', 'keys values'),
|
|
513
526
|
direction: toDirectionEnum('Direction', 'BOTH IN OUT from_ to'),
|
|
514
527
|
dt: toEnum('DT', 'second minute hour day'),
|
|
528
|
+
gType: toGTypeEnum(
|
|
529
|
+
'GType',
|
|
530
|
+
'bigDecimal bigInt binary boolean byte char datetime double duration edge float graph int list long map null number path property set short string tree uuid vertex vproperty',
|
|
531
|
+
),
|
|
515
532
|
graphSONVersion: toEnum('GraphSONVersion', 'V1_0 V2_0 V3_0'),
|
|
516
533
|
gryoVersion: toEnum('GryoVersion', 'V1_0 V3_0'),
|
|
517
534
|
merge: toEnum('Merge', 'onCreate onMatch outV inV'),
|
|
518
535
|
operator: toEnum('Operator', 'addAll and assign div max min minus mult or sum sumLong'),
|
|
519
536
|
order: toEnum('Order', 'asc desc shuffle'),
|
|
520
|
-
pick: toEnum('Pick', 'any none'),
|
|
537
|
+
pick: toEnum('Pick', 'any none unproductive'),
|
|
521
538
|
pop: toEnum('Pop', 'all first last mixed'),
|
|
522
539
|
scope: toEnum('Scope', 'global local'),
|
|
523
540
|
t: toEnum('T', 'id key label value'),
|
package/lib/structure/graph.js
CHANGED
|
@@ -46,9 +46,11 @@ class Graph {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
class Element {
|
|
49
|
-
|
|
49
|
+
// properties are stored as list of property objects
|
|
50
|
+
constructor(id, label, properties = []) {
|
|
50
51
|
this.id = id;
|
|
51
52
|
this.label = label;
|
|
53
|
+
this.properties = properties != null ? properties : [];
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
/**
|
|
@@ -62,9 +64,8 @@ class Element {
|
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
class Vertex extends Element {
|
|
65
|
-
constructor(id, label, properties) {
|
|
66
|
-
super(id, label);
|
|
67
|
-
this.properties = properties;
|
|
67
|
+
constructor(id, label, properties = []) {
|
|
68
|
+
super(id, label, properties);
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
toString() {
|
|
@@ -73,20 +74,10 @@ class Vertex extends Element {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
class Edge extends Element {
|
|
76
|
-
constructor(id, outV, label, inV, properties) {
|
|
77
|
-
super(id, label);
|
|
77
|
+
constructor(id, outV, label, inV, properties = []) {
|
|
78
|
+
super(id, label, properties);
|
|
78
79
|
this.outV = outV;
|
|
79
80
|
this.inV = inV;
|
|
80
|
-
this.properties = {};
|
|
81
|
-
if (properties) {
|
|
82
|
-
if (Array.isArray(properties)) {
|
|
83
|
-
// Handle array of Property objects
|
|
84
|
-
properties.forEach((prop) => (this.properties[prop.key] = prop.value));
|
|
85
|
-
} else {
|
|
86
|
-
// Handle object format as before
|
|
87
|
-
Object.keys(properties).forEach((k) => (this.properties[k] = properties[k].value));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
81
|
}
|
|
91
82
|
|
|
92
83
|
toString() {
|
|
@@ -98,11 +89,10 @@ class Edge extends Element {
|
|
|
98
89
|
}
|
|
99
90
|
|
|
100
91
|
class VertexProperty extends Element {
|
|
101
|
-
constructor(id, label, value, properties) {
|
|
102
|
-
super(id, label);
|
|
92
|
+
constructor(id, label, value, properties = []) {
|
|
93
|
+
super(id, label, properties);
|
|
103
94
|
this.value = value;
|
|
104
95
|
this.key = this.label;
|
|
105
|
-
this.properties = properties;
|
|
106
96
|
}
|
|
107
97
|
|
|
108
98
|
toString() {
|
|
@@ -71,14 +71,15 @@ ioc.intSerializer = new (require('./internals/IntSerializer'))(ioc
|
|
|
71
71
|
ioc.longSerializer = new (require('./internals/LongSerializer'))(ioc);
|
|
72
72
|
ioc.longSerializerNg = new (require('./internals/LongSerializerNg'))(ioc);
|
|
73
73
|
ioc.stringSerializer = new (require('./internals/StringSerializer'))(ioc, ioc.DataType.STRING);
|
|
74
|
+
ioc.offsetDateTimeSerializer = new (require('./internals/OffsetDateTimeSerializer'))(ioc, ioc.DataType.OFFSETDATETIME);
|
|
74
75
|
ioc.dateSerializer = new (require('./internals/DateSerializer'))(ioc, ioc.DataType.DATE);
|
|
75
76
|
ioc.timestampSerializer = new (require('./internals/DateSerializer'))(ioc, ioc.DataType.TIMESTAMP);
|
|
76
|
-
ioc.classSerializer = new (require('./internals/
|
|
77
|
+
ioc.classSerializer = new (require('./internals/ClassSerializer'))(ioc);
|
|
77
78
|
ioc.doubleSerializer = new (require('./internals/DoubleSerializer'))(ioc);
|
|
78
79
|
ioc.floatSerializer = new (require('./internals/FloatSerializer'))(ioc);
|
|
79
80
|
ioc.listSerializer = new (require('./internals/ArraySerializer'))(ioc, ioc.DataType.LIST);
|
|
80
81
|
ioc.mapSerializer = new (require('./internals/MapSerializer'))(ioc);
|
|
81
|
-
ioc.setSerializer = new (require('./internals/
|
|
82
|
+
ioc.setSerializer = new (require('./internals/SetSerializer'))(ioc, ioc.DataType.SET);
|
|
82
83
|
ioc.uuidSerializer = new (require('./internals/UuidSerializer'))(ioc);
|
|
83
84
|
ioc.edgeSerializer = new (require('./internals/EdgeSerializer'))(ioc);
|
|
84
85
|
ioc.pathSerializer = new (require('./internals/PathSerializer'))(ioc);
|
|
@@ -35,11 +35,13 @@ module.exports = class AnySerializer {
|
|
|
35
35
|
ioc.numberSerializationStrategy,
|
|
36
36
|
|
|
37
37
|
ioc.booleanSerializer,
|
|
38
|
+
ioc.offsetDateTimeSerializer,
|
|
38
39
|
ioc.dateSerializer,
|
|
39
40
|
ioc.bytecodeSerializer,
|
|
40
41
|
ioc.pSerializer,
|
|
41
42
|
ioc.traverserSerializer,
|
|
42
43
|
ioc.enumSerializer,
|
|
44
|
+
ioc.setSerializer,
|
|
43
45
|
ioc.listSerializer,
|
|
44
46
|
ioc.uuidSerializer,
|
|
45
47
|
ioc.edgeSerializer,
|
|
@@ -47,6 +49,7 @@ module.exports = class AnySerializer {
|
|
|
47
49
|
ioc.propertySerializer,
|
|
48
50
|
ioc.vertexSerializer,
|
|
49
51
|
ioc.vertexPropertySerializer,
|
|
52
|
+
ioc.classSerializer,
|
|
50
53
|
ioc.stringSerializer,
|
|
51
54
|
ioc.textPSerializer,
|
|
52
55
|
ioc.traversalStrategySerializer,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict';
|
|
21
|
+
|
|
22
|
+
const { TraversalStrategy } = require('../../../../process/traversal-strategy');
|
|
23
|
+
const { Buffer } = require('buffer');
|
|
24
|
+
|
|
25
|
+
module.exports = class ClassSerializer {
|
|
26
|
+
constructor(ioc) {
|
|
27
|
+
this.ioc = ioc;
|
|
28
|
+
this.ioc.serializers[ioc.DataType.CLASS] = this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
canBeUsedFor(value) {
|
|
32
|
+
return (
|
|
33
|
+
typeof value === 'function' &&
|
|
34
|
+
!!value.prototype &&
|
|
35
|
+
!!value.prototype.constructor.name &&
|
|
36
|
+
new value() instanceof TraversalStrategy
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
serialize(item, fullyQualifiedFormat = true) {
|
|
41
|
+
if (item === undefined || item === null) {
|
|
42
|
+
if (fullyQualifiedFormat) {
|
|
43
|
+
return Buffer.from([this.ioc.DataType.CLASS, 0x01]);
|
|
44
|
+
}
|
|
45
|
+
return this.ioc.intSerializer.serialize(0, false);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const bufs = [];
|
|
49
|
+
if (fullyQualifiedFormat) {
|
|
50
|
+
bufs.push(Buffer.from([this.ioc.DataType.CLASS, 0x00]));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const fqcn = new item().fqcn;
|
|
54
|
+
const v = Buffer.from(fqcn, 'utf8');
|
|
55
|
+
bufs.push(this.ioc.intSerializer.serialize(fqcn.length, false));
|
|
56
|
+
bufs.push(v);
|
|
57
|
+
|
|
58
|
+
return Buffer.concat(bufs);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
@@ -43,6 +43,7 @@ module.exports = class EnumSerializer {
|
|
|
43
43
|
{ name: 'Column', code: DT.COLUMN, enum: to_orig_enum(t.column) },
|
|
44
44
|
{ name: 'Direction', code: DT.DIRECTION, enum: to_orig_enum(t.direction) },
|
|
45
45
|
{ name: 'DT', code: DT.DT, enum: to_orig_enum(t.dt) },
|
|
46
|
+
{ name: 'GType', code: DT.GTYPE, enum: to_orig_enum(t.gType) },
|
|
46
47
|
{ name: 'Merge', code: DT.MERGE, enum: to_orig_enum(t.merge) },
|
|
47
48
|
{ name: 'Operator', code: DT.OPERATOR, enum: to_orig_enum(t.operator) },
|
|
48
49
|
{ name: 'Order', code: DT.ORDER, enum: to_orig_enum(t.order) },
|
|
@@ -58,7 +58,12 @@ module.exports = class NumberSerializationStrategy {
|
|
|
58
58
|
// INT32_MIN/MAX
|
|
59
59
|
return this.ioc.intSerializer.serialize(item, fullyQualifiedFormat);
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
// eslint-disable-next-line no-loss-of-precision
|
|
62
|
+
if (item >= -9223372036854775808 && item < 9223372036854775807) {
|
|
63
|
+
// INT64_MIN/MAX
|
|
64
|
+
return this.ioc.longSerializer.serialize(item, fullyQualifiedFormat);
|
|
65
|
+
}
|
|
66
|
+
return this.ioc.doubleSerializer.serialize(item, fullyQualifiedFormat);
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
if (typeof item === 'bigint') {
|