Closed debug-ito closed 4 years ago
I'm asking Gremlin Users on Google Groups about it
This is neither bug report nor feature request, as I don't know whether these issues fall inside the intended scope of Greskell, but they seem worth reporting.
If I understand this closed Tinkerpop issue correctly (I've asked the Gremlin list for confirmation here), Gremlin intentionally omits properties from GraphSON element requests in order to conserve bandwidth. The properties (values as well as labels) are still available to a .properties() step:
gremlin> :> g.V().hasLabel("person")
==>[@type:g:List,@value:[[@type:g:Vertex,@value:[id:[@type:g:Int64,@value:0],label:person]]]]
gremlin> :> g.V().hasLabel("person").properties()
==>[@type:g:List,@value:[[@type:g:VertexProperty,@value:[id:[@type:g:Int64,@value:-2042816215],value:[@type:g:Int32,@value:11],label:suchness]]]]
as well as (more simply) to a .values() step:
gremlin> :> g.V().hasLabel("person").values()
==>[@type:g:List,@value:[[@type:g:Int32,@value:11]]]
gremlin> :> g.V().hasLabel("person").values("suchness")
==>[@type:g:List,@value:[[@type:g:Int32,@value:11]]]
If I run what seem to be the equivalent queries in Greskell:
findPeopleProperties =
( source "g" & sV' [] )
&. ( gHasLabel "person"
>>> gValues ["suchness"]
)
findPeopleValues props =
( source "g" & sV' [] )
&. ( gHasLabel "person"
>>> gValues props
)
I see the property, but no value:
> runSideEffect $ liftWalk findPeopleProperties
Right [AVertexProperty {avpId = GValue {unGValue = GraphSON {gsonType = Just "g:Int64", gsonValue = GNumber -2.042816215e9}}, avpLabel = "suchness", avpValue = (), avpProperties = PropertyMapSingle (PropertyMapGeneric (fromList []))}]
> runSideEffect $ liftWalk $ findPeopleValues []
Right [()]
> runSideEffect $ liftWalk $ findPeopleValues ["suchness"]
Right [()]
Thanks for the information!
As far as I can tell from the issue report in Tinkerpop, (1) Gremlin Server implementation (not Graph implementation) seems to be reponsible for this problem (2) in future (Tinkerpop 4.x?) probably properties
is officially omitted from graph elements.
So, this is something what greskell should adopt to. I want to see a draft of Tinkerpop 4.x spec.
BTW, in your last example ("I see the property, but no value:"), that was probably because you used ()
as property value type. If the property value is ()
, greskell won't try parsing the value at all and just return ()
. Use Int
instead in this case.
All my problems are solved for the time being. (The rest of this comment has been moved to a new issue.)
@JeffreyBenjaminBrown Please open a new issue. That is off-topic of this issue.
Discussion on TinkerPop 4 http://tinkerpop.apache.org/docs/3.4.2/dev/future/
Until greskell-0.2.3.1, if the Gremlin Server omits properties for a vertex, for example, it can be parsed to AVertex
without error. However, that AVertex
has no properties. I think it's worse than throwing a parse error, because silently emptying the properties might be very hard to detect.
greskell-1.0.0.0 will address this issue by removing properties from AVertex
, AEdge
and AVertexProperty
. Sorry for the breaking changes.
No worries about breaking changes from me -- I haven't really made anything using Greskell yet :)
Released greskell-1.0.0.0
See also: #5
When a Gremlin Server returns Vertex objects, it's possible that
properties
attribute is omitted (it doesn't have the key in the first place), although this is a violation of GraphSON IO format. I'm not sure what is reponsible for this problem, but I suspect the Graph implementation. And also I suspect such implementations omit properties for Edges.For interoperability, greskell should be able to parse the graph elements without
properties
attribute. That case should be tested.