private void DropEdgeProperty(EdgePropertyField ep) { //EdgeField edgeField = ep.Edge; //if (edgeField.EdgeDocID != null) { // This is a spilled edge // JObject edgeDocument = this.connection.RetrieveDocumentById(edgeField.EdgeDocID); // ((JArray)edgeDocument["_edge"]) // .First(edge => (string)edge["_srcV"] == edgeField.OutV && (long)edge["_offset"] == edgeField.Offset) // [ep.PropertyName] // .Remove(); // this.connection.ReplaceOrDeleteDocumentAsync(edgeField.EdgeDocID, edgeDocument).Wait(); //} //else { // This is not a spilled edge // JObject edgeDocument = this.connection.RetrieveDocumentById(edgeField.EdgeDocID); // ((JArray)edgeDocument["_edge"]) // .First(edge => (string)edge["_srcV"] == edgeField.OutV && (long)edge["_offset"] == edgeField.Offset) // [ep.PropertyName] // .Remove(); // this.connection.ReplaceOrDeleteDocumentAsync(edgeField.EdgeDocID, edgeDocument).Wait(); //} //// Update edge field //bool found = edgeField.EdgeProperties.Remove(ep.PropertyName); //Debug.Assert(found); List <Tuple <WValueExpression, WValueExpression, int> > propertyList = new List <Tuple <WValueExpression, WValueExpression, int> >(); propertyList.Add( new Tuple <WValueExpression, WValueExpression, int>( new WValueExpression(ep.PropertyName, true), new WValueExpression("null", false), 0)); UpdateEdgePropertiesOperator op = new UpdateEdgePropertiesOperator( this.dummyInputOp, this.connection, 0, 1, propertyList ); RawRecord record = new RawRecord(); record.Append(new StringField(ep.Edge.OutV)); record.Append(new StringField(ep.Edge.Offset.ToString())); op.DataModify(record); // Now VertexCacheObject has been updated (in DataModify) Debug.Assert(!ep.Edge.EdgeProperties.ContainsKey(ep.PropertyName)); }
private void UpdatePropertiesOfEdge(EdgeField edge) { List <Tuple <WValueExpression, WValueExpression, int> > propertyList = new List <Tuple <WValueExpression, WValueExpression, int> >(); foreach (WPropertyExpression property in this.updateProperties) { if (property.Cardinality == GremlinKeyword.PropertyCardinality.list || property.MetaProperties.Count > 0) { throw new Exception("Can't create meta property or duplicated property on edges"); } propertyList.Add(new Tuple <WValueExpression, WValueExpression, int>(property.Key, property.Value, 0)); } RawRecord record = new RawRecord(); record.Append(new StringField(edge.OutV)); record.Append(new StringField(edge.Offset.ToString())); UpdateEdgePropertiesOperator op = new UpdateEdgePropertiesOperator(this.InputOperator, this.Connection, 0, 1, propertyList); op.DataModify(record); }