Update a subset of properties on
a metadata object

@param {String} uri
@param {Object} data
@returns {Promise}
16839
function patchMeta(uri, data) {
  const id = replaceVersion(uri.replace('/meta', ''));

  return db.patchMeta(id, data)
    .then(() => getMeta(uri))
    .then(pubToBus(id));
}
1339349
function splitCascadingData(uri, data) {
  let ops, list;

  // search for _ref with _size greater than 1
  list = references.listDeepObjects(data, isReferencedAndReal);
  ops = _.map(list.reverse(), function (obj) {
    const ref = obj[referenceProperty],
      // since children are before parents, no one will see data below them
      op = {key: ref, value: _.omit(obj, referenceProperty)};

    // omit cloned 1 level deep and we clear what omit cloned from obj
    // so the op gets the first level of data, but it's removed from the main obj
    clearOwnProperties(obj);
    obj[referenceProperty] = ref;

    return op;
  });

  // add the cleaned root object at the end
  ops.push({key: uri, value: data});

  return ops;
}
508725
private void updateRequestMetadata() {
        // Take event level metadata, merge with top level metadata
        // event level metadata takes precedence
        try {
            JSONObject metadata = new JSONObject();
            Iterator<String> i = prefHelper_.getRequestMetadata().keys();
            while (i.hasNext()) {
                String k = i.next();
                metadata.put(k, prefHelper_.getRequestMetadata().get(k));
            }
            JSONObject originalMetadata = params_.optJSONObject(Defines.Jsonkey.Metadata.getKey());
            if (originalMetadata != null) {
                Iterator<String> postIter = originalMetadata.keys();
                while (postIter.hasNext()) {
                    String key = postIter.next();
                    // override keys from above
                    metadata.put(key, originalMetadata.get(key));
                }
            }
            // Install metadata need to be send only with Install request
            if ((this instanceof ServerRequestRegisterInstall) && prefHelper_.getInstallMetadata().length() > 0) {
                params_.putOpt(Defines.Jsonkey.InstallMetadata.getKey(), prefHelper_.getInstallMetadata());
            }
            params_.put(Defines.Jsonkey.Metadata.getKey(), metadata);
        } catch (JSONException e) {
           PrefHelper.Debug("Could not merge metadata, ignoring user metadata.");
        }
    }
1222159
def update_resource(id_or_uri, resource, opts = {})
      data, _status_code, _headers = update_resource_with_http_info(id_or_uri, resource, opts)
      return data
    end
1182468
function(data) {
			data = utils.parseJSON(data);

			var userData = resources.getVocabulary('user') || {};
			resources.setVocabulary(utils.deepMerge(userData, data), 'user');
		}
1339832
function _fetch(data) {
			return Promise.all([
				data[1],
				loader.fetch({ name: data[0], address: data[1], metadata: {} })
			]);
		}
894355
function(data) {
      var extras = {};

      if (data instanceof File) {
        extras = this.meta(data);
        data = data.toDataURL();
      }
      var parts = data.split(","), headers = parts[0].split(":"), body;

      if (parts.length !== 2 || headers.length !== 2 || headers[0] !== "data") {
        throw new Error("Invalid data URI.");
      }
      headers = headers[1].split(";");
      body = (headers[1] === "base64") ? atob(parts[1]) : decodeURI(parts[1]);
      var length = body.length, buffer = new ArrayBuffer(length), bytes = new Uint8Array(buffer);

      for (var i = 0; i < length; i++) {
        bytes[i] = body.charCodeAt(i);
      }
      return angular.extend(new Blob([bytes], { type: headers[0] }), extras);
    }
43248
function defaultUpdateFunction(instance, data) {
    if (instance.isMatreshkaArray) {
        instance.recreate(data);
    } else if (instance.isMatreshkaObject) {
        instance.setData(data, { replaceData: true });
    } else {
        // for other objects just extend them with given data
        nofn.assign(instance, data);
    }
}
795275
function(data, done) {
      this._data.push(this._clone(data));
      var ret = this._data.length;
      done(null, ret);
    }
1080804
function(newData) {
          var requiresRefresh = newData.length > 0 || newData.length < self.dataLength;

          self.dataLength = newData.length;

          return !!requiresRefresh;
        }
1173989
function (data) {
            var temp = addPath(validUrls, url.parse(data.href), bs.options.get("mode"));
            methods.sendUpdatedIfChanged(validUrls, temp, ui.socket);
        }
1279914
function(workspaceId, workspacedata, callback) {
		var userId = metaUtil.decodeUserIdFromWorkspaceId(workspaceId);
		Promise.using(this.lock(userId, false), function() {
			return new Promise(function(resolve, reject) {
				this._readWorkspaceMetadata(workspaceId, function(error, metadata) {
					if (error) {
						return reject(error);
					}
					if (typeof workspacedata === "function") {
						workspacedata = workspacedata(this._convertWorkspace(metadata));
						if (!workspacedata) {
							return resolve();
						}
					}
					//TODO other properties 
					metadata.Properties = workspacedata.properties;
					this._updateWorkspaceMetadata(workspaceId, metadata, function(error) {
						if (error) {
							return reject(error);
						}
						resolve();
					});
				}.bind(this));
			}.bind(this));
		}.bind(this)).then(
			function(result) {
				callback(null, result);
			},
			callback /* error case */
		);
	}
1077007
private <T> HttpUriRequest prepareRequest(URI uri, Map<String, String> headers, String jsonData) {
        HttpUriRequest httpRequest;
        if (jsonData != null) {
            // POST data
            HttpPost httpPost = new HttpPost(uri);
            httpPost.setEntity(new StringEntity(jsonData, ContentType.APPLICATION_JSON));
            httpRequest = httpPost;
        } else {
            // GET request
            httpRequest = new HttpGet(uri);
        }
        httpRequest.addHeader(HttpHeaders.ACCEPT, "application/json");
        headers.forEach(httpRequest::addHeader);

        return httpRequest;
    }
39247
function updateWeibo(data){
  if(!data.accessToken){
    throw new Error('need a accessToken');
  }
  var emitter = new Emitter();
  
  var msg = data.message
    , coordinates = data.coordinates
    , img = data.image;
    
  var body = "status=" + encodeURIComponent(msg),
    url, headers, multipart;
    
  //console.log('last text: ' + msg);
  //console.log('coordinates: ' + util.inspect(coordinates));
  
  body += (coordinates && coordinates.length == 2) ? ('&lat=' + encodeURIComponent(coordinates[1]) + '&long=' + encodeURIComponent(coordinates[0])) : '';
  
  if(img){
    url = 'https://api.weibo.com/2/statuses/upload.json?access_token=' + data.accessToken;
    headers = {"content-type": "multipart/form-data"};
    body = '';
  }else{
    url = 'https://api.weibo.com/2/statuses/update.json?access_token=' + data.accessToken;
    headers = {"Content-Type": "application/x-www-form-urlencoded"};
  }
  
  if(img && !Buffer.isBuffer(img)){
    if(/^https?\:\/\//i.test(img)){
      request({url: img, encoding: null}, function(err, res, img){
        if(err){
          emitter.emit('error', err);
        }else{
          multipart = multipartParse(msg, coordinates, img);
          //console.log(util.inspect(multipart))
          //console.log(headers)
          faWeibo(url, headers, body, multipart, emitter);
        }
      });
    }else{
      emitter.emit('error', 'need a image');
    }
  }else{
    if(img){//buffer
      multipart = multipartParse(msg, coordinates, img);
    }
    
    faWeibo(url, headers, body, multipart, emitter);
  }
  return emitter;
}
888842
def _put(self, uri, data):
        
        headers = self._get_headers()

        logging.debug("URI=" + str(uri))
        logging.debug("BODY=" + json.dumps(data))

        response = self.session.put(uri, headers=headers,
                data=json.dumps(data))
        if response.status_code in [201, 204]:
            return data
        else:
            logging.error(response.content)
            response.raise_for_status()
1369941
function onMetadata (metadata) {
  metadata = icy.parse(metadata);
  console.error('METADATA EVENT:');
  console.error(metadata);
}
223170
function(data, done) {
      if(!this._key) {
        done('no key found for metadata');
        return;
      }
      var key = data[this._key.getName()];
      var ix = -1;
      for(var i = 0; i < this._data.length; i++) {
        if(this._data[i][this._key.getName()] === key) {
          ix = i;
          break;
        }
      }
      if(ix === -1) {
        this._data.push(this._clone(data));
      } else {
        this._data[ix] = this._clone(data);
      }
      done(null);
    }