How to get cardinality of property?
I have a multi property and I want to find out its cardinality. How can I do that?
valueMap/elementMap don't help
Solution:Jump to solution
TinkerPop really doesn't know, so it can't tell you the answer. It has no notion of schema. You as the user have to know and adjusting your Gremlin accordingly in your application layer. The best that we have internally (and maybe for embedded use cases) is
VertexFeatures.getCardinality(String)
which, if implemented by the provider, will tell you a hint at the cardinality. https://github.com/apache/tinkerpop/blob/1e3c881d9f157167b53f431898e6d1ee40429cd0/gremlin-core/src/main/java/org/apache/t...GitHub
tinkerpop/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/s...
Apache TinkerPop - a graph computing framework. Contribute to apache/tinkerpop development by creating an account on GitHub.
3 Replies
Solution
TinkerPop really doesn't know, so it can't tell you the answer. It has no notion of schema. You as the user have to know and adjusting your Gremlin accordingly in your application layer. The best that we have internally (and maybe for embedded use cases) is
VertexFeatures.getCardinality(String)
which, if implemented by the provider, will tell you a hint at the cardinality. https://github.com/apache/tinkerpop/blob/1e3c881d9f157167b53f431898e6d1ee40429cd0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java#L581-L594GitHub
tinkerpop/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/s...
Apache TinkerPop - a graph computing framework. Contribute to apache/tinkerpop development by creating an account on GitHub.
for TinkerGraph it's just default Cardinality
https://github.com/apache/tinkerpop/blob/3.6-dev/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java#L420-L422
GitHub
tinkerpop/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gr...
Apache TinkerPop - a graph computing framework. Contribute to apache/tinkerpop development by creating an account on GitHub.
yeah, that's what i mean. it's a hint...at best