Configuration graphConf = new BaseConfiguration();
InputStream in = TitanGraphFactory.class.getResourceAsStream("/titan_full_en.properties");
Properties prop = new Properties();
prop.load(in);
graphConf.setProperty("storage.backend", prop.get("storage.backend"));
graphConf.setProperty("storage.hostname", prop.get("storage.hostname"));
graphConf.setProperty("index.search.backend", prop.get("index.search.backend"));
graphConf.setProperty("index.search.hostname", prop.get("index.search.hostname"));
TitanGraph graph = TitanFactory.open(graphConf);
TitanManagement mgmt = graph.openManagement();
final PropertyKey type = mgmt.makePropertyKey("type").dataType(String.class).make();
mgmt.buildIndex("byType", Vertex.class).addKey(type).buildCompositeIndex();
ManagementSystem.awaitGraphIndexStatus(graph, "byType").call();
mgmt.updateIndex(mgmt.getGraphIndex("byType"), SchemaAction.ENABLE_INDEX).get();
mgmt.commit();
mgmt.buildIndex("byChannelUniqueIdSearchable", Vertex.class).addKey(channelId, Mapping.TEXT.asParameter()).buildMixedIndex("search");
ManagementSystem.awaitGraphIndexStatus(graph, "byChannelUniqueIdSearchable").call();
mgmt.updateIndex(mgmt.getGraphIndex("byChannelUniqueIdSearchable"), SchemaAction.ENABLE_INDEX).get();
mgmt.commit();
gremlin> graph = TitanFactory.open('inmemory'); g = graph.traversal()
==>graphtraversalsource[standardtitangraph[inmemory:[127.0.0.1]], standard]
gremlin> mgmt = graph.openManagement();
==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@2849434b
gremlin>
gremlin> type = mgmt.makePropertyKey("type").dataType(String.class).make();
==>type
gremlin> mgmt.buildIndex("byType", Vertex.class).addKey(type).buildCompositeIndex();
==>byType
gremlin> mgmt.commit();
gremlin> v = graph.addVertex("type", "person", "name", "sudha")
==>v[4144]
gremlin> graph.tx().commit()
==>null
gremlin> g.V().has("type", "person").next()
==>v[4144]
--
You received this message because you are subscribed to the Google Groups "Aurelius" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aureliusgraph...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aureliusgraphs/d186c468-9428-4906-8122-2c8dc77cbc20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
gremlin> :remote connect tinkerpop.server conf/remote.yaml==>Connected - localhost/127.0.0.1:8182gremlin> :> g.addV("type", "person", "name", "sudha")==>v[40964312]gremlin> :> g.tx().commit()
==>nullgremlin> :> g.V().has("type", "person").next()
==>v[40964312]gremlin>
Gremlin console: com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx - Query requires iterating over all vertices [(type = person)]. For better performance, use indexes
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Connected - localhost/127.0.0.1:8182
gremlin> :> mgmt = graph.openManagement(); type = mgmt.makePropertyKey("type").dataType(String.class).make(); mgmt.buildIndex("byType", Vertex.class).addKey(type).buildCompositeIndex(); mgmt.commit();
==>null
gremlin> :> graph.addVertex("type", "person", "name", "sudha");
==>v[8400]
gremlin> :> g.V().has("type", "person").next()
==>v[8400]
gremlin> :remote close
==>Removed - Gremlin Server - [localhost/127.0.0.1:8182]
0 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer -
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
100 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Configuring Gremlin Server from ./conf/gremlin-server/gremlin-server.yaml
162 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics ConsoleReporter configured with report interval=180000ms
164 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics CsvReporter configured with report interval=180000ms to fileName=/tmp/gremlin-server-metrics.csv
218 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics JmxReporter configured with domain= and agentId=
219 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
682 [main] INFO com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration - Set default timestamp provider MICRO
737 [main] INFO com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration - Generated unique-instance-id=c0a8000c28716-u1401-local1
769 [main] INFO com.thinkaurelius.titan.diskstorage.Backend - Initiated backend operations thread pool of size 16
828 [main] INFO com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog - Loaded unidentified ReadMarker start time 2016-07-20T01:26:15.031Z into com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog$MessagePuller@5505ae1a
828 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Graph [graph] was successfully configured via [conf/gremlin-server/titan-berkeleyje-server.properties].
829 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized Gremlin thread pool. Threads in pool named with pattern gremlin-*
1067 [main] INFO org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines - Loaded nashorn ScriptEngine
1319 [main] INFO org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines - Loaded gremlin-groovy ScriptEngine
1885 [main] INFO org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor - Initialized gremlin-groovy ScriptEngine with scripts/generate-modern.groovy
1885 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized GremlinExecutor and configured ScriptEngines.
1891 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - A GraphTraversalSource is now bound to [g] with graphtraversalsource[standardtitangraph[berkeleyje:db/berkeley], standard]
1908 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Executing start up LifeCycleHook
1918 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Loading 'modern' graph data, if necessary.
6223 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
6224 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo-stringd with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
6380 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0
6381 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0
6452 [gremlin-server-boss-1] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Gremlin Server configured with worker thread pool of 1, gremlin pool of 8 and boss thread pool of 1.
6452 [gremlin-server-boss-1] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Channel started at port 8182.
33358 [gremlin-server-worker-1] INFO org.apache.tinkerpop.gremlin.server.op.OpLoader - Adding the standard OpProcessor.
33359 [gremlin-server-worker-1] INFO org.apache.tinkerpop.gremlin.server.op.OpLoader - Adding the control OpProcessor.
33362 [gremlin-server-worker-1] INFO org.apache.tinkerpop.gremlin.server.op.OpLoader - Adding the session OpProcessor.
^C79055 [gremlin-server-shutdown] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Shutting down thread pools.
79057 [gremlin-server-stop] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Executing shutdown LifeCycleHook
gremlin> :> mgmt = graph.openManagement(); token=mgmt.makePropertyKey("token").dataType(String.class).make(); mgmt.buildIndex("byToken", Vertex.class).addKey(token).buildCompositeIndex(); mgmt.commit();==>nullgremlin> :> graph.addVertex("token", "identifier", "id", "1")==>v[4240]gremlin> :> g.V().has("token", "identifier").next()==>v[4240]gremlin> :remote close
column_name | index_name | index_options | index_type | component_index-------------+------------+---------------+------------+----------------- column1 | null | null | null | null key | null | null | null | null value | null | null | null | null column1 | null | null | null | null key | null | null | null | null value | null | null | null | null
GryoMapper mapper = GryoMapper.build().addRegistry(TitanIoRegistry.INSTANCE).create();
cluster = Cluster.build().serializer(new GryoMessageSerializerV1d0(mapper)).create();
client = cluster.connect();
client.init();
The groovy file in the server has the methods that I invoke:
def globals = [:]
globals << [g : graph.traversal()]
......
Configuration graphConf = new BaseConfiguration();
InputStream in = TitanGraphFactory.class.getResourceAsStream("/titan_full_en.properties");
Properties prop = new Properties();
prop.load(in);
graphConf.setProperty("storage.backend", prop.get("storage.backend"));
graphConf.setProperty("storage.hostname", prop.get("storage.hostname"));
graphConf.setProperty("index.search.backend", prop.get("index.search.backend"));
graphConf.setProperty("index.search.hostname", prop.get("index.search.hostname"));
TitanGraph graph = TitanFactory.open(graphConf);
TitanManagement mgmt = graph.openManagement();
final PropertyKey type = mgmt.makePropertyKey("type").dataType(String.class).make();
mgmt.buildIndex("byType", Vertex.class).addKey(type).buildCompositeIndex();
ManagementSystem.awaitGraphIndexStatus(graph, "byType").call();
mgmt.updateIndex(mgmt.getGraphIndex("byType"), SchemaAction.ENABLE_INDEX).get();
mgmt.commit();
gremlin> :> mgmt = graph.openManagement(); hasIndex = mgmt.containsGraphIndex("byType"); mgmt.rollback(); hasIndex
==>true
gremlin> :> mgmt = graph.openManagement(); idx = mgmt.getGraphIndex("byType"); pk = idx.getFieldKeys()[0]; s = "index name="+idx.name()+" isCompositeIndex="+idx.isCompositeIndex()+" fieldKey="+pk+" status="+idx.getIndexStatus(pk); mgmt.rollback(); s
==>index name=byType isCompositeIndex=true fieldKey=type status=ENABLED
ManagementSystem.awaitGraphIndexStatus(graph, "byType").call();
mgmt.updateIndex(mgmt.getGraphIndex("byType"), SchemaAction.ENABLE_INDEX).get();