with

How to modify execution of graph queries.

Synopsis

g.with( 'option',[option_value ] )

Description

  • allow-filtering: A mirror function of ALLOW FILTERING in Cassandra. While useful for development, not recommended for production because of performance degradation. By default, ALLOW FILTERING is disabled.
  • batch: By default, graph traversals do not use batches. This option can enabled logged batching, and all data-modifying CQL statements associated with the graph query will be executed as a single logged batch.
  • consistency: Set the consistency level for read or write actions. Possible values are: ANY, ONE, TWO, THREE, QUORUM, ALL, LOCAL_QUORUM, EACH_QUORUM, and LOCAL_ONE.
  • force-vertex-deletion: By default, graph throws an exception when all edges cannot be found for a vertex being deleted. This option can override the exception and perform deletion to the extent supported by the schema. When force-vertex-deletion is true, the vertex will be deleted, and so will any incident edges covered by a usable index or for which the edge table is keyed by the deleted vertex ID. Any other incident edges -- those for which a scan would be required -- will not be deleted. This option can potentially leave edge table rows pointing to a vertex that no longer exists.
  • ignore-unindexed: Return partial results while ignoring data without an index.
  • label-warning: Execute a traversal without the missing label warning. Useful for query exploration.
  • max-mutations: Traversals that change the data, like traversals containing addV(), can eventually lead up to too many underlying mutating queries. This option can change the default limit of underlying CQL queries is 10,000 mutations. To completely disable the limits check, set the limit to any number that's <= 0.
  • read-before-write: Some traversals require a read-before-write action. By default, a warning is issued for such queries. This option can be set to ignore the warning, or reset to warn.

Examples

Find a person with a particular name without requiring an index:
g.with('allow-filtering').V().has('person', 'name', 'Julia CHILD')
Add two vertices using a batched statement:
g.with('batch').
  addV('person').
    property('person_id', '802207f2-4e0b-4c6a-8328-5c9c21477df6' as UUID).
    property('name', 'Alice JONES').
  addV('person').
    property('person_id', 'c712c2ef-1281-4854-98ce-2f68a3d67305' as UUID).
    property('name', 'Bob SMITH')
Set the consistency level for a read:
g.with('consistency', QUORUM).
  V().has('gender', 'F').out()
or a write:
g.with('consistency', LOCAL_QUORUM).
  addV('person').
  property('person_id', '807e2664-7239-466f-bf59-632dcbcb4f57' as UUID) 
Forcing the deletion of a vertex and all its edges that can be deleted:
g.with('force-vertex-deletion').
  V().has('name', 'Sharon SMITH').
  drop()
Run the query and ignore unindexed data:
g.with('ignore-unindexed', true).V()
Execute the query and ignore the warning that labels are not present in the query:
g.with("label-warning", false).V()
Execute the addV traversal with a maximum of 10 mutations:
g.with('max-mutations', 10).
  addV('ingredient').
    property('ingred_id', 3050).
    property('name', 'turnip')
Execute the query and ignore the read-before-write warning:
g.with('read-before-write', 'ignore').
  V().hasLabel('person').
    has('name', 'John DOE').
    property('gender', 'M')