[ 
https://issues.apache.org/jira/browse/TINKERPOP-2727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17514658#comment-17514658
 ] 

ASF GitHub Bot commented on TINKERPOP-2727:
-------------------------------------------

FlorianHockmann commented on a change in pull request #1596:
URL: https://github.com/apache/tinkerpop/pull/1596#discussion_r838467234



##########
File path: docs/src/reference/the-traversal.asciidoc
##########
@@ -1434,6 +1436,15 @@ the key,value pairs for those vertices.
 <6> Find all age-properties and emit their value.
 <7> Find all vertices that do not have an age-property and emit their name.
 <8> Find all "person" vertices that have a name property that starts with the 
letter "m".
+<9> Property key values cannot be `null` and therefore produces no matches.

Review comment:
       Not that important, but _produce_ without an _s_, right?

##########
File path: docs/src/reference/the-traversal.asciidoc
##########
@@ -1434,6 +1436,15 @@ the key,value pairs for those vertices.
 <6> Find all age-properties and emit their value.
 <7> Find all vertices that do not have an age-property and emit their name.
 <8> Find all "person" vertices that have a name property that starts with the 
letter "m".
+<9> Property key values cannot be `null` and therefore produces no matches.
+<10> An example of `has()` where the argument is a `Traversal` and does not 
quite behave the way most expect.
+
+Item 10 in the above set of examples bears some discussion. The behavior is 
not such that the result of the `Traversal`
+is used as the comparing value for `has()`, but the current `Traverser`, which 
in this case is the vertex `label`, is
+given to the `Traversal` to behave as a filter itself. In other words, if the 
`Traversal` (i.e. `is('person')`) returns
+a value then the `has()` is effectively `true`. A common mistake is to try to 
use `select()` in this context where one
+would do `has('name', select('n'))` to try to inject the value of "n" into the 
step to get `has('name', <value-of-n>)`,

Review comment:
       Oh wow, good explanation. I expected `has()` to behave this way with the 
`is()` step, but I would also have expected it to work with `select()` like you 
described here. Good to know!

##########
File path: gremlin-test/features/filter/Has.feature
##########
@@ -804,6 +813,48 @@ Feature: Step - has()
     When iterated to list
     Then the result should be empty
 
+  Scenario: g_V_hasXlabel_personX
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().has(T.label, "person")
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+      | v[vadas] |
+      | v[josh] |
+      | v[peter] |
+
+  Scenario: g_V_hasXlabel_eqXpersonXX
+    Given the modern graph
+    And the traversal of
+    """
+    g.V().has(T.label, eq("person"))
+    """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+      | v[vadas] |
+      | v[josh] |
+      | v[peter] |
+
+  Scenario: g_V_hasXlabel_constantXpersonXX

Review comment:
       Shouldn't this be named `g_V_hasXlabel_isXpersonXX`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


> HasContainer should allow a null key
> ------------------------------------
>
>                 Key: TINKERPOP-2727
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2727
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.5.2
>            Reporter: Florian Hockmann
>            Priority: Minor
>
> TINKERPOP-2605 changed {{null}} semantics to allow {{null}} as an argument in 
> more places so that {{has(null)}} should not throw a NPE any more and instead 
> filter all traversers out.
> {{HasContainer}} however still throws a NPE if the {{key}} is {{{}null{}}}.
> I discovered this when trying to update JanusGraph [as that folds in a 
> {{HasContainer}} like 
> this|https://github.com/JanusGraph/janusgraph/blob/4246d49cee46d549d752515f3956cd2d59f1fd0a/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/optimize/step/HasStepFolder.java#L266]
>  which leads to the NPE and thus failing tests.
> The same behavior can also be produced with just TinkerGraph and for example 
> the following traversals:
> {code:java}
> g.V().has(null, 1)
> g.V().has(null, P.neq(null)){code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to