Interprets a DATA attribute and add it to the datastream.
172184
def add_data_attribute(self, data_attr):
        ''''''
        if data_attr.header.attr_type_id is not AttrTypes.DATA:
            raise DataStreamError("Invalid attribute. A Datastream deals only with DATA attributes")
        if data_attr.header.attr_name != self.name:
            raise DataStreamError(f"Data from a different stream '{data_attr.header.attr_name}' cannot be add to this stream")

        if data_attr.header.non_resident:
            nonr_header = data_attr.header
            if self._data_runs is None:
                self._data_runs = []
            if nonr_header.end_vcn > self.cluster_count:
                self.cluster_count = nonr_header.end_vcn
            if not nonr_header.start_vcn: #start_vcn == 0
                self.size = nonr_header.curr_sstream
                self.alloc_size = nonr_header.alloc_sstream
            self._data_runs.append((nonr_header.start_vcn, nonr_header.data_runs))
            self._data_runs_sorted = False
        else: #if it is resident
            self.size = self.alloc_size = data_attr.header.content_len
            self._pending_processing = None
            #respects mft_config["load_data"]
            self._content = data_attr.content.content
520704
function addData(a)
        {
            if(isObject(a.event.value) || isArray(a.event.value))
            {
                if(!isObservable(a.event.value))
                {
                    a.preventDefault();
                    var local = a.event.local,
                        str = local.__kbscopeString+(local.__kbscopeString.length !== 0 ? '.' : '')+a.key,
                        builder = (isObject(a.event.value) ? KObject : KArray)(local.__kbname,local,str);
                    
                    overwrite(builder).parseData(a.event.value);
                    if(local[a.key] === undefined)
                    {
                      local.add(a.key,builder);
                    }
                    else if(isArray(local))
                    {
                      local.splice(a.key,0,builder);
                    }
                    else if(isObject(local))
                    {
                      local.set(a.key,builder);
                    }
                }
            }
        }
933231
def add(cls, name, value):
        """"""
        attr = cls(value)
        attr._name = name
        setattr(cls, name, attr)
723832
public final T setData(String attributeName, String value) {
    setAttribute(ATTRIBUTE_DATA_PREFIX + attributeName, value);
    return (T)this;
  }
948067
function handleAttributeContext(attrNode, context) {
    if (!attrNode.type && attrNode.inherit !== 'inherit') attrNode.type = 'string';

    if (attrNode.map) {
        Object.keys(attrNode.map).forEach(mappingName => {
            const mapping = attrNode.map[mappingName];

            Object.keys(mapping).forEach(dataSourceName => {
                if (!context.dataSourceAttributes[dataSourceName]) {
                    throw new ImplementationError(
                        `Unknown DataSource "${dataSourceName}" in map${context.errorContext}`
                    );
                }

                context.dataSourceAttributes[dataSourceName].push(mapping[dataSourceName]);
            });
        });

        if ('value' in attrNode) {
            throw new ImplementationError(
                'Static "value" in combination with "map" makes no sense' + context.errorContext
            );
        }
    }
}
1163539
public void addDataElement(String elemName, String content, Attributes attrs) {
        writeDataElement(elemName, attrs, content);
    }
81117
private void appendAttribute(Appendable buf, String attrName, String encodedValue) throws IOException {
        buf.append(' ').append(attrName).append('=').append('\"').append(encodedValue).append('\"');
    }
936847
public void addAttr(String attr, Object val) throws NamingException {
//  System.out.println("addAttr " + attr);

    Attribute a = findAttr(attr);

    if (a == null) {
      setAttr(attr, val);
    } else {
      a.add(val);
    }
  }
919353
def add_attr(self, name, value):
        """"""
        setattr(self, name, value)
        self.attrs.append(name)
321706
def addDataset(self):
        
        self._openRepo()
        dataset = datasets.Dataset(self._args.datasetName)
        dataset.setDescription(self._args.description)
        dataset.setAttributes(json.loads(self._args.attributes))
        self._updateRepo(self._repo.insertDataset, dataset)
256972
def add(self, data):
        """"""
        assert isinstance(data, bytes)
        with self.lock:
            self.buf += data
183494
private void setRDFAsDatastream(StringBuffer buf) {

        DatastreamXMLMetadata ds = new DatastreamXMLMetadata();
        // set the attrs common to all datastream versions
        ds.DatastreamID = "RELS-INT";
        ds.DSVersionable = false;
        ds.DSFormatURI = m_dsFormatURI;
        ds.DatastreamAltIDs = m_dsAltIDs;
        ds.DSVersionID = "RELS-INT.0";
        ds.DSLabel =
                "DO NOT EDIT: System-generated datastream to preserve METS DMDID/ADMID relationships.";
        ds.DSCreateDT = new Date();
        ds.DSMIME = "application/rdf+xml";
        // set the attrs specific to datastream version
        ds.DSControlGrp = "X";
        ds.DSState = "A";
        ds.DSLocation =
                m_obj.getPid() + "+" + ds.DatastreamID + "+" + ds.DSVersionID;
        ds.DSLocationType = Datastream.DS_LOCATION_TYPE_INTERNAL;
        ds.DSInfoType = "DATA";
        ds.DSMDClass = DatastreamXMLMetadata.TECHNICAL;

        // now set the xml content stream itself...
        try {
            ds.xmlContent = buf.toString().getBytes(m_characterEncoding);
            ds.DSSize = ds.xmlContent.length;
        } catch (UnsupportedEncodingException uee) {
            logger.error("Encoding error when creating RELS-INT datastream", uee);
        }
        // FINALLY! add the RDF and an inline xml datastream in the digital object
        m_obj.addDatastreamVersion(ds, true);
    }
1251042
private void readInstance(StreamTokenizer tokenizer, AttributeDataset data, Attribute[] attributes) throws IOException, ParseException {
        double[] x = responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
        double y = Double.NaN;
        
        // Get values for all attributes.
        for (int i = 0, k = 0; i < attributes.length; i++) {
            // Get next token
            if (i > 0) {
                getNextToken(tokenizer);
            }

            if (i == responseIndex) {
                if (tokenizer.ttype == '?') {
                    y = Double.NaN;
                } else {
                    y = attributes[i].valueOf(tokenizer.sval);
                }
            } else {
                if (tokenizer.ttype == '?') {
                    x[k++] = Double.NaN;
                } else {
                    x[k++] = attributes[i].valueOf(tokenizer.sval);
                }
            }
        }

        if (Double.isNaN(y)) data.add(x); else data.add(x, y);
    }
37517
def define_attribute(self, name, atype, data=None):
        
        self.attributes.append(name)
        assert atype in TYPES, "Unknown type '%s'. Must be one of: %s" % (atype, ', '.join(TYPES),)
        self.attribute_types[name] = atype
        self.attribute_data[name] = data
289233
@Benchmark
  @BenchmarkMode(Mode.SampleTime)
  @OutputTimeUnit(TimeUnit.NANOSECONDS)
  public Span putAttribute(Data data) {
    data.span.putAttribute(ATTRIBUTE_KEY, AttributeValue.stringAttributeValue(ATTRIBUTE_VALUE));
    return data.span;
  }
240635
public AttributeDataset parse(String name, InputStream stream) throws IOException, ParseException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(stream));

        String line = reader.readLine();
        if (line == null) {
            throw new IOException("Empty data source.");
        }

        String[] tokens = line.split("\t", -1);
        int p = (tokens.length - 2) / 2;

        line = reader.readLine();
        if (line == null) {
            throw new IOException("Premature end of file.");
        }

        String[] samples = line.split("\t", -1);
        if (samples.length != tokens.length-1) {
            throw new IOException("Invalid sample description header.");
        }
        
        Attribute[] attributes = new Attribute[p];
        for (int i = 0; i < p; i++) {
            attributes[i] = new NumericAttribute(tokens[2*i+2], samples[2*i+1]);
        }
        
        line = reader.readLine();
        if (line == null) {
            throw new IOException("Premature end of file.");
        }

        int n = Integer.parseInt(line);
        if (n <= 0) {
            throw new IOException("Invalid number of rows: " + n);            
        }
        
        AttributeDataset data = new AttributeDataset(name, attributes);
        
        for (int i = 0; i < n; i++) {
            line = reader.readLine();
            if (line == null) {
                throw new IOException("Premature end of file.");
            }
            
            tokens = line.split("\t", -1);
            if (tokens.length != samples.length+1) {
                throw new IOException(String.format("Invalid number of elements of line %d: %d", i+4, tokens.length));
            }

            double[] x = new double[p];
            for (int j = 0; j < p; j++) {
                x[j] = Double.valueOf(tokens[2*j+2]);
            }

            AttributeDataset.Row datum = data.add(x);
            datum.name = tokens[1];
            datum.description = tokens[0];
        }
        
        reader.close();
        return data;
    }
271532
function(key, value) {
            console.log('add attribute', key, value);
            if(! value) {
                return;
            }
            if(VCard.multivaluedKeys[key]) {
                if(this[key]) {
                    console.log('multivalued push');
                    this[key].push(value)
                } else {
                    console.log('multivalued set');
                    this.setAttribute(key, [value]);
                }
            } else {
                this.setAttribute(key, value);
            }
        }