mpollmeier / gremlin-scala

[unmaintained] Scala wrapper for Apache TinkerPop 3 Graph DSL
Apache License 2.0
482 stars 75 forks source link

Indexing #50

Closed omidb closed 9 years ago

omidb commented 10 years ago

How can enable indexing in gremlin-scala? Apparently in Java gremlin there is a feature like this: gremlin> g.createKeyIndex("my_key",Vertex.class)

mpollmeier commented 10 years ago

GremlinScala only provides a wrapping layer where it makes sense. In this case it looks like you're just using the main tinkerpop Graph interface, so Gremlin-Scala isn't involved. You can do just the same in Scala with g.createKeyIndex("my_key",classOf[Vertex])

omidb commented 10 years ago

here is my code from your sample:

import com.tinkerpop.gremlin.neo4j.structure.Neo4jGraph val graph: Neo4jGraph = Neo4jGraph.open("E:/scratch/test47") val gs = GremlinScala(graph)

Both 'gs' and 'graph' has no .creatKeyIndex function for me.

laughedelic commented 10 years ago

I think it's a blueprints method. But Neo4jGraph implements that interface...

mpollmeier commented 10 years ago

Please be aware that this this is all for tinkerpop3 - blueprints doesn't exist any more (it was in tinkerpop2). I'll update the readme shortly so that other's don't get down the wrong route, too.

Here are some pointers for code and documentation: https://github.com/mpollmeier/gremlin-scala/tree/tinkerpop3 https://github.com/tinkerpop/tinkerpop3/blob/master http://www.tinkerpop.com/docs/current/

For your question in particular: https://github.com/tinkerpop/tinkerpop3/blob/master/neo4j-gremlin/src/main/java/com/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java#L288

Looks like there's a Schema manager that let's you manage indices. Tinkergraph (the dummy graph implementation) has a createIndex function.