mpollmeier / gremlin-scala-examples

Examples for different graph dbs
Apache License 2.0
67 stars 34 forks source link

Unable to create index - neo4j-bolt #29

Open lokune opened 6 years ago

lokune commented 6 years ago

First of all, thank you so much for putting gremlin-scala library and the examples together. I am following the neo4j-bolt examples and all CRUD operations work perfect. I have one problem though, I cannot figure out how to create an index. My graph, created as val graph: ScalaGraph = Neo4JGraphFactory.open(configuration).asScala has no createIndex method. I tried to get the java equivalent by val graph4j = Neo4JGraphFactory.open(configuration) but still this has no createIndex method. What's confusing though, the Neo4JGraphFactory.open returns Neo4JGraph which should have that method according to the neo4j-gremlin-bolt library example. Kindly help by including an example on how to create index. Thanks in advance.

michaelahlers commented 6 years ago

@lokune, I'm sorting through this now, and it's more to do with discrepancies between com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph and org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph (the latter which is used by IndexScala.scala) than a limitation of Gremlin Scala. Best tip I can offer is that both Neo4JGraph and Neo4jGraph offer ways to execute cypher statements (albeit with API variations; see Neo4JGraph#execute(org.neo4j.driver.v1.Statement) and Neo4jGraph#cypher(java.lang.String) respectively), which may be used to create your indexes.