tasks/jsonld/js/jsonld.js
function _embedValues(state, subject, property, output) {
  // embed subject properties in output
  var objects = subject[property];
  for(var i = 0; i < objects.length; ++i) {
    var o = objects[i];

    // recurse into @list
    if(_isList(o)) {
      var list = {'@list': []};
      _addFrameOutput(state, output, property, list);
      return _embedValues(state, o, '@list', list['@list']);
    }

    // handle subject reference
    if(_isSubjectReference(o)) {
      var id = o['@id'];

      // embed full subject if isn't already embedded
      if(!(id in state.embeds)) {
        // add embed
        var embed = {parent: output, property: property};
        state.embeds[id] = embed;

        // recurse into subject
        o = {};
        var s = state.subjects[id];
        for(var prop in s) {
          // copy keywords
          if(_isKeyword(prop)) {
            o[prop] = _clone(s[prop]);
            continue;
          }
          _embedValues(state, s, prop, o);
        }
      }
      _addFrameOutput(state, output, property, o);
    }
    // copy non-subject value
    else {
      _addFrameOutput(state, output, property, _clone(o));
    }
  }
}
function _embedValues(state, subject, property, output) {
  // embed subject properties in output
  var objects = subject[property];
  for(var i = 0; i < objects.length; ++i) {
    var o = objects[i];

    // recurse into @list
    if(_isList(o)) {
      var list = {'@list': []};
      _addFrameOutput(state, output, property, list);
      return _embedValues(state, o, '@list', list['@list']);
    }

    // handle subject reference
    if(_isSubjectReference(o)) {
      var id = o['@id'];

      // embed full subject if isn't already embedded
      if(!(id in state.embeds)) {
        // add embed
        var embed = {parent: output, property: property};
        state.embeds[id] = embed;

        // recurse into subject
        o = {};
        var s = state.subjects[id];
        for(var prop in s) {
          // copy keywords
          if(_isKeyword(prop)) {
            o[prop] = _clone(s[prop]);
            continue;
          }
          _embedValues(state, s, prop, o);
        }
      }
      _addFrameOutput(state, output, property, o);
    }
    // copy non-subject value
    else {
      _addFrameOutput(state, output, property, _clone(o));
    }
  }
}
function _embedValues ( state , subject , property , output ) { // embed subject properties in output var objects = subject [ property ] ; for ( var i = 0 ; i < objects . length ; ++ i ) { var o = objects [ i ] ; // recurse into @list if ( _isList ( o ) ) { var list = { '@list' : [ ] } ; _addFrameOutput ( state , output , property , list ) ; return _embedValues ( state , o , '@list' , list [ '@list' ] ) ; } // handle subject reference if ( _isSubjectReference ( o ) ) { var id = o [ '@id' ] ; // embed full subject if isn't already embedded if ( ! ( id in state . embeds ) ) { // add embed var embed = { parent : output , property : property } ; state . embeds [ id ] = embed ; // recurse into subject o = { } ; var s = state . subjects [ id ] ; for ( var prop in s ) { // copy keywords if ( _isKeyword ( prop ) ) { o [ prop ] = _clone ( s [ prop ] ) ; continue ; } _embedValues ( state , s , prop , o ) ; } } _addFrameOutput ( state , output , property , o ) ; } // copy non-subject value else { _addFrameOutput ( state , output , property , _clone ( o ) ) ; } } }
Embeds values for the given subject and property into the given output
during the framing algorithm.

@param state the current framing state.
@param subject the subject.
@param property the property.
@param output the output.
Embeds values for the given subject and property into the given output during the framing algorithm .