public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { Vertex vertex = objectData; var vertexDict = new Dictionary <string, dynamic> { { "id", writer.ToDict(vertex.Id) }, { "label", writer.ToDict(vertex.Label) } }; return(GraphSONUtil.ToTypedValue(nameof(Vertex), vertexDict)); }
public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { VertexProperty vertexProperty = objectData; var valueDict = new Dictionary <string, dynamic> { { "id", writer.ToDict(vertexProperty.Id) }, { "label", vertexProperty.Label }, { "value", writer.ToDict(vertexProperty.Value) }, { "vertex", writer.ToDict(vertexProperty.Vertex.Id) } }; return(GraphSONUtil.ToTypedValue(nameof(VertexProperty), valueDict)); }
public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { Edge edge = objectData; var edgeDict = new Dictionary <string, dynamic> { { "id", writer.ToDict(edge.Id) }, { "outV", writer.ToDict(edge.OutV.Id) }, { "outVLabel", edge.OutV.Label }, { "label", edge.Label }, { "inV", writer.ToDict(edge.InV.Id) }, { "inVLabel", edge.InV.Label } }; return(GraphSONUtil.ToTypedValue(nameof(Edge), edgeDict)); }
public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { ITraversal traversal = objectData; var bytecode = traversal.Bytecode; return(writer.ToDict(bytecode)); }
public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { if (!(objectData is IDictionary map)) { throw new InvalidOperationException("Object must implement IDictionary"); } var result = new object[map.Count * 2]; var index = 0; foreach (var key in map.Keys) { result[index++] = writer.ToDict(key); result[index++] = writer.ToDict(map[key]); } return(GraphSONUtil.ToTypedValue("Map", result)); }
public Dictionary <string, dynamic> Dictify(dynamic predicate, GraphSONWriter writer) { TraversalPredicate p = predicate; var value = p.Other == null ? writer.ToDict(p.Value) : new List <dynamic> { writer.ToDict(p.Value), writer.ToDict(p.Other) }; var dict = new Dictionary <string, dynamic> { { "predicate", p.OperatorName }, { "value", value } }; return(GraphSONUtil.ToTypedValue("P", dict)); }
private IEnumerable <dynamic> DictifyInstruction(Instruction instruction, GraphSONWriter writer) { var result = new List <dynamic> { instruction.OperatorName }; result.AddRange(instruction.Arguments.Select(arg => writer.ToDict(arg))); return(result); }
public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { var binding = (Binding)objectData; var valueDict = new Dictionary <string, object> { { "value", writer.ToDict(binding.Value) }, { "key", binding.Key } }; return(GraphSONUtil.ToTypedValue(nameof(Binding), valueDict)); }
public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { RequestMessage msg = objectData; return(new Dictionary <string, dynamic> { { "requestId", msg.RequestId }, { "op", msg.Operation }, { "processor", msg.Processor }, { "args", writer.ToDict(msg.Arguments) } }); }
public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { Property property = objectData; var elementDict = CreateElementDict(property.Element, writer); var valueDict = new Dictionary <string, dynamic> { { "key", property.Key }, { "value", writer.ToDict(property.Value) }, { "element", elementDict } }; return(GraphSONUtil.ToTypedValue(nameof(Property), valueDict)); }
/// <summary> /// Converts a Collection to a representation of g:List or g:Set /// </summary> internal static Dictionary <string, dynamic> ToCollection(dynamic objectData, GraphSONWriter writer, string typename) { var collection = objectData as IEnumerable; if (collection == null) { throw new InvalidOperationException("Object must implement IEnumerable"); } var result = new List <object>(); foreach (var item in collection) { result.Add(writer.ToDict(item)); } return(ToTypedValue(typename, result)); }
private dynamic CreateElementDict(Element element, GraphSONWriter writer) { if (element == null) { return(null); } var serializedElement = writer.ToDict(element); Dictionary <string, dynamic> elementDict = serializedElement; if (elementDict.ContainsKey(GraphSONTokens.ValueKey)) { var elementValueSerialized = elementDict[GraphSONTokens.ValueKey]; Dictionary <string, dynamic> elementValueDict = elementValueSerialized; if (elementValueDict != null) { elementValueDict.Remove("outVLabel"); elementValueDict.Remove("inVLabel"); elementValueDict.Remove("properties"); elementValueDict.Remove("value"); } } return(serializedElement); }
public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { var type = (Type)objectData; return(writer.ToDict(Activator.CreateInstance(type))); }
public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer) { AbstractTraversalStrategy strategy = objectData; return(GraphSONUtil.ToTypedValue(strategy.StrategyName, writer.ToDict(strategy.Configuration))); }