Exemplo n.º 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
Exemplo n.º 2
0
 def __init__(self, seed):
     TraversalStrategy.__init__(
         self,
         fqcn=
         "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SeedStrategy"
     )
     self.configuration["seed"] = seed
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 6
0
 def __init__(self, options=None):
     TraversalStrategy.__init__(
         self,
         configuration=options,
         fqcn=
         "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.OptionsStrategy"
     )
Exemplo n.º 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
Exemplo n.º 8
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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 15
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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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()
Exemplo n.º 21
0
 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
Exemplo n.º 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()
Exemplo n.º 24
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=optimization_namespace +
                                'GraphFilterStrategy')
Exemplo n.º 25
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=decoration_namespace +
                                'ConnectiveStrategy')
Exemplo n.º 26
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=decoration_namespace +
                                'ElementIdStrategy')
Exemplo n.º 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
Exemplo n.º 28
0
 def __init__(self, halted_traverser_factory=None):
     TraversalStrategy.__init__(self)
     if halted_traverser_factory is not None:
         self.configuration["haltedTraverserFactory"] = halted_traverser_factory
Exemplo n.º 29
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=verification_namespace +
                                'LambdaRestrictionStrategy')
Exemplo n.º 30
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=verification_namespace +
                                'ReadOnlyStrategy')
Exemplo n.º 31
0
 def __init__(self, match_algorithm=None):
     TraversalStrategy.__init__(self)
     if match_algorithm is not None:
         self.configuration["matchAlgorithm"] = match_algorithm
Exemplo n.º 32
0
 def __init__(self, options=None):
     TraversalStrategy.__init__(self,
                                configuration=options,
                                fqcn=decoration_namespace +
                                'OptionsStrategy')
Exemplo n.º 33
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=optimization_namespace +
                                'RepeatUnrollStrategy')
Exemplo n.º 34
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=optimization_namespace +
                                'PathRetractionStrategy')
Exemplo n.º 35
0
 def __init__(self):
     TraversalStrategy.__init__(self)
Exemplo n.º 36
0
 def __init__(self, options=None):
     TraversalStrategy.__init__(self, configuration=options)
Exemplo n.º 37
0
 def __init__(self):
     TraversalStrategy.__init__(self,
                                fqcn=optimization_namespace +
                                'EarlyLimitStrategy')