JanusGraph / janusgraph

JanusGraph: an open-source, distributed graph database
https://janusgraph.org
Other
5.21k stars 1.16k forks source link

[Docs] Data type of auto-created property key is inferred, not fixed Object.class #1984

Closed li-boxuan closed 3 years ago

li-boxuan commented 4 years ago

The doc on https://docs.janusgraph.org/basics/schema/#automatic-schema-maker says automatically created property key has data type Object.class

By default, implicitly created edge labels have multiplicity MULTI and implicitly created property keys have cardinality SINGLE and data type Object.class.

However, my testing shows that Default Schema Maker automatically infers the type of property key, and only uses data type Object.class when the given value is not of any native JanusGraph Data Type (Integer, String, etc.). See the relevant code snippet:

https://github.com/JanusGraph/janusgraph/blob/d0e5eff1de4e0dcdc95b6292ebe64a3baa357646/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphDefaultSchemaMaker.java#L44-L50 https://github.com/JanusGraph/janusgraph/blob/d0e5eff1de4e0dcdc95b6292ebe64a3baa357646/janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/JanusGraphDefaultSchemaMaker.java#L58-L86

ruiyang00 commented 3 years ago

Hello Li, I am wondering if this issue still open?

li-boxuan commented 3 years ago

@ruiyang00 Yes, it's still open. Feel free to work on it if you'd like to.

ruiyang00 commented 3 years ago

@li-boxuan Thank you, Li. I would love to work on this issue. Could you confirm that we should change the determineClass() to return Object.class data type directly to match the documentation? Thank you!

li-boxuan commented 3 years ago

@ruiyang00 Nope - you should change the doc to match the code :-)