Janusgraph vertex property with cardinality as SET type

Hi, need a working example of how a property can be added to a vertex with cardinality as SET type and how we can retrieve it and assign it to SET of strings in JAVA. Please note: I have tried the janusgraph doc code, google search, chat GPT but every time I put something in that property through java code it get stored in STRING format only. Ex: "["ABC"]" --> current , ["ABC"] --> this I need. Please help.
Solution:
for JanusGraph you'd want to set up the schema for your multiproperty: ``` mgmt = graph.openManagement() mgmt.makePropertyKey('p').dataType(String.class).cardinality(Cardinality.SET).make() mgmt.commit()...
Jump to solution
2 Replies
Solution
spmallette
spmallette12mo ago
for JanusGraph you'd want to set up the schema for your multiproperty:
mgmt = graph.openManagement()
mgmt.makePropertyKey('p').dataType(String.class).cardinality(Cardinality.SET).make()
mgmt.commit()
mgmt = graph.openManagement()
mgmt.makePropertyKey('p').dataType(String.class).cardinality(Cardinality.SET).make()
mgmt.commit()
then for Gremlin it should just be
g.addV().
property(set, 'p', 'value-a').
property(set, 'p', 'value-b')
g.addV().
property(set, 'p', 'value-a').
property(set, 'p', 'value-b')
harsh1991
harsh1991OP12mo ago
Thanks a ton. It got worked.👍
Want results from more Discord servers?
Add your server