public NodeItem(JsonObject next, NodeGroup ng) { this.keyName = next.GetNamedString("KeyName"); this.valueTypeURI = next.GetNamedString("UriValueType"); this.valueType = next.GetNamedString("ValueType"); this.connectedBy = next.GetNamedString("ConnectBy"); this.uriConnectBy = next.GetNamedString("UriConnectBy"); this.connected = next.GetNamedBoolean("Connected"); // add the list of nodes this item attaches to on the far end JsonArray nodeSparqlIds = next.GetNamedArray("SnodeSparqlIDs"); int count = nodeSparqlIds.Count; for (int i = 0; i < count; i++) { String currID = nodeSparqlIds.GetStringAt((uint)i); Node curr = ng.GetNodeBySparqlID(currID); if (curr == null) { // add the node since we have not seen it before. curr = new Node(currID, null, null, currID, ng); curr.SetSparqlID(currID); ng.AddOrphanedNode(curr); } // add it to list. this.nodes.Add(curr); } // optionals if (next.ContainsKey("SnodeOptionals")) { // the incoming json defines optional nodes. JsonArray jsonOptional = next.GetNamedArray("SnodeOptionals"); int optionalsCounter = jsonOptional.Count; for (int i = 0; i < optionalsCounter; i++) { // get the optional marker used for each int currOpt = (int)(jsonOptional.GetNumberAt((uint)i) / 1); this.snodeOptionals.Add(currOpt); } } else { // set the values. int opt = NodeItem.OPTIONAL_FALSE; if (next.ContainsKey("isOptional")) { int optVal = (int)next.GetNamedNumber("isOptional"); } // set all of them for (int k = 0; k < this.nodes.Count; k++) { this.snodeOptionals.Add(opt); } } // add the deletion flag information if (next.ContainsKey("DeletionMarkers")) { JsonArray jsonDelMarkers = next.GetNamedArray("DeletionMarkers"); for (int g = 0; g < jsonDelMarkers.Count; g++) { try { Boolean delVal = jsonDelMarkers.GetBooleanAt((uint)g); this.deletionFlags.Add(delVal); } catch (Exception e) { this.deletionFlags.Add(false); } } } else { // set all the deletion flags to false, so they exist. for (int p = 0; p < this.nodes.Count; p++) { this.deletionFlags.Add(false); } } }