Пример #1
0
        /// <summary>
        /// Sets a composite index (see http://s3.thinkaurelius.com/docs/titan/1.0.0/indexes.html#_composite_index )
        /// </summary>
        /// <param name="propertykey">Propertykey to index</param>
        public virtual void CreateIndexOnProperty(string propertykey)
        {
            object indexPropertyKey = Gremlin.GetScalar(new GremlinScript("mgmt = graph.openManagement(); mgmt.getPropertyKey('" + propertykey + "')"));

            if (indexPropertyKey == null)
            {
                Gremlin.Execute(
                    new GremlinScript("graph.tx().rollback(); mgmt = graph.openManagement(); name = mgmt.makePropertyKey('" + propertykey + "').dataType(String.class).make(); mgmt.buildIndex('" + propertykey + "', Vertex.class).addKey(name).buildCompositeIndex(); mgmt.commit();")
                    );
            }
        }
Пример #2
0
 /// <summary>
 /// Deletes all vertices and edges of current graph
 /// </summary>
 public void DeleteExistingGraph()
 {
     Gremlin.Execute(new GremlinScript("graph.executeSql(\"delete vertex V\")"));
 }
Пример #3
0
 /// <summary>
 /// OrientDB implementation for creating an Index on a Propertykey
 /// </summary>
 /// <param name="propertykey">Key to index</param>
 /// <param name="label">Label of Vertex</param>
 public void CreateIndexOnProperty(string propertykey, string label)
 {
     Gremlin.Execute(new GremlinScript("def config = new BaseConfiguration(); graph.prepareIndexConfiguration(config); graph.createVertexIndex(\"" + propertykey + "\", \"" + label + "\", config)"));
 }
Пример #4
0
 /// <summary>
 /// Commits all changes
 /// </summary>
 public void CommitChanges()
 {
     Gremlin.Execute(new GremlinScript("graph.tx().commit()"));
 }
Пример #5
0
 /// <summary>
 /// Deletes all vertices and edges of a Graph
 /// </summary>
 public void DeleteExistingGraph()
 {
     Gremlin.Execute(new GremlinScript("g.V().drop()"));
 }