You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Daniel Weber (Jira)" <ji...@apache.org> on 2025/12/22 16:43:00 UTC

[jira] [Updated] (TINKERPOP-3223) Argument to SubgraphStrategy.Builder.edges changes semantics when used along vertices

     [ https://issues.apache.org/jira/browse/TINKERPOP-3223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Weber updated TINKERPOP-3223:
------------------------------------
    Description: 
Setup: Any TinkerGraph with vertices and edges with long-Ids.

The arguments to SubgraphStrategy.Builder.vertices and edges are supposed to be predicate-traversals, i.e. edges and vertices are only to be considered part of the subgraph if the predicate traversal yields a result. This works for  

{{g.withStrategies(SubgraphStrategy.build().vertices(id().is(lt(42L))).create()).V() / .E()}}

{{and}}

{{g.withStrategies(SubgraphStrategy.build().edges(id().is(lt(4L))).create()).V() / .E()}}

however, if used together, the edges-traversal suddenly becomes somewhat of a failed cast on edges:

{{g.withStrategies(SubgraphStrategy.build().edges(id().is(lt(8L))).vertices(id().is(lt(4L))).create()).E()}} yields

class java.lang.Long cannot be cast to class org.apache.tinkerpop.gremlin.structure.Edge (java.lang.Long is in module java.base of loader 'bootstrap'; org.apache.tinkerpop.gremlin.structure.Edge is in unnamed module of loader 'app')

It does work, however, if the filter is made explicit: 

{{g.withStrategies(SubgraphStrategy.build().edges(filter(id().is(lt(8L)))).vertices(id().is(lt(4L))).create()).E()}}

  was:
Setup: Any TinkerGraph with vertices and edges with long-Ids.

The arguments to SubgraphStrategy.Builder.vertices and edges are supposed to be predicate-traversals, i.e. edges and vertices are only to be considered part of the subgraph if the predicate traversal yields a result. This works for  

{{g.withStrategies(SubgraphStrategy.build().vertices(id().is(lt(42L))).create()).V() / .E()}}

{{and}}

{{g.withStrategies(SubgraphStrategy.build().edges(id().is(lt(4L))).create()).V() / .E()}}

however, if used together, the edges-traversal suddenly becomes somewhat of a failed cast on edges:

{{g.withStrategies(SubgraphStrategy.build().edges(id().is(lt(8L))).vertices(id().is(lt(4L))).create()).E()}} yields

class java.lang.Long cannot be cast to class org.apache.tinkerpop.gremlin.structure.Edge (java.lang.Long is in module java.base of loader 'bootstrap'; org.apache.tinkerpop.gremlin.structure.Edge is in unnamed module of loader 'app')

 

It does work, however, if the filter is made explicit: 

{{g.withStrategies(SubgraphStrategy.build().edges(filter(id().is(lt(8L)))).vertices(id().is(lt(4L))).create()).E()}}


> Argument to SubgraphStrategy.Builder.edges changes semantics when used along vertices
> -------------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-3223
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3223
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.8.0, 3.7.5
>         Environment: Gremlin Console, Windows 11
> GremlinServer on Docker.
>            Reporter: Daniel Weber
>            Priority: Minor
>
> Setup: Any TinkerGraph with vertices and edges with long-Ids.
> The arguments to SubgraphStrategy.Builder.vertices and edges are supposed to be predicate-traversals, i.e. edges and vertices are only to be considered part of the subgraph if the predicate traversal yields a result. This works for  
> {{g.withStrategies(SubgraphStrategy.build().vertices(id().is(lt(42L))).create()).V() / .E()}}
> {{and}}
> {{g.withStrategies(SubgraphStrategy.build().edges(id().is(lt(4L))).create()).V() / .E()}}
> however, if used together, the edges-traversal suddenly becomes somewhat of a failed cast on edges:
> {{g.withStrategies(SubgraphStrategy.build().edges(id().is(lt(8L))).vertices(id().is(lt(4L))).create()).E()}} yields
> class java.lang.Long cannot be cast to class org.apache.tinkerpop.gremlin.structure.Edge (java.lang.Long is in module java.base of loader 'bootstrap'; org.apache.tinkerpop.gremlin.structure.Edge is in unnamed module of loader 'app')
> It does work, however, if the filter is made explicit: 
> {{g.withStrategies(SubgraphStrategy.build().edges(filter(id().is(lt(8L)))).vertices(id().is(lt(4L))).create()).E()}}



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