This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit def6f26306ac3482fca8c8df3bd0a5edd8377182 Author: Stephen Mallette <[email protected]> AuthorDate: Thu Jul 16 13:33:55 2026 -0400 Document hasLabel() label matching semantics hasLabel() tests each label an element carries, so a negation predicate retains multi-label vertices that carry the label. Assisted-by: Claude Code:claude-opus-4-8 --- docs/src/dev/provider/gremlin-semantics.asciidoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/src/dev/provider/gremlin-semantics.asciidoc b/docs/src/dev/provider/gremlin-semantics.asciidoc index 3674136d64..6fd002bf71 100644 --- a/docs/src/dev/provider/gremlin-semantics.asciidoc +++ b/docs/src/dev/provider/gremlin-semantics.asciidoc @@ -2009,6 +2009,13 @@ None * Equivalent to `has(T.label, ...)`. * Child traversals must be read-only; mutating steps are rejected with an `Argument Error`. +The label test is applied to each label the element carries and the element is retained when at least one label +satisfies it. For single-label elements this is equivalent to testing the label directly. For multi-label vertices a +negation predicate therefore retains any vertex carrying at least one other label, so a vertex labelled both "person" +and "employee" satisfies `hasLabel(neq("person"))`. Excluding every element that carries a given label requires +`not(hasLabel("person"))`. The same rule makes `hasLabel("a", "b")` a disjunction, matching when either label is +present, while chained `hasLabel("a").hasLabel("b")` is a conjunction. + *Exceptions:* * An `Argument Error` is raised if a child traversal contains mutating steps.
