Beispiel #1
0
 def __init__(self, partition_key, write_partition=None, read_partitions=None, include_meta_properties=False):
     TraversalStrategy.__init__(self, configuration={"partitionKey": partition_key,
                                                     "includeMetaProperties": include_meta_properties})
     if write_partition is not None:
         self.configuration["writePartition"] = write_partition
     if write_partition is not None:
         self.configuration["readPartitions"] = read_partitions
Beispiel #2
0
 def __init__(self, seed):
     TraversalStrategy.__init__(
         self,
         fqcn=
         "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SeedStrategy"
     )
     self.configuration["seed"] = seed
Beispiel #3
0
 def __init__(self,
              graph_computer=None,
              workers=None,
              persist=None,
              result=None,
              vertices=None,
              edges=None,
              configuration=None):
     TraversalStrategy.__init__(self,
                                fqcn=computer_decoration_namespace +
                                'VertexProgramStrategy')
     if graph_computer is not None:
         self.configuration["graphComputer"] = graph_computer
     if workers is not None:
         self.configuration["workers"] = workers
     if persist is not None:
         self.configuration["persist"] = persist
     if result is not None:
         self.configuration["result"] = result
     if vertices is not None:
         self.configuration["vertices"] = vertices
     if edges is not None:
         self.configuration["edges"] = edges
     if configuration is not None:
         self.configuration.update(configuration)
Beispiel #4
0
 def __init__(self, halted_traverser_factory=None):
     TraversalStrategy.__init__(self,
                                fqcn=decoration_namespace +
                                'HaltedTraverserStrategy')
     if halted_traverser_factory is not None:
         self.configuration[
             "haltedTraverserFactory"] = halted_traverser_factory
Beispiel #5
0
 def __init__(self,
              graph_computer=None,
              workers=None,
              persist=None,
              result=None,
              vertices=None,
              edges=None,
              configuration=None):
     TraversalStrategy.__init__(
         self,
         fqcn=
         "org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy"
     )
     if graph_computer is not None:
         self.configuration["graphComputer"] = graph_computer
     if workers is not None:
         self.configuration["workers"] = workers
     if persist is not None:
         self.configuration["persist"] = persist
     if result is not None:
         self.configuration["result"] = result
     if vertices is not None:
         self.configuration["vertices"] = vertices
     if edges is not None:
         self.configuration["edges"] = edges
     if configuration is not None:
         self.configuration.update(configuration)
Beispiel #6
0
 def __init__(self, options=None):
     TraversalStrategy.__init__(
         self,
         configuration=options,
         fqcn=
         "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.OptionsStrategy"
     )
Beispiel #7
0
 def __init__(self, vertices=None, edges=None, vertex_properties=None):
     TraversalStrategy.__init__(self)
     if vertices is not None:
         self.configuration["vertices"] = vertices
     if edges is not None:
         self.configuration["edges"] = edges
     if vertex_properties is not None:
         self.configuration["vertexProperties"] = vertex_properties
 def __init__(self, vertices=None, edges=None, vertex_properties=None):
     TraversalStrategy.__init__(self)
     if vertices is not None:
         self.configuration["vertices"] = vertices
     if edges is not None:
         self.configuration["edges"] = edges
     if vertex_properties is not None:
         self.configuration["vertexProperties"] = vertex_properties
Beispiel #9
0
 def __init__(self, vertices=None, edges=None, vertex_properties=None):
     TraversalStrategy.__init__(self, fqcn="org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy")
     if vertices is not None:
         self.configuration["vertices"] = vertices
     if edges is not None:
         self.configuration["edges"] = edges
     if vertex_properties is not None:
         self.configuration["vertexProperties"] = vertex_properties
Beispiel #10
0
 def __init__(self, log_warning=False, throw_exception=False):
     TraversalStrategy.__init__(
         self,
         fqcn=
         "org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.EdgeLabelVerificationStrategy"
     )
     self.configuration["logWarning"] = log_warning
     self.configuration["throwException"] = throw_exception
Beispiel #11
0
 def __init__(self, match_algorithm=None):
     TraversalStrategy.__init__(
         self,
         fqcn=
         "org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.MatchAlgorithmStrategy"
     )
     if match_algorithm is not None:
         self.configuration["matchAlgorithm"] = match_algorithm
Beispiel #12
0
 def __init__(self, halted_traverser_factory=None):
     TraversalStrategy.__init__(
         self,
         fqcn=
         "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy"
     )
     if halted_traverser_factory is not None:
         self.configuration[
             "haltedTraverserFactory"] = halted_traverser_factory
Beispiel #13
0
 def __init__(self,
              log_warning=False,
              throw_exception=False,
              keys=["id", "label"]):
     TraversalStrategy.__init__(self,
                                fqcn=verification_namespace +
                                'ReservedKeysVerificationStrategy')
     self.configuration["logWarning"] = log_warning
     self.configuration["throwException"] = throw_exception
     self.configuration["keys"] = keys
Beispiel #14
0
 def __init__(self, partition_key=None, write_partition=None, read_partitions=None, include_meta_properties=None):
     TraversalStrategy.__init__(self, fqcn="org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy")
     if partition_key is not None:
         self.configuration["partitionKey"] = partition_key
     if write_partition is not None:
         self.configuration["writePartition"] = write_partition
     if write_partition is not None:
         self.configuration["readPartitions"] = read_partitions
     if include_meta_properties is not None:
         self.configuration["includeMetaProperties"] = include_meta_properties
 def __init__(self, partition_key=None, write_partition=None, read_partitions=None, include_meta_properties=None):
     TraversalStrategy.__init__(self)
     if partition_key is not None:
         self.configuration["partitionKey"] = partition_key
     if write_partition is not None:
         self.configuration["writePartition"] = write_partition
     if write_partition is not None:
         self.configuration["readPartitions"] = read_partitions
     if include_meta_properties is not None:
         self.configuration["includeMetaProperties"] = include_meta_properties
Beispiel #16
0
 def __init__(self, vertices=None, edges=None, vertex_properties=None):
     TraversalStrategy.__init__(self,
                                fqcn=decoration_namespace +
                                'SubgraphStrategy')
     if vertices is not None:
         self.configuration["vertices"] = vertices
     if edges is not None:
         self.configuration["edges"] = edges
     if vertex_properties is not None:
         self.configuration["vertexProperties"] = vertex_properties
Beispiel #17
0
 def __init__(self,
              log_warning=False,
              throw_exception=False,
              keys=["id", "label"]):
     TraversalStrategy.__init__(
         self,
         fqcn=
         "org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReservedKeysVerificationStrategy"
     )
     self.configuration["logWarning"] = log_warning
     self.configuration["throwException"] = throw_exception
     self.configuration["keys"] = keys
Beispiel #18
0
 def __init__(self,
              partition_key=None,
              write_partition=None,
              read_partitions=None,
              include_meta_properties=None):
     TraversalStrategy.__init__(self)
     if partition_key is not None:
         self.configuration["partitionKey"] = partition_key
     if write_partition is not None:
         self.configuration["writePartition"] = write_partition
     if write_partition is not None:
         self.configuration["readPartitions"] = read_partitions
     if include_meta_properties is not None:
         self.configuration[
             "includeMetaProperties"] = include_meta_properties
Beispiel #19
0
 async def test_strategies(self, remote_connection):
     statics.load_statics(globals())
     #
     g = Graph().traversal().withRemote(remote_connection). \
         withStrategies(TraversalStrategy("SubgraphStrategy",
                                          {"vertices": __.hasLabel("person"),
                                           "edges": __.hasLabel("created")}))
     assert 4 == await g.V().count().next()
     assert 0 == await g.E().count().next()
     assert 1 == await g.V().label().dedup().count().next()
     assert "person" == await g.V().label().dedup().next()
     #
     g = Graph().traversal().withRemote(remote_connection). \
         withStrategies(SubgraphStrategy(vertices=__.hasLabel("person"), edges=__.hasLabel("created")))
     assert 4 == await g.V().count().next()
     assert 0 == await g.E().count().next()
     assert 1 == await g.V().label().dedup().count().next()
     assert "person" == await g.V().label().dedup().next()
     #
     g = g.withoutStrategies(SubgraphStrategy). \
         withComputer(vertices=__.has("name", "marko"), edges=__.limit(0))
     assert 1 == await g.V().count().next()
     assert 0 == await g.E().count().next()
     assert "person" == await g.V().label().next()
     assert "marko" == await g.V().name.next()
     #
     g = Graph().traversal().withRemote(remote_connection).withComputer()
     assert 6 == await g.V().count().next()
     assert 6 == await g.E().count().next()
     await remote_connection.close()
 def test_strategies(self):
     statics.load_statics(globals())
     connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
     #
     g = Graph().traversal().withRemote(connection). \
         withStrategies(TraversalStrategy("SubgraphStrategy",
                                          {"vertices": __.hasLabel("person"),
                                           "edges": __.hasLabel("created")}))
     assert 4 == g.V().count().next()
     assert 0 == g.E().count().next()
     assert 1 == g.V().label().dedup().count().next()
     assert "person" == g.V().label().dedup().next()
     #
     g = Graph().traversal().withRemote(connection). \
         withStrategies(SubgraphStrategy(vertices=__.hasLabel("person"), edges=__.hasLabel("created")))
     assert 4 == g.V().count().next()
     assert 0 == g.E().count().next()
     assert 1 == g.V().label().dedup().count().next()
     assert "person" == g.V().label().dedup().next()
     #
     g = g.withoutStrategies(SubgraphStrategy). \
         withComputer(workers=4, vertices=__.has("name", "marko"), edges=__.limit(0))
     assert 1 == g.V().count().next()
     assert 0 == g.E().count().next()
     assert "person" == g.V().label().next()
     assert "marko" == g.V().name.next()
     #
     g = Graph().traversal().withRemote(connection).withComputer()
     assert 6 == g.V().count().next()
     assert 6 == g.E().count().next()
     connection.close()
 def __init__(self, graph_computer=None, workers=None, persist=None, result=None, vertices=None, edges=None,
              configuration=None):
     TraversalStrategy.__init__(self)
     if graph_computer is not None:
         self.configuration["graphComputer"] = graph_computer
     if workers is not None:
         self.configuration["workers"] = workers
     if persist is not None:
         self.configuration["persist"] = persist
     if result is not None:
         self.configuration["result"] = result
     if vertices is not None:
         self.configuration["vertices"] = vertices
     if edges is not None:
         self.configuration["edges"] = edges
     if configuration is not None:
         self.configuration.update(configuration)
 def test_strategies(self, remote_connection):
     statics.load_statics(globals())
     g = traversal().withRemote(remote_connection). \
         withStrategies(TraversalStrategy("SubgraphStrategy",
                                          {"vertices": __.hasLabel("person"),
                                           "edges": __.hasLabel("created")},
                                           "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy"))
     assert 4 == g.V().count().next()
     assert 0 == g.E().count().next()
     assert 1 == g.V().label().dedup().count().next()
     assert 4 == g.V().filter(
         lambda: ("x -> true", "gremlin-groovy")).count().next()
     assert "person" == g.V().label().dedup().next()
     #
     g = traversal().withRemote(remote_connection). \
         withStrategies(SubgraphStrategy(vertices=__.hasLabel("person"), edges=__.hasLabel("created")))
     assert 4 == g.V().count().next()
     assert 0 == g.E().count().next()
     assert 1 == g.V().label().dedup().count().next()
     assert "person" == g.V().label().dedup().next()
     #
     g = traversal().withRemote(remote_connection). \
         withStrategies(SubgraphStrategy(edges=__.hasLabel("created")))
     assert 6 == g.V().count().next()
     assert 4 == g.E().count().next()
     assert 1 == g.E().label().dedup().count().next()
     assert "created" == g.E().label().dedup().next()
     #
     g = g.withoutStrategies(SubgraphStrategy). \
         withComputer(vertices=__.has("name", "marko"), edges=__.limit(0))
     assert 1 == g.V().count().next()
     assert 0 == g.E().count().next()
     assert "person" == g.V().label().next()
     assert "marko" == g.V().name.next()
     #
     g = traversal().withRemote(remote_connection).withComputer()
     assert 6 == g.V().count().next()
     assert 6 == g.E().count().next()
     #
     g = traversal().withRemote(remote_connection).withStrategies(
         SeedStrategy(12345))
     shuffledResult = g.V().values("name").order().by(
         Order.shuffle).toList()
     assert shuffledResult == g.V().values("name").order().by(
         Order.shuffle).toList()
     assert shuffledResult == g.V().values("name").order().by(
         Order.shuffle).toList()
     assert shuffledResult == g.V().values("name").order().by(
         Order.shuffle).toList()
     #
     g = traversal().withRemote(remote_connection). \
         withStrategies(ReservedKeysVerificationStrategy(throw_exception=True))
     try:
         g.addV("person").property("id", "please-don't-use-id").iterate()
         assert False
     except GremlinServerError as gse:
         assert gse.status_code == 500
Beispiel #23
0
 def test_strategies(self, remote_connection):
     statics.load_statics(globals())
     #
     g = traversal().withRemote(remote_connection). \
         withStrategies(TraversalStrategy("SubgraphStrategy",
                                          {"vertices": __.hasLabel("person"),
                                           "edges": __.hasLabel("created")}))
     assert 4 == g.V().count().next()
     assert 0 == g.E().count().next()
     assert 1 == g.V().label().dedup().count().next()
     assert 4 == g.V().filter(
         lambda: ("lambda x: True", "gremlin-python")).count().next()
     assert "person" == g.V().label().dedup().next()
     #
     g = traversal().withRemote(remote_connection). \
         withStrategies(SubgraphStrategy(vertices=__.hasLabel("person"), edges=__.hasLabel("created")))
     assert 4 == g.V().count().next()
     assert 0 == g.E().count().next()
     assert 1 == g.V().label().dedup().count().next()
     assert "person" == g.V().label().dedup().next()
     #
     g = traversal().withRemote(remote_connection). \
         withStrategies(SubgraphStrategy(edges=__.hasLabel("created")))
     assert 6 == g.V().count().next()
     assert 4 == g.E().count().next()
     assert 1 == g.E().label().dedup().count().next()
     assert "created" == g.E().label().dedup().next()
     #
     g = g.withoutStrategies(SubgraphStrategy). \
         withComputer(vertices=__.has("name", "marko"), edges=__.limit(0))
     assert 1 == g.V().count().next()
     assert 0 == g.E().count().next()
     assert "person" == g.V().label().next()
     assert "marko" == g.V().name.next()
     #
     g = traversal().withRemote(remote_connection).withComputer()
     assert 6 == g.V().count().next()
     assert 6 == g.E().count().next()
Beispiel #24
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=optimization_namespace +
                                'GraphFilterStrategy')
Beispiel #25
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=decoration_namespace +
                                'ConnectiveStrategy')
Beispiel #26
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=decoration_namespace +
                                'ElementIdStrategy')
Beispiel #27
0
 def __init__(self, log_warning=False, throw_exception=False):
     TraversalStrategy.__init__(self,
                                fqcn=verification_namespace +
                                'EdgeLabelVerificationStrategy')
     self.configuration["logWarning"] = log_warning
     self.configuration["throwException"] = throw_exception
 def __init__(self, halted_traverser_factory=None):
     TraversalStrategy.__init__(self)
     if halted_traverser_factory is not None:
         self.configuration["haltedTraverserFactory"] = halted_traverser_factory
Beispiel #29
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=verification_namespace +
                                'LambdaRestrictionStrategy')
Beispiel #30
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=verification_namespace +
                                'ReadOnlyStrategy')
 def __init__(self, match_algorithm=None):
     TraversalStrategy.__init__(self)
     if match_algorithm is not None:
         self.configuration["matchAlgorithm"] = match_algorithm
Beispiel #32
0
 def __init__(self, options=None):
     TraversalStrategy.__init__(self,
                                configuration=options,
                                fqcn=decoration_namespace +
                                'OptionsStrategy')
Beispiel #33
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=optimization_namespace +
                                'RepeatUnrollStrategy')
Beispiel #34
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=optimization_namespace +
                                'PathRetractionStrategy')
 def __init__(self):
     TraversalStrategy.__init__(self)
Beispiel #36
0
 def __init__(self, options=None):
     TraversalStrategy.__init__(self, configuration=options)
Beispiel #37
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=optimization_namespace +
                                'EarlyLimitStrategy')