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

Yang Xia commented on TINKERPOP-3119:
-------------------------------------

Hi [~mcw], thanks for opening this request. I can see it being convenient with 
materialized properties in 3.7. I’m just wondering if that’s the use case you 
are referring to with vertex[key]? As opposed to getting the property using 
values(), or from a map using valueMap() via a traversal.

In any case, you are welcome to implement this feature if you have the idea for 
it, and we’ll be happy to review any PRs.

> Have the gremlin_python Vertex class support key-value access of individual 
> properties
> --------------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-3119
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3119
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: python
>    Affects Versions: 3.7.3
>            Reporter: Matt C. Wilson
>            Priority: Minor
>
> The gremlin_python `{{Element}}` class (and thus all Graph object subclasses) 
> has a `{{properties}}` property that must be iterated and each member 
> inspected to find a particular property by name.
> [https://github.com/apache/tinkerpop/blob/8aad0bc72a1d11791ddbd5070962caa23223bf3d/gremlin-python/src/main/python/gremlin_python/structure/graph.py#L29-L39|https://github.com/apache/tinkerpop/blob/master/gremlin-python/src/main/python/gremlin_python/structure/graph.py]
> Example: 
> {{for vp in vertex.properties:}}
> {{  if vp.key == key:}}
> {{    logging.debug(f"\vertex.properties['\\key']: \vp.value")}}
> {{    return vp.value}}
> It would be nice to be able to do:
> {{p = vertex.properties}}
> {{return vertex[key] if p and p.hasattr(key) else None}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to