From e03cb9ab0519fcf324c67b79c3bc61f4af3f8746 Mon Sep 17 00:00:00 2001 From: cn337131 <141730190+cn337131@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:12:14 +0000 Subject: [PATCH] fix type helpers and typos --- docs/administration-guide/delete-elements.md | 24 +- docs/administration-guide/named-views.md | 4 +- .../koryphe-operators.md | 102 +- docs/reference/operations-guide/get.md | 1904 ++++++++--------- .../predicates-guide/koryphe-predicates.md | 758 ++++--- docs/user-guide/apis/python-api.md | 4 +- .../query/gaffer-syntax/filtering.md | 10 +- .../query/gaffer-syntax/operations.md | 6 +- .../query/gremlin/custom-features.md | 2 +- 9 files changed, 1437 insertions(+), 1377 deletions(-) diff --git a/docs/administration-guide/delete-elements.md b/docs/administration-guide/delete-elements.md index ebf5da9a17..a49cd3650d 100644 --- a/docs/administration-guide/delete-elements.md +++ b/docs/administration-guide/delete-elements.md @@ -84,8 +84,14 @@ Operation Chain. This will take as its input the output of any operations run pr g.OperationChain( operations=[ g.GetElements( - input = [g.EdgeSeed(source="John", destination="2", directedType="Either")] - view = g.ElementDefinition(group = "created") + input = [g.EdgeSeed(source="John", destination="2", directedType="Either")], + view = g.View( + edges=[ + g.ElementDefinition( + group="created" + ) + ] + ) ), g.DeleteElements() ] @@ -159,8 +165,8 @@ querying for that entity with no filters. Entity[vertex="2",group="software"] ``` -If a user wishes to remove an entity but leave any associated, this is done by -querying for that entity with a filter. +If a user wishes to remove an entity but leave any edges associated with the entity's vertex, +this is done by querying for that entity with a filter. !!! example "" If a user gets the John entity in a query but uses a `View` that filters for just entities, then the @@ -208,8 +214,14 @@ querying for that entity with a filter. g.OperationChain( operations=[ g.GetElements( - input = [g.EdgeSeed(source="John", destination="2", directedType="Either")] - view = g.ElementDefinition(group = "person") + input=[g.EntitySeed(vertex="John")], + view=g.View( + entities=[ + g.ElementDefinition( + group="person" + ) + ] + ) ), g.DeleteElements() ] diff --git a/docs/administration-guide/named-views.md b/docs/administration-guide/named-views.md index 8b5bec9336..fc9f37827b 100644 --- a/docs/administration-guide/named-views.md +++ b/docs/administration-guide/named-views.md @@ -109,7 +109,7 @@ graph LR g.PredicateContext( selection = ['weight'], predicate = g.IsMoreThan( - value = {'java.lang.Float': 0.4}, + value = g.float_(0.4), or_equal_to = False ) ) @@ -158,7 +158,7 @@ graph LR === "Python" ```python - g_connector.execute_operation( + gc.execute_operation( operation = g.GetElements( input = [g.EntitySeed(vertex = "John")] view = g.View( diff --git a/docs/reference/binary-operators-guide/koryphe-operators.md b/docs/reference/binary-operators-guide/koryphe-operators.md index 5370c65fe0..c9c1e52581 100644 --- a/docs/reference/binary-operators-guide/koryphe-operators.md +++ b/docs/reference/binary-operators-guide/koryphe-operators.md @@ -23,7 +23,13 @@ Input type: `java.lang.Boolean` "class" : "uk.gov.gchq.koryphe.impl.binaryoperator.And" } ``` - + + === "Python" + + ``` python + g.bop.And() + ``` + Example inputs: Input Type | Inputs | Result Type | Results @@ -34,7 +40,7 @@ Input type: `java.lang.Boolean` java.lang.Boolean | false and null | java.lang.Boolean | false java.lang.Boolean | true and null | java.lang.Boolean | true | null and null | | null - + ## Or Applies the logical OR operation to 2 booleans. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/Or.html) @@ -56,7 +62,13 @@ Input type: `java.lang.Boolean` "class" : "uk.gov.gchq.koryphe.impl.binaryoperator.Or" } ``` - + + === "Python" + + ``` python + g.bop.Or() + ``` + Example inputs: Input Type | Inputs | Result Type | Results @@ -70,7 +82,7 @@ Input type: `java.lang.Boolean` java.lang.String | test and 3 | | ClassCastException: java.lang.String cannot be cast to java.lang.Boolean java.lang.Integer | 0 and 0 | | ClassCastException: java.lang.Integer cannot be cast to java.lang.Boolean java.lang.Integer | 1 and 0 | | ClassCastException: java.lang.Integer cannot be cast to java.lang.Boolean - + ## First Returns the first non-null value. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/First.html) @@ -92,7 +104,13 @@ Input type: `java.lang.Object` "class" : "uk.gov.gchq.koryphe.impl.binaryoperator.First" } ``` - + + === "Python" + + ``` python + g.First() + ``` + Example inputs: Input Type | Inputs | Result Type | Results @@ -101,7 +119,7 @@ Input type: `java.lang.Object` java.lang.String | first and null | java.lang.String | first | null and second | java.lang.String | second | null and null | | null - + ## Min Returns the min value. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/Min.html) @@ -129,7 +147,7 @@ Input type: `java.lang.Comparable` ``` python g.Min() ``` - + Example inputs: Input Type | Inputs | Result Type | Results @@ -137,7 +155,7 @@ Input type: `java.lang.Comparable` java.lang.Integer | 5 and 6 | java.lang.Integer | 5 java.lang.String | inputString and anotherInputString | java.lang.String | anotherInputString | null and 1 | java.lang.Integer | 1 - + ## Max Returns the max value. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/Max.html) @@ -165,7 +183,7 @@ Input type: `java.lang.Comparable` ``` python g.Max() ``` - + Example inputs: Input Type | Inputs | Result Type | Results @@ -173,7 +191,7 @@ Input type: `java.lang.Comparable` java.lang.Integer | 5 and 6 | java.lang.Integer | 6 java.lang.String | inputString and anotherInputString | java.lang.String | inputString | null and 1 | java.lang.Integer | 1 - + ## Product Calculates the product of 2 numbers. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/Product.html) @@ -195,7 +213,13 @@ Input type: `java.lang.Number` "class" : "uk.gov.gchq.koryphe.impl.binaryoperator.Product" } ``` - + + === "Python" + + ``` python + g.Product() + ``` + Example inputs: Input Type | Inputs | Result Type | Results @@ -207,7 +231,7 @@ Input type: `java.lang.Number` java.lang.Short | 500 and 500 | java.lang.Short | 32767 java.lang.Integer | -5 and 5 | java.lang.Integer | -25 java.lang.Long | 20 and null | java.lang.Long | 20 - + ## Sum Calculates the sum of 2 numbers. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/Sum.html) @@ -235,7 +259,7 @@ Input type: `java.lang.Number` ``` python g.Sum() ``` - + Example inputs: Input Type | Inputs | Result Type | Results @@ -247,7 +271,7 @@ Input type: `java.lang.Number` java.lang.Short | 30000 and 10000 | java.lang.Short | 32767 java.lang.Integer | -5 and 5 | java.lang.Integer | 0 java.lang.Long | 20 and null | java.lang.Long | 20 - + ## CollectionConcat Concatenates two collections together. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/CollectionConcat.html) @@ -275,7 +299,7 @@ Input type: `java.util.Collection` ``` python g.CollectionConcat() ``` - + Example inputs: Input Type | Inputs | Result Type | Results @@ -285,7 +309,7 @@ Input type: `java.util.Collection` java.util.ArrayList | [] and [abc, cde] | java.util.ArrayList | [abc, cde] java.util.ArrayList | [test1] and null | java.util.ArrayList | [test1] java.util.HashSet | [a, b] and [b, c] | java.util.HashSet | [a, b, c] - + ## CollectionIntersect Returns items common to two collections. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/CollectionIntersect.html) @@ -313,7 +337,7 @@ Input type: `java.util.Collection` ``` python g.CollectionIntersect() ``` - + Example inputs: Input Type | Inputs | Result Type | Results @@ -323,7 +347,7 @@ Input type: `java.util.Collection` java.util.ArrayList | [] and [abc, cde] | java.util.ArrayList | [] java.util.ArrayList | [test1] and null | java.util.ArrayList | [test1] java.util.HashSet | [a, b] and [b, c] | java.util.HashSet | [b] - + ## StringConcat Concatenates 2 strings. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/StringConcat.html) @@ -347,7 +371,15 @@ Input type: `java.lang.String` "separator" : " " } ``` - + + === "Python" + + ``` python + g.StringConcat( + separator=" " + ) + ``` + Example inputs: Input Type | Inputs | Result Type | Results @@ -355,7 +387,7 @@ Input type: `java.lang.String` java.lang.String | hello and world | java.lang.String | hello world java.lang.String | abc and null | java.lang.String | abc | null and null | | null - + ??? example "Example StringConcat with default separator" === "Java" @@ -372,7 +404,13 @@ Input type: `java.lang.String` "separator" : "," } ``` - + + === "Python" + + ``` python + g.StringConcat() + ``` + Example inputs: Input Type | Inputs | Result Type | Results @@ -380,7 +418,7 @@ Input type: `java.lang.String` java.lang.String | hello and world | java.lang.String | hello,world java.lang.String | abc and null | java.lang.String | abc | null and null | | null - + ## StringDeduplicateConcat Concatenates 2 strings and omits duplicates. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/binaryoperator/StringDeduplicateConcat.html) @@ -404,7 +442,15 @@ Input type: `type` "separator" : " " } ``` - + + === "Python" + + ``` python + g.StringDeduplicateConcat( + separator=" " + ) + ``` + Example inputs: Input Type | Inputs | Result Type | Results @@ -413,7 +459,7 @@ Input type: `type` java.lang.String | abc and null | java.lang.String | abc | null and null | | null java.lang.String | abc, and abc | java.lang.String | abc, abc - + ??? example "Example StringDeduplicateConcat with default separator" === "Java" @@ -430,7 +476,13 @@ Input type: `type` "separator" : "," } ``` - + + === "Python" + + ``` python + g.StringDeduplicateConcat() + ``` + Example inputs: Input Type | Inputs | Result Type | Results diff --git a/docs/reference/operations-guide/get.md b/docs/reference/operations-guide/get.md index 5e881d97b8..2bc3ef9b16 100644 --- a/docs/reference/operations-guide/get.md +++ b/docs/reference/operations-guide/get.md @@ -51,18 +51,18 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer === "Python" ``` python - g.GetElements( - input=[ - g.EntitySeed( - vertex=2 - ), - g.EdgeSeed( - source=2, - destination=3, - directed_type="EITHER", - matched_vertex="SOURCE" - ) - ] + g.GetElements( + input=[ + g.EntitySeed( + vertex=2 + ), + g.EdgeSeed( + source=2, + destination=3, + directed_type="EITHER", + matched_vertex="SOURCE" + ) + ] ) ``` @@ -142,7 +142,7 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer ??? example "Example fetching entities and edges by ID and count" Get entities and edges by entity id 2 and edge id 2 to 3 with count more than 1. - + === "Java" ``` java @@ -212,54 +212,54 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer === "Python" ``` python - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.IsMoreThan( - value=1, - or_equal_to=False - ) - ) - ] - ) - ], - edges=[ - g.ElementDefinition( - group="edge", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.IsMoreThan( - value=1, - or_equal_to=False - ) - ) - ] - ) - ], - all_edges=False, - all_entities=False - ), - input=[ - g.EntitySeed( - vertex=2 - ), - g.EdgeSeed( - source=2, - destination=3, - directed_type="EITHER", - matched_vertex="SOURCE" - ) - ] + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.IsMoreThan( + value=1, + or_equal_to=False + ) + ) + ] + ) + ], + edges=[ + g.ElementDefinition( + group="edge", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.IsMoreThan( + value=1, + or_equal_to=False + ) + ) + ] + ) + ], + all_edges=False, + all_entities=False + ), + input=[ + g.EntitySeed( + vertex=2 + ), + g.EdgeSeed( + source=2, + destination=3, + directed_type="EITHER", + matched_vertex="SOURCE" + ) + ] ) ``` @@ -309,7 +309,7 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer ??? example "Example fetching entities and edges related to vertex" Get entities and edges that are related to vertex 2. - + === "Java" ``` java @@ -333,12 +333,12 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer === "Python" ``` python - g.GetElements( - input=[ - g.EntitySeed( - vertex=2 - ) - ] + g.GetElements( + input=[ + g.EntitySeed( + vertex=2 + ) + ] ) ``` @@ -410,7 +410,7 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer ??? example "Example fetching entities and edges related to edge" Get all entities and edges that are related to edge 1 to 2. - + === "Java" ``` java @@ -437,15 +437,15 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer === "Python" ``` python - g.GetElements( - input=[ - g.EdgeSeed( - source=1, - destination=2, - directed_type="EITHER", - matched_vertex="SOURCE" - ) - ] + g.GetElements( + input=[ + g.EdgeSeed( + source=1, + destination=2, + directed_type="EITHER", + matched_vertex="SOURCE" + ) + ] ) ``` @@ -492,7 +492,7 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer ??? example "Example fetching entities and edges related to edge with count" Get all entities and edges that are related to edge 1 to 2 with count more than 1. - + === "Java" ``` java @@ -559,51 +559,51 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer === "Python" ``` python - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.IsMoreThan( - value=1, - or_equal_to=False - ) - ) - ] - ) - ], - edges=[ - g.ElementDefinition( - group="edge", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.IsMoreThan( - value=1, - or_equal_to=False - ) - ) - ] - ) - ], - all_edges=False, - all_entities=False - ), - input=[ - g.EdgeSeed( - source=1, - destination=2, - directed_type="EITHER", - matched_vertex="SOURCE" - ) - ] + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.IsMoreThan( + value=1, + or_equal_to=False + ) + ) + ] + ) + ], + edges=[ + g.ElementDefinition( + group="edge", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.IsMoreThan( + value=1, + or_equal_to=False + ) + ) + ] + ) + ], + all_edges=False, + all_entities=False + ), + input=[ + g.EdgeSeed( + source=1, + destination=2, + directed_type="EITHER", + matched_vertex="SOURCE" + ) + ] ) ``` @@ -644,7 +644,7 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer Get entities related to 2 with count less than 2 or more than 5. When using an `Or` predicate with a single selected value you can just do `select(propertyName)` then `execute(new Or(predicates))`. - + === "Java" ``` java @@ -704,46 +704,46 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer === "Python" ``` python - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.Or( - predicates=[ - g.IsLessThan( - value=2, - or_equal_to=False - ), - g.IsMoreThan( - value=5, - or_equal_to=False - ) - ] - ) - ) - ] - ) - ], - all_edges=False, - all_entities=False - ), - input=[ - g.EntitySeed( - vertex=2 - ), - g.EdgeSeed( - source=2, - destination=3, - directed_type="EITHER", - matched_vertex="SOURCE" - ) - ] + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.Or( + predicates=[ + g.IsLessThan( + value=2, + or_equal_to=False + ), + g.IsMoreThan( + value=5, + or_equal_to=False + ) + ] + ) + ) + ] + ) + ], + all_edges=False, + all_entities=False + ), + input=[ + g.EntitySeed( + vertex=2 + ), + g.EdgeSeed( + source=2, + destination=3, + directed_type="EITHER", + matched_vertex="SOURCE" + ) + ] ) ``` @@ -773,7 +773,7 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer Get edges related to 2 when source is less than 2 or destination is more than 3. When using an `Or` predicate with a multiple selected values, it is more complicated. First, you need to select all the values you want: `select(a, b, c)`. This will create an array of the selected values, `[a, b, c]`. You then need to use the `Or.Builder` to build your `Or` predicate, using `.select()` then `.execute()`. When selecting values in the `Or.Builder` you need to refer to the position in the `[a,b,c]` array. So to use property `a`, use position 0 - `select(0)`. - + === "Java" ``` java @@ -840,51 +840,51 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer === "Python" ``` python - g.GetElements( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "SOURCE", - "DESTINATION" - ], - predicate=g.Or( - predicates=[ - g.NestedPredicate( - selection=[ - 0 - ], - predicate=g.IsLessThan( - value=2, - or_equal_to=False - ) - ), - g.NestedPredicate( - selection=[ - 1 - ], - predicate=g.IsMoreThan( - value=3, - or_equal_to=False - ) - ) - ] - ) - ) - ] - ) - ], - all_edges=False, - all_entities=False - ), - input=[ - g.EntitySeed( - vertex=2 - ) - ] + g.GetElements( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "SOURCE", + "DESTINATION" + ], + predicate=g.Or( + predicates=[ + g.NestedPredicate( + selection=[ + 0 + ], + predicate=g.IsLessThan( + value=2, + or_equal_to=False + ) + ), + g.NestedPredicate( + selection=[ + 1 + ], + predicate=g.IsMoreThan( + value=3, + or_equal_to=False + ) + ) + ] + ) + ) + ] + ) + ], + all_edges=False, + all_entities=False + ), + input=[ + g.EntitySeed( + vertex=2 + ) + ] ) ``` @@ -939,7 +939,7 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer Get entities and return only some properties. Note that because there are only two properties prior to asking to include only `vertex|count`, this returns the same results as asking to exclude `count`. - + === "Java" ``` java @@ -994,39 +994,39 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer === "Python" ``` python - g.GetElements( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge", - transient_properties={'vertex|count': 'java.lang.String'}, - transform_functions=[ - g.FunctionContext( - selection=[ - "SOURCE", - "count" - ], - function=g.Concat( - separator="|" - ), - projection=[ - "vertex|count" - ] - ) - ], - properties=[ - "vertex|count" - ] - ) - ], - all_edges=False, - all_entities=False - ), - input=[ - g.EntitySeed( - vertex=2 - ) - ] + g.GetElements( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge", + transient_properties={'vertex|count': 'java.lang.String'}, + transform_functions=[ + g.FunctionContext( + selection=[ + "SOURCE", + "count" + ], + function=g.Concat( + separator="|" + ), + projection=[ + "vertex|count" + ] + ) + ], + properties=[ + "vertex|count" + ] + ) + ], + all_edges=False, + all_entities=False + ), + input=[ + g.EntitySeed( + vertex=2 + ) + ] ) ``` @@ -1092,7 +1092,7 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer Get entities and exclude properties. Note that because there are only two properties prior to the exclusion, this returns the same results as asking to include only `vertex|count`. - + === "Java" ``` java @@ -1147,39 +1147,39 @@ Gets elements related to provided seeds. [Javadoc](https://gchq.github.io/Gaffer === "Python" ``` python - g.GetElements( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge", - transient_properties={'vertex|count': 'java.lang.String'}, - transform_functions=[ - g.FunctionContext( - selection=[ - "SOURCE", - "count" - ], - function=g.Concat( - separator="|" - ), - projection=[ - "vertex|count" - ] - ) - ], - exclude_properties=[ - "count" - ] - ) - ], - all_edges=False, - all_entities=False - ), - input=[ - g.EntitySeed( - vertex=2 - ) - ] + g.GetElements( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge", + transient_properties={'vertex|count': 'java.lang.String'}, + transform_functions=[ + g.FunctionContext( + selection=[ + "SOURCE", + "count" + ], + function=g.Concat( + separator="|" + ), + projection=[ + "vertex|count" + ] + ) + ], + exclude_properties=[ + "count" + ] + ) + ], + all_edges=False, + all_entities=False + ), + input=[ + g.EntitySeed( + vertex=2 + ) + ] ) ``` @@ -1363,7 +1363,7 @@ Performs a single hop down related edges. [Javadoc](https://gchq.github.io/Gaffe ??? example "Example fetching adjacent IDs from specified vertex" Get adjacent ids from vertex 2. - + === "Java" ``` java @@ -1387,12 +1387,12 @@ Performs a single hop down related edges. [Javadoc](https://gchq.github.io/Gaffe === "Python" ``` python - g.GetAdjacentIds( - input=[ - g.EntitySeed( - vertex=2 - ) - ] + g.GetAdjacentIds( + input=[ + g.EntitySeed( + vertex=2 + ) + ] ) ``` @@ -1428,7 +1428,7 @@ Performs a single hop down related edges. [Javadoc](https://gchq.github.io/Gaffe ??? example "Example fetching adjacent IDs from along outbound edges of specified vertex" Get adjacent ids along outbound edges from vertex 2 - + === "Java" ``` java @@ -1454,13 +1454,13 @@ Performs a single hop down related edges. [Javadoc](https://gchq.github.io/Gaffe === "Python" ``` python - g.GetAdjacentIds( - input=[ - g.EntitySeed( - vertex=2 - ) - ], - include_incoming_out_going="OUTGOING" + g.GetAdjacentIds( + input=[ + g.EntitySeed( + vertex=2 + ) + ], + include_incoming_out_going="OUTGOING" ) ``` @@ -1492,7 +1492,7 @@ Performs a single hop down related edges. [Javadoc](https://gchq.github.io/Gaffe ??? example "Example fetching adjacent IDs from along outbound edges of specified vertex with count" Get adjacent ids along outbound edges from vertex 2 with count greater than 1. - + === "Java" ``` java @@ -1540,33 +1540,33 @@ Performs a single hop down related edges. [Javadoc](https://gchq.github.io/Gaffe === "Python" ``` python - g.GetAdjacentIds( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.IsMoreThan( - value=1, - or_equal_to=False - ) - ) - ] - ) - ], - all_edges=False, - all_entities=False - ), - input=[ - g.EntitySeed( - vertex=2 - ) - ], - include_incoming_out_going="OUTGOING" + g.GetAdjacentIds( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.IsMoreThan( + value=1, + or_equal_to=False + ) + ) + ] + ) + ], + all_edges=False, + all_entities=False + ), + input=[ + g.EntitySeed( + vertex=2 + ) + ], + include_incoming_out_going="OUTGOING" ) ``` @@ -1800,43 +1800,43 @@ Gets all elements, optionally using a provided View. [Javadoc](https://gchq.gith === "Python" ``` python - g.GetAllElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.IsMoreThan( - value=2, - or_equal_to=False - ) - ) - ] - ) - ], - edges=[ - g.ElementDefinition( - group="edge", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.IsMoreThan( - value=2, - or_equal_to=False - ) - ) - ] - ) - ], - all_edges=False, - all_entities=False - ) + g.GetAllElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.IsMoreThan( + value=2, + or_equal_to=False + ) + ) + ] + ) + ], + edges=[ + g.ElementDefinition( + group="edge", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.IsMoreThan( + value=2, + or_equal_to=False + ) + ) + ] + ) + ], + all_edges=False, + all_entities=False + ) ) ``` @@ -1916,7 +1916,7 @@ The examples for GetWalks use a modified graph. This graph contains two differen ??? example "Example getting walks" Gets all of the Walks of length 2 which start from vertex 1, with the added restriction that all edges must be traversed using the source as the matched vertex. - + === "Java" ``` java @@ -1960,29 +1960,29 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=1 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ) - ], - results_limit=1000000 + g.GetWalks( + input=[ + g.EntitySeed( + vertex=1 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ) + ], + results_limit=1000000 ) ``` @@ -2260,29 +2260,29 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=1 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="INCOMING" - ) - ] - ) - ], - results_limit=1000000 + g.GetWalks( + input=[ + g.EntitySeed( + vertex=1 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="INCOMING" + ) + ] + ) + ], + results_limit=1000000 ) ``` @@ -2932,69 +2932,69 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=1 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.IsMoreThan( - value=3, - or_equal_to=False - ) - ) - ] - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge1", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "count" - ], - predicate=g.IsMoreThan( - value=8, - or_equal_to=False - ) - ) - ] - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ) - ], - results_limit=1000000 + g.GetWalks( + input=[ + g.EntitySeed( + vertex=1 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.IsMoreThan( + value=3, + or_equal_to=False + ) + ) + ] + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge1", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "count" + ], + predicate=g.IsMoreThan( + value=8, + or_equal_to=False + ) + ) + ] + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ) + ], + results_limit=1000000 ) ``` @@ -3044,7 +3044,7 @@ The examples for GetWalks use a modified graph. This graph contains two differen ??? example "Example getting walks with entities" Gets all of the Walks of length 2 which start from vertex 1, with all of the entities which are attached to the vertices found along the way. - + === "Java" ``` java @@ -3129,79 +3129,79 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=1 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity1" - ), - g.ElementDefinition( - group="entity" - ) - ], - edges=[ - g.ElementDefinition( - group="edge" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity1" - ) - ], - edges=[ - g.ElementDefinition( - group="edge1" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity1" - ), - g.ElementDefinition( - group="entity" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ) - ], - results_limit=1000000 + g.GetWalks( + input=[ + g.EntitySeed( + vertex=1 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity1" + ), + g.ElementDefinition( + group="entity" + ) + ], + edges=[ + g.ElementDefinition( + group="edge" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity1" + ) + ], + edges=[ + g.ElementDefinition( + group="edge1" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity1" + ), + g.ElementDefinition( + group="entity" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ) + ], + results_limit=1000000 ) ``` @@ -3323,7 +3323,7 @@ The examples for GetWalks use a modified graph. This graph contains two differen ??? example "Example getting walks with filtering on cardinality entities from first hop" Gets all of the Walks of length 2 which start from vertex 5, where the results of the first hop are filtered based on the cardinality entities in the graph. - + === "Java" ``` java @@ -3456,122 +3456,122 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=5 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="cardinality", - pre_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "edgeGroup" - ], - predicate=g.IsEqual( - value={'java.util.TreeSet': ['edge']} - ) - ) - ], - post_aggregation_filter_functions=[ - g.PredicateContext( - selection=[ - "hllp" - ], - predicate=g.HyperLogLogPlusIsLessThan( - value=2, - or_equal_to=False - ) - ) - ], - group_by=[ - ] - ) - ], - all_edges=False, - all_entities=False - ) - ), - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity1" - ), - g.ElementDefinition( - group="entity" - ) - ], - edges=[ - g.ElementDefinition( - group="edge" - ), - g.ElementDefinition( - group="edge1" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity1" - ), - g.ElementDefinition( - group="entity" - ) - ], - edges=[ - g.ElementDefinition( - group="edge" - ), - g.ElementDefinition( - group="edge1" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity1" - ), - g.ElementDefinition( - group="entity" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ) - ], - results_limit=1000000 + g.GetWalks( + input=[ + g.EntitySeed( + vertex=5 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="cardinality", + pre_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "edgeGroup" + ], + predicate=g.IsEqual( + value=g.tree_set(['edge']) + ) + ) + ], + post_aggregation_filter_functions=[ + g.PredicateContext( + selection=[ + "hllp" + ], + predicate=g.HyperLogLogPlusIsLessThan( + value=2, + or_equal_to=False + ) + ) + ], + group_by=[ + ] + ) + ], + all_edges=False, + all_entities=False + ) + ), + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity1" + ), + g.ElementDefinition( + group="entity" + ) + ], + edges=[ + g.ElementDefinition( + group="edge" + ), + g.ElementDefinition( + group="edge1" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity1" + ), + g.ElementDefinition( + group="entity" + ) + ], + edges=[ + g.ElementDefinition( + group="edge" + ), + g.ElementDefinition( + group="edge1" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity1" + ), + g.ElementDefinition( + group="entity" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ) + ], + results_limit=1000000 ) ``` @@ -3693,7 +3693,7 @@ The examples for GetWalks use a modified graph. This graph contains two differen ??? example "Example getting walks with filtering on cardinality entities contained in walk" Gets all of the Walks of length 2 which start from vertex 5, where each Walk returned in the results is filtered based on total of the count property on the walks' edges being less than 11. - + === "Java" ``` java @@ -3831,116 +3831,116 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=5 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity1" - ), - g.ElementDefinition( - group="entity" - ) - ], - edges=[ - g.ElementDefinition( - group="edge" - ), - g.ElementDefinition( - group="edge1" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity1" - ), - g.ElementDefinition( - group="entity" - ) - ], - edges=[ - g.ElementDefinition( - group="edge" - ), - g.ElementDefinition( - group="edge1" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - entities=[ - g.ElementDefinition( - group="entity1" - ), - g.ElementDefinition( - group="entity" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ) - ], - results_limit=1000000, - conditional=g.Conditional( - predicate=g.IsLessThan( - value=11, - or_equal_to=False - ), - transform=g.OperationChain( - operations=[ - g.Map( - functions=[ - g.ExtractWalkEdges(), - g.IterableConcat() - ] - ), - g.ForEach( - operation=g.Map( - functions=[ - g.ExtractProperty( - name="count" - ) - ] - ) - ), - g.Reduce( - aggregate_function=g.Sum() - ) - ] - ) - ) + g.GetWalks( + input=[ + g.EntitySeed( + vertex=5 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity1" + ), + g.ElementDefinition( + group="entity" + ) + ], + edges=[ + g.ElementDefinition( + group="edge" + ), + g.ElementDefinition( + group="edge1" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity1" + ), + g.ElementDefinition( + group="entity" + ) + ], + edges=[ + g.ElementDefinition( + group="edge" + ), + g.ElementDefinition( + group="edge1" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + entities=[ + g.ElementDefinition( + group="entity1" + ), + g.ElementDefinition( + group="entity" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ) + ], + results_limit=1000000, + conditional=g.Conditional( + predicate=g.IsLessThan( + value=11, + or_equal_to=False + ), + transform=g.OperationChain( + operations=[ + g.Map( + functions=[ + g.ExtractWalkEdges(), + g.IterableConcat() + ] + ), + g.ForEach( + operation=g.Map( + functions=[ + g.ExtractProperty( + name="count" + ) + ] + ) + ), + g.Reduce( + aggregate_function=g.Sum() + ) + ] + ) + ) ) ``` @@ -4011,7 +4011,7 @@ The examples for GetWalks use a modified graph. This graph contains two differen ??? example "Example getting walks with multiple groups" Gets all of the Walks of length 2 which start from vertex 1. The IncludeIncomingOutgoingType flag can be used to determine which edge direction the Walk follows for each hop. Additionally, the group set in the view is used to only travel down certain edges in each hop. - + === "Java" ``` java @@ -4071,47 +4071,47 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=1 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge1" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ) - ], - results_limit=1000000 + g.GetWalks( + input=[ + g.EntitySeed( + vertex=1 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge1" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ) + ], + results_limit=1000000 ) ``` @@ -4191,7 +4191,7 @@ The examples for GetWalks use a modified graph. This graph contains two differen ??? example "Example getting walks with loops" Gets all of the Walks of length 6 which start from vertex 1, with the added restriction that all edges must be traversed using the source as the matched vertex. This demonstrates the behaviour when previously traversed edges are encountered again. - + === "Java" ``` java @@ -4271,57 +4271,57 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=1 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ) - ], - results_limit=1000000 + g.GetWalks( + input=[ + g.EntitySeed( + vertex=1 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ) + ], + results_limit=1000000 ) ``` @@ -5151,7 +5151,7 @@ The examples for GetWalks use a modified graph. This graph contains two differen ??? example "Example getting walks with self loops" Gets all of the Walks of length 3 which start from vertex 8, with the added restriction that all edges must be traversed using the source as the matched vertex. This demonstrates the behaviour when self loops exist in the graph. - + === "Java" ``` java @@ -5204,36 +5204,36 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=8 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - include_incoming_out_going="OUTGOING" - ) - ] - ) - ], - results_limit=1000000 + g.GetWalks( + input=[ + g.EntitySeed( + vertex=8 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + include_incoming_out_going="OUTGOING" + ) + ] + ) + ], + results_limit=1000000 ) ``` @@ -6072,7 +6072,7 @@ The examples for GetWalks use a modified graph. This graph contains two differen ??? example "Example getting walks with additional operations" Gets all of the Walks of length 2 which start from vertex 5, where an additional operation is inserted between the GetElements operations used to retrieve elements. - + === "Java" ``` java @@ -6147,61 +6147,61 @@ The examples for GetWalks use a modified graph. This graph contains two differen === "Python" ``` python - g.GetWalks( - input=[ - g.EntitySeed( - vertex=5 - ) - ], - operations=[ - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge" - ), - g.ElementDefinition( - group="edge1" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ), - g.Sort( - comparators=[ - g.ElementPropertyComparator( - groups=[ - ], - property="count", - reversed=False - ) - ], - deduplicate=True - ) - ] - ), - g.OperationChain( - operations=[ - g.GetElements( - view=g.View( - edges=[ - g.ElementDefinition( - group="edge1" - ) - ], - all_edges=False, - all_entities=False - ), - include_incoming_out_going="INCOMING" - ) - ] - ) - ], - results_limit=1000000 + g.GetWalks( + input=[ + g.EntitySeed( + vertex=5 + ) + ], + operations=[ + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge" + ), + g.ElementDefinition( + group="edge1" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ), + g.Sort( + comparators=[ + g.ElementPropertyComparator( + groups=[ + ], + property="count", + reversed=False + ) + ], + deduplicate=True + ) + ] + ), + g.OperationChain( + operations=[ + g.GetElements( + view=g.View( + edges=[ + g.ElementDefinition( + group="edge1" + ) + ], + all_edges=False, + all_entities=False + ), + include_incoming_out_going="INCOMING" + ) + ] + ) + ], + results_limit=1000000 ) ``` diff --git a/docs/reference/predicates-guide/koryphe-predicates.md b/docs/reference/predicates-guide/koryphe-predicates.md index 0159511686..a3766b8a49 100644 --- a/docs/reference/predicates-guide/koryphe-predicates.md +++ b/docs/reference/predicates-guide/koryphe-predicates.md @@ -28,13 +28,13 @@ Input type: `java.lang.Long` === "Python" ``` python - g.AgeOff( - age_off_time=100000 + g.AgeOff( + age_off_time=100000 ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.String | ClassCastException: java.lang.String cannot be cast to java.lang.Long @@ -81,22 +81,22 @@ Input type: `uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType` === "Python" ``` python - g.And( - predicates=[ - g.IsLessThan( - value=3, - or_equal_to=False - ), - g.IsMoreThan( - value=0, - or_equal_to=False - ) - ] + g.And( + predicates=[ + g.IsLessThan( + value=3, + or_equal_to=False + ), + g.IsMoreThan( + value=0, + or_equal_to=False + ) + ] ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 0 | false @@ -148,32 +148,32 @@ Input type: `uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType` === "Python" ``` python - g.And( - predicates=[ - g.NestedPredicate( - selection=[ - 0 - ], - predicate=g.IsLessThan( - value=2, - or_equal_to=False - ) - ), - g.NestedPredicate( - selection=[ - 1 - ], - predicate=g.IsMoreThan( - value=5, - or_equal_to=False - ) - ) - ] + g.And( + predicates=[ + g.NestedPredicate( + selection=[ + 0 + ], + predicate=g.IsLessThan( + value=2, + or_equal_to=False + ) + ), + g.NestedPredicate( + selection=[ + 1 + ], + predicate=g.IsMoreThan( + value=5, + or_equal_to=False + ) + ) + ] ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Integer, java.lang.Integer] | [1, 10] | true @@ -211,9 +211,9 @@ Input type: `java.lang.Object, java.lang.Object` ``` python g.AreEqual() ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Integer, java.lang.Double] | [1, 1.0] | false @@ -248,17 +248,17 @@ Input type: `java.util.Collection` === "Python" ``` python - g.AreIn( - values=[ - 1, - 2, - 3 - ] + g.AreIn( + values=[ + 1, + 2, + 3 + ] ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.HashSet | [1, 2, 3] | true @@ -294,13 +294,13 @@ Input type: `java.util.Collection` === "Python" ``` python - g.CollectionContains( - value=1 + g.CollectionContains( + value=1 ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.HashSet | [1, 2, 3] | true @@ -336,9 +336,9 @@ Input type: `java.lang.Object` ``` python g.Exists() ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | true @@ -356,7 +356,7 @@ Input type: `uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType` ??? example "Example conditionally applying predicates to input" This example tests first whether the input is an Integer. If so, it is then tested to see if the value is greater than 3. Otherwise, since it is not an Integer, we then test to see if it is NOT a String. - + === "Java" ``` java @@ -390,24 +390,24 @@ Input type: `uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType` === "Python" ``` python - g.If( - predicate=g.IsA( - type="java.lang.Integer" - ), - then=g.IsMoreThan( - value=3, - or_equal_to=False - ), - otherwise=g.Not( - predicate=g.IsA( - type="java.lang.String" - ) - ) + g.If( + predicate=g.IsA( + type="java.lang.Integer" + ), + then=g.IsMoreThan( + value=3, + or_equal_to=False + ), + otherwise=g.Not( + predicate=g.IsA( + type="java.lang.String" + ) + ) ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 2 | false @@ -463,25 +463,25 @@ Input type: `uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType` === "Python" ``` python - g.Or( - predicates=[ - g.IsLessThan( - value=2, - or_equal_to=False - ), - g.IsEqual( - value=5 - ), - g.IsMoreThan( - value=10, - or_equal_to=False - ) - ] + g.Or( + predicates=[ + g.IsLessThan( + value=2, + or_equal_to=False + ), + g.IsEqual( + value=5 + ), + g.IsMoreThan( + value=10, + or_equal_to=False + ) + ] ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | true @@ -529,25 +529,25 @@ Input type: `uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType` === "Python" ``` python - g.Or( - predicates=[ - g.IsLessThan( - value=2, - or_equal_to=False - ), - g.IsEqual( - value=5 - ), - g.IsMoreThan( - value=10, - or_equal_to=False - ) - ] + g.Or( + predicates=[ + g.IsLessThan( + value=2, + or_equal_to=False + ), + g.IsEqual( + value=5 + ), + g.IsMoreThan( + value=10, + or_equal_to=False + ) + ] ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | true @@ -601,32 +601,32 @@ Input type: `uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType` === "Python" ``` python - g.Or( - predicates=[ - g.NestedPredicate( - selection=[ - 0 - ], - predicate=g.IsLessThan( - value=2, - or_equal_to=False - ) - ), - g.NestedPredicate( - selection=[ - 1 - ], - predicate=g.IsMoreThan( - value=10, - or_equal_to=False - ) - ) - ] + g.Or( + predicates=[ + g.NestedPredicate( + selection=[ + 0 + ], + predicate=g.IsLessThan( + value=2, + or_equal_to=False + ) + ), + g.NestedPredicate( + selection=[ + 1 + ], + predicate=g.IsMoreThan( + value=10, + or_equal_to=False + ) + ) + ] ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Integer, java.lang.Integer] | [1, 15] | true @@ -665,13 +665,13 @@ Input type: `uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType` === "Python" ``` python - g.Not( - predicate=g.Exists() + g.Not( + predicate=g.Exists() ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | false @@ -702,13 +702,13 @@ Input type: `uk.gov.gchq.koryphe.signature.Signature$UnknownGenericType` === "Python" ``` python - g.Not( - predicate=g.AreEqual() + g.Not( + predicate=g.AreEqual() ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Integer, java.lang.Double] | [1, 1.0] | true @@ -759,14 +759,14 @@ Input type: `java.util.Date` === "Python" ``` python - g.InDateRange( - start="2017/01/01", - end="2017/02/01" + g.InDateRange( + start="2017/01/01", + end="2017/02/01" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.Date | Fri Jan 01 00:00:00 GMT 2016 | false @@ -802,14 +802,14 @@ Input type: `java.util.Date` === "Python" ``` python - g.InDateRange( - start="2017/01/01 01:30:10", - end="2017/01/01 01:30:50" + g.InDateRange( + start="2017/01/01 01:30:10", + end="2017/01/01 01:30:50" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.Date | Sun Jan 01 01:30:09 GMT 2017 | false @@ -844,14 +844,14 @@ Input type: `java.util.Date` === "Python" ``` python - g.InDateRange( - start="1483315200", - end="1485907200" + g.InDateRange( + start="1483315200", + end="1485907200" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.Date | Sun Jan 18 05:01:55 GMT 1970 | false @@ -890,16 +890,16 @@ Input type: `java.util.Date` === "Python" ``` python - g.InDateRange( - start="2017/01/01", - end="2017/02/01", - start_inclusive=False, - end_inclusive=False + g.InDateRange( + start="2017/01/01", + end="2017/02/01", + start_inclusive=False, + end_inclusive=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.Date | Fri Jan 01 00:00:00 GMT 2016 | false @@ -914,7 +914,7 @@ Input type: `java.util.Date` ??? example "Example of within the last week" If the end of the range is not specified then the end of the range is unbounded. - + === "Java" ``` java @@ -938,14 +938,14 @@ Input type: `java.util.Date` === "Python" ``` python - g.InDateRange( - start_offset=-7, - offset_unit="DAY" + g.InDateRange( + start_offset=-7, + offset_unit="DAY" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.Date | Sun Oct 30 11:00:11 GMT 2022 | false @@ -983,16 +983,16 @@ Input type: `java.util.Date` === "Python" ``` python - g.InDateRange( - start_offset=-7, - end_offset=-6, - offset_unit="HOUR", - end_inclusive=False + g.InDateRange( + start_offset=-7, + end_offset=-6, + offset_unit="HOUR", + end_inclusive=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.Date | Mon Nov 07 03:00:12 GMT 2022 | false @@ -1046,16 +1046,16 @@ Input type: `java.util.Date, java.util.Date` === "Python" ``` python - g.InDateRangeDual( - start="2017/03/01", - end="2017/08/01", - start_fully_contained=False, - end_fully_contained=False + g.InDateRangeDual( + start="2017/03/01", + end="2017/08/01", + start_fully_contained=False, + end_fully_contained=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.util.Date, java.util.Date] | [Sun Jan 01 00:00:00 GMT 2017, Wed Feb 01 00:00:00 GMT 2017] | false @@ -1095,16 +1095,16 @@ Input type: `java.util.Date, java.util.Date` === "Python" ``` python - g.InDateRangeDual( - start="2017/03/01", - end="2017/08/01", - start_fully_contained=True, - end_fully_contained=False + g.InDateRangeDual( + start="2017/03/01", + end="2017/08/01", + start_fully_contained=True, + end_fully_contained=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.util.Date, java.util.Date] | [Sun Jan 01 00:00:00 GMT 2017, Wed Feb 01 00:00:00 GMT 2017] | false @@ -1144,11 +1144,11 @@ Input type: `java.util.Date, java.util.Date` === "Python" ``` python - g.InDateRangeDual( - start="2017/03/01", - end="2017/08/01", - start_fully_contained=True, - end_fully_contained=True + g.InDateRangeDual( + start="2017/03/01", + end="2017/08/01", + start_fully_contained=True, + end_fully_contained=True ) ``` @@ -1340,14 +1340,14 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.InRange( - start={'java.lang.Long': 5}, - end={'java.lang.Long': 10} + g.InRange( + start=g.long(5), + end=g.long(10) ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Long | -5 | false @@ -1393,16 +1393,16 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.InRange( - start={'java.lang.Long': 5}, - end={'java.lang.Long': 10}, - start_inclusive=False, - end_inclusive=False + g.InRange( + start=g.long(5), + end=g.long(10), + start_inclusive=False, + end_inclusive=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Long | -5 | false @@ -1419,7 +1419,7 @@ Input type: `java.lang.Comparable` ??? example "Example of Long 5 less than 10" If the start of the range is not specified then the start of the range is unbounded. - + === "Java" ``` java @@ -1444,14 +1444,14 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.InRange( - end={'java.lang.Long': 10}, - end_inclusive=False + g.InRange( + end=g.long(10), + end_inclusive=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Long | -5 | true @@ -1489,14 +1489,14 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.InRange( - start="B", - end="D" + g.InRange( + start="B", + end="D" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.String | A | false @@ -1546,16 +1546,16 @@ Input type: `java.lang.Comparable, java.lang.Comparable` === "Python" ``` python - g.InRangeDual( - start={'java.lang.Long': 5}, - end={'java.lang.Long': 10}, - start_fully_contained=False, - end_fully_contained=False + g.InRangeDual( + start=g.long(5), + end=g.long(10), + start_fully_contained=False, + end_fully_contained=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Long, java.lang.Long] | [1, 4] | false @@ -1598,16 +1598,16 @@ Input type: `java.lang.Comparable, java.lang.Comparable` === "Python" ``` python - g.InRangeDual( - start={'java.lang.Long': 5}, - end={'java.lang.Long': 10}, - start_fully_contained=True, - end_fully_contained=False + g.InRangeDual( + start=g.long(5), + end=g.long(10), + start_fully_contained=True, + end_fully_contained=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Long, java.lang.Long] | [1, 4] | false @@ -1650,16 +1650,16 @@ Input type: `java.lang.Comparable, java.lang.Comparable` === "Python" ``` python - g.InRangeDual( - start={'java.lang.Long': 5}, - end={'java.lang.Long': 10}, - start_fully_contained=True, - end_fully_contained=True + g.InRangeDual( + start=g.long(5), + end=g.long(10), + start_fully_contained=True, + end_fully_contained=True ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Long, java.lang.Long] | [1, 4] | false @@ -1673,7 +1673,7 @@ Input type: `java.lang.Comparable, java.lang.Comparable` ??? example "Example Long less than 10" If the start of the range is not specified then the start of the range is unbounded. - + === "Java" ``` java @@ -1698,14 +1698,14 @@ Input type: `java.lang.Comparable, java.lang.Comparable` === "Python" ``` python - g.InRangeDual( - end={'java.lang.Long': 10}, - end_inclusive=False + g.InRangeDual( + end=g.long(10), + end_inclusive=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Long, java.lang.Long] | [-5, -1] | true @@ -1751,15 +1751,15 @@ Input type: `java.lang.Long` === "Python" ``` python - g.InTimeRange( - start="2017/01/01 01:30:10", - end="2017/01/01 01:30:50", - time_unit="MICROSECOND" + g.InTimeRange( + start="2017/01/01 01:30:10", + end="2017/01/01 01:30:50", + time_unit="MICROSECOND" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Long | 1483234209000000 | false @@ -1800,13 +1800,13 @@ Input type: `java.lang.Object` === "Python" ``` python - g.IsA( - type="java.lang.String" + g.IsA( + type="java.lang.String" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | false @@ -1834,13 +1834,13 @@ Input type: `java.lang.Object` === "Python" ``` python - g.IsA( - type="java.lang.Number" + g.IsA( + type="java.lang.Number" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | true @@ -1874,13 +1874,13 @@ Input type: `java.lang.Object` === "Python" ``` python - g.IsEqual( - value=5 + g.IsEqual( + value=5 ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 5 | true @@ -1909,13 +1909,13 @@ Input type: `java.lang.Object` === "Python" ``` python - g.IsEqual( - value="5" + g.IsEqual( + value="5" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 5 | false @@ -1951,9 +1951,9 @@ Input type: `java.lang.Boolean` ``` python g.IsFalse() ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Boolean | true | false @@ -1989,9 +1989,9 @@ Input type: `java.lang.Boolean` ``` python g.IsTrue() ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Boolean | true | true @@ -2030,18 +2030,18 @@ Input type: `java.lang.Object` === "Python" ``` python - g.IsIn( - values=[ - 5, - {'java.lang.Long': 5}, - "5", - {'java.lang.Character': '5'} - ] + g.IsIn( + values=[ + 5, + g.long(5), + "5", + {'java.lang.Character': '5'} + ] ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 5 | true @@ -2081,14 +2081,14 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.IsLessThan( - value=5, - or_equal_to=False + g.IsLessThan( + value=5, + or_equal_to=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | true @@ -2121,14 +2121,14 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.IsLessThan( - value=5, - or_equal_to=True + g.IsLessThan( + value=5, + or_equal_to=True ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | true @@ -2161,14 +2161,14 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.IsLessThan( - value="B", - or_equal_to=False + g.IsLessThan( + value="B", + or_equal_to=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | false @@ -2204,14 +2204,14 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.IsMoreThan( - value=5, - or_equal_to=False + g.IsMoreThan( + value=5, + or_equal_to=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | false @@ -2240,14 +2240,14 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.IsMoreThan( - value=5, - or_equal_to=True + g.IsMoreThan( + value=5, + or_equal_to=True ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | false @@ -2276,14 +2276,14 @@ Input type: `java.lang.Comparable` === "Python" ``` python - g.IsMoreThan( - value="B", - or_equal_to=False + g.IsMoreThan( + value="B", + or_equal_to=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.Integer | 1 | false @@ -2319,14 +2319,14 @@ Input type: `java.lang.Object` === "Python" ``` python - g.IsLongerThan( - min_length=5, - or_equal_to=False + g.IsLongerThan( + min_length=5, + or_equal_to=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.String | testString | true @@ -2357,14 +2357,14 @@ Input type: `java.lang.Object` === "Python" ``` python - g.IsLongerThan( - min_length=5, - or_equal_to=True + g.IsLongerThan( + min_length=5, + or_equal_to=True ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.String | test | false @@ -2402,14 +2402,14 @@ Input type: `java.lang.Object` === "Python" ``` python - g.IsShorterThan( - max_length=4, - or_equal_to=False + g.IsShorterThan( + max_length=4, + or_equal_to=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.String | 123 | true @@ -2451,9 +2451,9 @@ Input type: `java.lang.Comparable, java.lang.Comparable` ``` python g.IsXLessThanY() ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Integer, java.lang.Integer] | [1, 5] | true @@ -2496,9 +2496,9 @@ Input type: `java.lang.Comparable, java.lang.Comparable` ``` python g.IsXMoreThanY() ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ [java.lang.Integer, java.lang.Integer] | [1, 5] | false @@ -2540,13 +2540,13 @@ Input type: `java.util.Map` === "Python" ``` python - g.MapContains( - key="a" + g.MapContains( + key="a" ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.HashMap | {a=1, b=2, c=3} | true @@ -2585,19 +2585,15 @@ Input type: `java.util.Map` === "Python" ``` python - { - "class" : "uk.gov.gchq.koryphe.impl.predicate.MapContainsPredicate", - "keyPredicate" : { - "class" : "uk.gov.gchq.koryphe.impl.predicate.Regex", - "value" : { - "java.util.regex.Pattern" : "a.*" - } - } - } + g.MapContainsPredicate( + key_predicate=g.Regex( + value={"java.util.regex.Pattern": "a.*"} + ) + ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.HashMap | {a1=1, a2=2, b=2, c=3} | true @@ -2638,17 +2634,17 @@ Input type: `java.util.Map` === "Python" ``` python - g.PredicateMap( - key="key1", - predicate=g.IsMoreThan( - value={'java.lang.Long': 2}, - or_equal_to=False - ) + g.PredicateMap( + key="key1", + predicate=g.IsMoreThan( + value=g.long(2), + or_equal_to=False + ) ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ uk.gov.gchq.gaffer.types.FreqMap | {key1=1} | false @@ -2685,17 +2681,17 @@ Input type: `java.util.Map` === "Python" ``` python - g.PredicateMap( - key="key1", - predicate=g.IsMoreThan( - value={'java.lang.Long': 2}, - or_equal_to=True - ) + g.PredicateMap( + key="key1", + predicate=g.IsMoreThan( + value=g.long(2), + or_equal_to=True + ) ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ uk.gov.gchq.gaffer.types.FreqMap | {key1=1} | false @@ -2730,14 +2726,14 @@ Input type: `java.util.Map` === "Python" ``` python - g.PredicateMap( - key={'java.util.Date': 0}, - predicate=g.Exists() + g.PredicateMap( + key=g.date(0), + predicate=g.Exists() ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.util.HashMap | {Thu Jan 01 01:00:00 GMT 1970=1} | true @@ -2749,7 +2745,7 @@ Input type: `java.util.Map` Checks if a string contains some value. [Javadoc](https://gchq.github.io/koryphe/uk/gov/gchq/koryphe/impl/predicate/StringContains.html) !!! note - + The StringContains predicate is case sensitive by default, hence only exact matches are found. Input type: `java.lang.String` @@ -2775,14 +2771,14 @@ Input type: `java.lang.String` === "Python" ``` python - g.StringContains( - value="test", - ignore_case=False + g.StringContains( + value="test", + ignore_case=False ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.String | This is a Test | false @@ -2811,14 +2807,14 @@ Input type: `java.lang.String` === "Python" ``` python - g.StringContains( - value="test", - ignore_case=True + g.StringContains( + value="test", + ignore_case=True ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.String | This is a Test | true @@ -2855,13 +2851,13 @@ Input type: `java.lang.String` === "Python" ``` python - g.Regex( - value={'java.util.regex.Pattern': '[a-d0-4]'} + g.Regex( + value={'java.util.regex.Pattern': '[a-d0-4]'} ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.String | a | true @@ -2903,16 +2899,16 @@ Input type: `java.lang.String` === "Python" ``` python - g.MultiRegex( - value=[ - {'java.util.regex.Pattern': '[a-d]'}, - {'java.util.regex.Pattern': '[0-4]'} - ] + g.MultiRegex( + value=[ + {'java.util.regex.Pattern': '[a-d]'}, + {'java.util.regex.Pattern': '[0-4]'} + ] ) ``` - + Example inputs: - + Input Type | Input | Result ---------- | ----- | ------ java.lang.String | a | true diff --git a/docs/user-guide/apis/python-api.md b/docs/user-guide/apis/python-api.md index 4ca1a02abb..fc6a17d0ed 100644 --- a/docs/user-guide/apis/python-api.md +++ b/docs/user-guide/apis/python-api.md @@ -48,7 +48,7 @@ accessed via the `GafferConnector` where users can then query graphs by executin ```python elements = gc.execute_operation( - operation = g.GetAllElements() + operation=g.GetAllElements() ) ``` @@ -59,7 +59,7 @@ accessed via the `GafferConnector` where users can then query graphs by executin ```python count = gc.execute_operation_chain( - operation_chain = g.OperationChain( + operation_chain=g.OperationChain( operations=[ g.GetAllElements(), g.Count() diff --git a/docs/user-guide/query/gaffer-syntax/filtering.md b/docs/user-guide/query/gaffer-syntax/filtering.md index d376ef8e52..06e78c154e 100644 --- a/docs/user-guide/query/gaffer-syntax/filtering.md +++ b/docs/user-guide/query/gaffer-syntax/filtering.md @@ -138,7 +138,7 @@ associated with it. Then we can apply a filter to include only edges where the g.PredicateContext( selection = ['weight'], predicate = g.IsMoreThan( - value = {'java.lang.Float': 0.4}, + value = g.float_(0.4), or_equal_to = False ) ) @@ -538,7 +538,7 @@ These examples show including global properties in the filter, excluded global p === "Python" ```python - viewWithGlobalElements = g.View( + view_with_global_filter = g.View( global_elements=[ g.GlobalElementDefinition( properties=["weight"] @@ -593,7 +593,7 @@ Global View definitions can also be used to filter all elements for specific pro === "Python" ```python - viewWithGlobalElements = g.View( + view_with_global_filter = g.View( global_elements=[ g.GlobalElementDefinition( post_aggregation_filter_functions=[ @@ -660,7 +660,7 @@ specific filters using an AND operator. === "Python" ```python - globalAndSpecificFilter = g.View( + global_and_specific_filter = g.View( entities=[ g.ElementDefinition( group="Person", @@ -1144,7 +1144,7 @@ If you apply some pre-aggregation filtering, you can also select a time window t === "Python" ```python - elements = c.execute_operation( + elements = gc.execute_operation( operation = g.GetElements( input = [g.EntitySeed(vertex = "John")], view = g.View( diff --git a/docs/user-guide/query/gaffer-syntax/operations.md b/docs/user-guide/query/gaffer-syntax/operations.md index af9abe8dfa..f2778b8ea0 100644 --- a/docs/user-guide/query/gaffer-syntax/operations.md +++ b/docs/user-guide/query/gaffer-syntax/operations.md @@ -73,7 +73,7 @@ based on their ID. To do this we can use the `GetElements` operation and set the ```python elements = gc.execute_operation( - operation = g.GetElements(input = [g.EntitySeed(vertex = "v1")]) + operation=g.GetElements(input=[g.EntitySeed(vertex="v1")]) ) ``` @@ -122,9 +122,9 @@ how many entities the `GetElements` returned. ```python count = gc.execute_operation_chain( - operation_chain = g.OperationChain( + operation_chain=g.OperationChain( operations=[ - g.GetElements(input = [g.EntitySeed(vertex = "v1")]), + g.GetElements(input=[g.EntitySeed(vertex="v1")]), g.Count() ] ) diff --git a/docs/user-guide/query/gremlin/custom-features.md b/docs/user-guide/query/gremlin/custom-features.md index e30328abd2..0635abedf2 100644 --- a/docs/user-guide/query/gremlin/custom-features.md +++ b/docs/user-guide/query/gremlin/custom-features.md @@ -120,7 +120,7 @@ available. # Establish client connection client = client.Client('ws://localhost:8080/gremlin', 'g', message_serializer=GraphSONSerializersV3d0()) - results = client.submit("g.V().values('count').map(cypherToString()).toList()") + results = client.submit("g.V().values('count').map(cypherToString()).toList()") results.all().result() ```