Parses a collection of resources
@private
@memberOf {Serializer}
@param {String} type
@param {Object} data
@param {Object} relations
@param {Object} options
@return {Array}
172541
function parseCollection (type, data, relations, options) {
  var result = []

  _.each(data, function (value) {
    result.push(parseResource(type, value, relations, options))
  })

  return result
}
963686
function autoParse(data, models, options) {
  options = options || {};
  var parsed = {};

  // Go through each data point
  _.each(data, function(value, field) {
    var d = findField(field, models);

    // Find field in
    if (d) {
      parsed[d.modelName] = parsed[d.modelName] || {};
      parsed[d.modelName][d.field.name] = parse(value, d.field, options);
    }
  });

  return parsed;
}
1157673
function _parse(type, obj, options)
{
    if (!obj) return _checkResult(type, lib.newError("empty " + type), obj, options);
    try {
        obj = _parseResult(type, obj, options);
    } catch(err) {
        obj = _checkResult(type, err, obj, options);
    }
    return obj;
}
889260
def parse(self, type, data):
        
        try:
            return self.registered_formats[type]['parser'](data)
        except KeyError:
            raise NotImplementedError("No parser found for "
                                      "type '{type}'".format(type=type))
1352524
def _parse_with_relations(self, relations):
        
        results = {}

        for relation in relations:
            if isinstance(relation, dict):
                for name, constraints in relation.items():
                    results = self._parse_nested_with(name, results)

                    results[name] = constraints

                continue
            else:
                name = relation
                constraints = self.__class__(self.get_query().new_query())

            results = self._parse_nested_with(name, results)

            results[name] = constraints

        return results
1181437
function(data) {
        this.features = [];
        this.styles   = {};
        this.fetched  = {};

        // Set default options 
        var options = {
            depth: 0,
            styleBaseUrl: this.styleBaseUrl
        };

        return this.parseData(data, options);
    }
1297694
function parse (types) {
  if (typeof types === 'string') {
    var rtn = []
      , cur = []
      , len = types.length
      , depth = 0
    for (var i=0; i<len; i++) {
      var c = types[i]

      if (depth || !/(\d)/.test(c)) {
        cur.push(c)
      }

      if (c == '{' || c == '[' || c == '(') {
        depth++
      } else if (c == '}' || c == ']' || c == ')') {
        depth--
        if (!depth)
          add()
      } else if (~DELIMS.indexOf(c) && !depth) {
        add()
      }
    }
    function add () {
      rtn.push(cur.join(''))
      cur = []
      depth = 0
    }
    assert.equal(rtn[1], '@', '_self argument expected as first arg: ' + types)
    assert.equal(rtn[2], ':', 'SEL argument expected as second arg: ' + types)
    return [ rtn[0], rtn.slice(1) ]
  } else if (Array.isArray(types)) {
    return normalizeObjects(types);
  } else {
    var args = types.args
    assert.equal(args[0], '@', '_self argument expected as first arg: ' + types)
    assert.equal(args[1], ':', 'SEL argument expected as second arg: ' + types)
    return [ types.retval, args ]
  }
}
176027
function(options) {
    options = options || {};
    var fns = [
      _.bind(this.save, this, null, options)
    ];
    _.each(this.relationDefinitions, function(relationAttributes, relationKey) {
      var relation = this.get(relationKey);
      if (relation && _.isFunction(relation.save)) {
        fns.push(_.bind(relation.save, relation, null, _.clone(options)));
      }
    }, this);
    return sequence(fns);
  }
986521
def _get_resources_by_type(self, resource_type):
        
        resources = []
        for res in self.dsDoc['dataResources']:
            if res['resType'] == resource_type:
                resources.append(res)

        return resources
503939
function(type, filter, tabs) {
			if (isType(type)) {
				return JSON.stringify(parse(type), filter, tabs);
			} else {
				throw new TypeError("Expected edb.Object|edb.Array");
			}
		}
166013
function parsePatterns(options) {
  return readFileTree(
    options.src.patterns,
    options.keys.patterns,
    options
  ).then(patternObj => {
    return Promise.all(buildCollections(patternObj, options)).then(
      () => patternObj,
      error => DrizzleError.error(error, options.debug)
    );
  });
}
1159899
private JSONArray mapRelations(String oid) {
		// We want our parsed data for reading
		JsonSimple formData = parsedFormData(oid);
		if (formData == null) {
			log.error("Error parsing form data");
			return null;
		}

		// And raw data to see existing relations and write new ones
		JsonSimple rawData = getDataFromStorage(oid);
		if (rawData == null) {
			log.error("Error reading data from storage");
			return null;
		}
		// Existing relationship data
		JSONArray relations = rawData.writeArray("relationships");
		boolean changed = false;

		// For all configured relationships
		for (String baseField : relationFields.keySet()) {
			JsonSimple relationConfig = relationFields.get(baseField);

			// Find the path we need to look under for our related object
			List<String> basePath = relationConfig.getStringList("path");
			if (basePath == null || basePath.isEmpty()) {
				log.error("Ignoring invalid relationship '{}'. No 'path'"
						+ " provided in configuration", baseField);
				continue;
			}

			// Get our base object
			Object object = formData.getPath(basePath.toArray());
			if (object instanceof JsonObject) {
				// And process it
				JsonObject newRelation = lookForRelation(oid, baseField,
						relationConfig, new JsonSimple((JsonObject) object));
				if (newRelation != null
						&& !isKnownRelation(relations, newRelation)) {
					log.info("Adding relation: '{}' => '{}'", baseField,
							newRelation.get("identifier"));
					relations.add(newRelation);
					changed = true;
				}
			}
			// If base path points at an array
			if (object instanceof JSONArray) {
				// Try every entry
				for (Object loopObject : (JSONArray) object) {
					if (loopObject instanceof JsonObject) {
						JsonObject newRelation = lookForRelation(oid,
								baseField, relationConfig, new JsonSimple(
										(JsonObject) loopObject));
						if (newRelation != null
								&& !isKnownRelation(relations, newRelation)) {
							log.info("Adding relation: '{}' => '{}'",
									baseField, newRelation.get("identifier"));
							relations.add(newRelation);
							changed = true;
						}
					}
				}
			}
		}

		// Do we need to store our object again?
		if (changed) {
			try {
				saveObjectData(rawData, oid);
			} catch (TransactionException ex) {
				log.error("Error updating object '{}' in storage: ", oid, ex);
				return null;
			}
		}

		return relations;
	}
638248
function _get_result(Type) {
	return function(rows) {
		if(!rows) { throw new TypeError("failed to parse result"); }
		var doc = rows.shift();
		if(!doc) { return; }

		if(doc instanceof Type) {
			return doc;
		}

		var obj = {};
		ARRAY(Object.keys(doc)).forEach(function(key) {

			if(key === 'documents') {
				obj['$'+key] = {};
				ARRAY(Object.keys(doc[key])).forEach(function(k) {
					if(is.uuid(k)) {
						obj['$'+key][k] = _get_result(NoPg.Document)([doc[key][k]]);
					} else {
						obj['$'+key][k] = doc[key][k];
					}
				});
				return;
			}

			obj['$'+key] = doc[key];
		});

		_parse_object_expressions(obj);

		return new Type(obj);
	};
}
882655
private function parseResource($data)
    {
        if (! is_object($data)) {
            throw new ValidationException('Resources inside a collection MUST be objects, "' . gettype($data) . '" given.');
        }

        $object_vars = get_object_vars($data);

        // the 2 properties must be type and id
        // or the 3 properties must be type, id and meta
        if (count($object_vars) === 2 or (count($object_vars) === 3 and property_exists($data, 'meta'))) {
            $resource = $this->create('ResourceIdentifier', $data);
        } else {
            $resource = $this->create('ResourceItem', $data);
        }

        return $resource;
    }
651242
function parse(str, options = {}) {
    let tokens = tokenize(str)
    let data = []

    tokens.forEach((item, idx) => {
        let [ label, token ] = item
        if (renderRules[label]) {
            data.push(renderRules[label](token))
        }else {
            data.push([ RENDER_TYPE_PLAIN, token ])
        }
    })
    return data
}
222026
private void parseRelations(final Object originalEntity, final Object relationEntity,
            final Map<String, Object> relationsMap, final PersistenceDelegator pd, final EntityMetadata metadata,
            boolean lazilyloaded, Map<Object, Object> relationStack)
    {

        for (Relation relation : metadata.getRelations())
        {
            if (relation != null)
            {
                FetchType fetchType = relation.getFetchType();

                if (!lazilyloaded && fetchType.equals(FetchType.LAZY))
                {
                    final Object entityId = PropertyAccessorHelper.getId(relationEntity, metadata);
                    getAssociationBuilder().setProxyRelationObject(relationEntity, relationsMap, metadata, pd,
                            entityId, relation);
                }
                else
                {

                    if (relation.isUnary() && relation.getTargetEntity().isAssignableFrom(originalEntity.getClass()))
                    {
                        Object associationObject = PropertyAccessorHelper.getObject(relationEntity,
                                relation.getProperty());
                        if (relation.getType().equals(ForeignKey.ONE_TO_ONE))
                        {
                            if ((associationObject == null || ProxyHelper.isProxyOrCollection(associationObject)))
                            {
                                PropertyAccessorHelper.set(relationEntity, relation.getProperty(), originalEntity);
                            }
                        }
                        else if (relationsMap != null
                                && relationsMap.containsKey(relation.getJoinColumnName(kunderaMetadata)))
                        {
                            PropertyAccessorHelper.set(relationEntity, relation.getProperty(), originalEntity);
                        }
                    }
                    else
                    {
                        // Here
                        // onRelation(relationEntity, relationsMap, metadata,
                        // pd,
                        // relation, relationType);
                        final Object entityId = PropertyAccessorHelper.getId(relationEntity, metadata);
                        Object relationValue = relationsMap != null ? relationsMap.get(relation
                                .getJoinColumnName(kunderaMetadata)) : null;
                        final EntityMetadata targetEntityMetadata = KunderaMetadataManager.getEntityMetadata(
                                kunderaMetadata, relation.getTargetEntity());
                        List immediateRelations = fetchRelations(relation, metadata, pd, entityId, relationValue,
                                targetEntityMetadata);
                        // Here in case of one-to-many/many-to-one we should
                        // skip
                        // this
                        // relation as it
                        if (immediateRelations != null && !immediateRelations.isEmpty())
                        {
                            for (Object immediateRelation : immediateRelations)
                            {
                                if (immediateRelation != null )
                                {
                                    if (existsInRelationStack(relationStack, immediateRelation, targetEntityMetadata))
                                    {
                                        setRelationToEntity(
                                                relationEntity,
                                                fetchFromRelationStack(relationStack, immediateRelation,
                                                        targetEntityMetadata), relation);

                                    }
                                    else
                                    {
                                        addToRelationStack(relationStack, immediateRelation, targetEntityMetadata);
                                        onParseRelation(relationEntity, pd, targetEntityMetadata, immediateRelation,
                                                relation, lazilyloaded, relationStack);
                                      

                                    }
                                    PersistenceCacheManager.addEntityToPersistenceCache(getEntity(relationEntity), pd,
                                            PropertyAccessorHelper.getId(relationEntity, metadata));
                                }
                            }

                        }
                    }
                }
            }
        }
    }
1020685
function parseData(options) {
  return readFileTree(options.src.data, options.keys.data, options);
}