Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Schema queries from if else condition to getOrCreate formats #106

Open
debasishdebs opened this issue Oct 14, 2018 · 0 comments
Open

Comments

@debasishdebs
Copy link
Owner

Currently, for the following:

  • Edge Label
  • Vertex Label
  • Property Key

We use a if else loop as gremlin query to first query for the element, if present retrive it or else create it as follows:

q = "if (mgmt.getEdgeLabel('{}')) {{" 
 "   {} = mgmt.getEdgeLabel('{}'); }}" 
"else {{" 
 "   {} = mgmt.makeEdgeLabel('{}').multiplicity({}).make(); }}\n".format(
self.label, self.label, self.label, self.label, self.label, self.multiplicity) 

This level of complex string formatting can be avoided by using JanusGraph's inbuilt APIs which does the same check.

Instead of we makeEdgeLabel in above example we will need to move to getOrCreateEdgeLabel and similarly for all other elements too.

debasishdebs added a commit that referenced this issue Oct 14, 2018
Added support for signature(property_key) while defining edge label.
Type in PropertyKeyBuilder.
Added scripts for creating GraphOfTheGods schema. Data addition TBD.
Fixes #105.
Tested #106 and #106 will fail & closed.

Signed-off-by: Debasish Kanhar <dekanhar@in.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant