Throws an exception when adding a SchemaConcept using a Label which is already taken
162022
private TransactionException labelTaken(SchemaConcept schemaConcept) {
        if (Schema.MetaSchema.isMetaLabel(schemaConcept.label())) {
            return TransactionException.reservedLabel(schemaConcept.label());
        }
        return PropertyNotUniqueException.cannotCreateProperty(schemaConcept, Schema.VertexProperty.SCHEMA_LABEL, schemaConcept.label());
    }
1036714
private static void addAttrCondition(final List<Condition> conditions, final String name, Object value) {
    if (value instanceof String) {
      if (Strings.isBlank((String) value)) { return; }
      StringBuilder content = new StringBuilder(name);
      content.append(" like :").append(name.replace('.', '_'));
      conditions.add(new Condition(content.toString(), "%" + value + "%"));
    } else if (value instanceof Component) {
      conditions.addAll(extractComponent(name, (Component) value));
      return;
    } else if (value instanceof Entity<?>) {
      try {
        final String key = "id";
        Object property = PropertyUtils.getProperty(value, key);
        if (ValidEntityKeyPredicate.Instance.apply(property)) {
          StringBuilder content = new StringBuilder(name);
          content.append('.').append(key).append(" = :").append(name.replace('.', '_')).append('_')
              .append(key);
          conditions.add(new Condition(content.toString(), property));
        }
      } catch (Exception e) {
        logger.warn("getProperty " + value + "error", e);
      }
    } else {
      conditions.add(new Condition(name + " = :" + name.replace('.', '_'), value));
    }
  }
1299967
@Override
	public void doLabelAcqReport(Example<Instance> trainInst, int labelAcquired) {
		this.acquisitionRateEstimator.add(labelAcquired);
		this.acquiredInstances += labelAcquired;
	}
106337
private Schema createSchema(JAXBContext context) throws IOException, SAXException {
        // This is surprisingly faffy for something that has a generateSchema method! This will only produce
        // a Result object, of which a schema result is not possible but you can produce dom results that
        // can be converted into dom sources to be read by the schema factory. As you can define multiple
        // namespaces you need to have a list of these.
        final List<DOMResult> schemaDomResults = new ArrayList<DOMResult>();

        // First use the context to create the schema dom objects
        context.generateSchema(new SchemaOutputResolver() {

            @Override
            public Result createOutput(String namespaceUri, String suggestedFileName)
                            throws IOException {
                DOMResult domResult = new DOMResult();
                domResult.setSystemId(suggestedFileName);
                schemaDomResults.add(domResult);
                return domResult;
            }
        });

        // convert to a form that can be used by the schema factory
        DOMSource[] schemaDomSources = new DOMSource[schemaDomResults.size()];
        for (int i = 0; i < schemaDomResults.size(); i++) {
            DOMSource domSource = new DOMSource(schemaDomResults.get(i).getNode());
            schemaDomSources[i] = domSource;
        }

        // Finally create the schema
        Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaDomSources);
        return schema;
    }
529137
public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type, String label) {
    if (type == null || label == null) {
      throw new NullPointerException();
    }
    if (subtypeToLabel.containsKey(type) || labelToSubtype.containsKey(label)) {
      throw new IllegalArgumentException("types and labels must be unique");
    }
    labelToSubtype.put(label, type);
    subtypeToLabel.put(type, label);
    return this;
  }
1096707
function(p, propertyName) {
	
	   var fieldDef = { label: propertyName, name: propertyName };
	   var schemaMap = this.schemaToParamMap;
    	var referencedSchema = p["$ref"];
		var key;
	    
	   if(referencedSchema){
	    	var new_schema = null;
	    	if(this.referenceResolver) {
		       new_schema = this.referenceResolver(referencedSchema);
		    }
	    	if(new_schema === null) {
	    		new_schema = this.defaultReferenceResolver(referencedSchema);
	    	}
	    	if(new_schema === null) {
	    		throw new Error('Schema for property : "'+propertyName+'" $references "'+referencedSchema+'", not found');
	    	}
	    	// copy options into new schema, for example we can overide presentation
	    	// of a defined schema depending on where it is used
	    	new_schema = lang.merge(new_schema);	// copy new_schema
	    	
	    	for(var pk in p) {
	    		if(p.hasOwnProperty(pk) && lang.isUndefined(new_schema[pk]) && pk != '$ref') {
	    			new_schema[pk] = p[pk];
	    		}
	    	}
	    	p = new_schema;
	   }

	   if(!p.optional) {
	      fieldDef.required = true;
	   }

	    for(key in schemaMap) {
	        if(schemaMap.hasOwnProperty(key)) {
	      	  var paramName = schemaMap[key]; 
	      	  var v = p[key];
	      	  if(!lang.isUndefined(v)) {
	      		  if(paramName === null) {
	      			  // copy / merge values from v directly into options
	      			  if(lang.isObject(v)) {
	      				  // v must be an object, copy key/value pairs into options
	      				  for(var vkey in v) {
	      					  if(v.hasOwnProperty(vkey)) {
	      						  fieldDef[vkey] = v[vkey];
	      					  }
	      				  }
	      			  }
	      		  } else {
	      			  fieldDef[paramName] = v;
	      		  }
	      	  }
	        }
	    }
	    if(!p.type) p.type = 'object';
	    var type = p.type;
	       
	       // If type is a "Union type definition", we'll use the first type for the field
	       // "array" <=>  [] <=> ["any"]
	       if(lang.isArray(type)) {
	          if(type.length === 0 || (type.length == 1 && type[0] == "any") ) {
	             type = "array";
	          }
	          else {
	             type = type[0];
	          }
	       }
	       //else if(lang.isObject(type) ) {
	          // What do we do ??
	          //console.log("type is an object !!");
	       //}
	       
	       fieldDef.type = type;
	       
	       // default value
	       if( !lang.isUndefined(p["default"]) ) {
	          fieldDef.value = p["default"];
	       }
	    
	       if(type == "array" ) {
	          fieldDef.type = "list";
	          if(lang.isObject(p.items) && !lang.isArray(p.items)) {
	        	  // when items is an object, it's a schema that describes each item in the list
	        	  fieldDef.elementType = this.schemaToInputEx(p.items, propertyName);
	          }
	
		       if(p.minItems) { fieldDef.minItems = p.minItems; }
				 if(p.maxItems) { fieldDef.maxItems = p.maxItems; }
	
	       }
	       else if(type == "object" ) {
	          fieldDef.type = "group";
	          if(p.title && lang.isUndefined(fieldDef.legend)) {
	        	  fieldDef.legend = p.title; 
	          }
	          //fieldDef = this.schemaToInputEx(p, propertyName);
	          //fieldDef = this._parseSchemaProperty(p, propertyName);
	          var fields = [];
	          if(propertyName) {
	        	  fieldDef.name = propertyName;
	          }
	
	          for(key in p.properties) {
	             if(p.properties.hasOwnProperty(key)) {
	                fields.push( this.schemaToInputEx(p.properties[key], key) );
	             }
	          }
	
	          fieldDef.fields = fields;
	          
	       }
	       else if(type == "string" && (p["enum"] || p["choices"]) ) {
	          fieldDef.type = "select";
	          
	          if(p.choices) {
	             fieldDef.choices = [];
	             for(var i = 0 ; i < p.choices.length ; i++) {
	                var o = p.choices[i];
	                fieldDef.choices[i] = { label: o.label, value: o.value };
	             }
             }
             else { // p.choices
	             fieldDef.choices = [];
	             for(var i = 0 ; i < p["enum"].length ; i++) {
	                var o = p["enum"][i];
						 if(YAHOO.lang.isObject(o)) {
	                	fieldDef.choices[i] = { label: o.label, value: o.value };
						 }
						 else {
							fieldDef.choices[i] = { value: o };
						 }
	             }
             }		
	       }
	       else if(type == "string") {
	    	  if(!lang.isUndefined(p.pattern) && lang.isUndefined(fieldDef.regexp)) {
	    		  if(lang.isString(p.pattern)) {
	    			  fieldDef.regexp = new RegExp(p.pattern);
	    		  } else {
	    			  fieldDef.regexp = p.pattern;
	    		  }
	    	  }
	    	  if(!lang.isUndefined(p.maxLength) && lang.isUndefined(fieldDef.maxLength)) {
	    		  fieldDef.maxLength = p.maxLength; 
	    	  }

	    	  if(!lang.isUndefined(p.minLength) && lang.isUndefined(fieldDef.minLength)) {
	    		  fieldDef.minLength = p.minLength; 
	    	  }

	    	  if(!lang.isUndefined(p.readonly) && lang.isUndefined(fieldDef.readonly)) {
	    		  fieldDef.readonly = p.readonly; 
	    	  }

           // According to http://groups.google.com/group/json-schema/web/json-schema-possible-formats
	          if( p.format ) {
	             if(p.format == "html") {
	                fieldDef.type = "html";
	             } else if(p.format == "date") {
	                fieldDef.type = "date";
	                fieldDef.tooltipIcon = true;
	             } else if(p.format == 'url') {
	            	 fieldDef.type = 'url';
	             } else if(p.format == 'email') {
	            	 fieldDef.type = 'email';
	             } else if(p.format == 'text') {
	            	 fieldDef.type = 'text';
	             } else if(p.format == 'time') {
	                fieldDef.type = 'time';
	             } else if(p.format == 'ip-address') {
    	             fieldDef.type = 'IPv4';
    	          } else if(p.format == 'color') {
    	             fieldDef.type = 'color';
    	          }
	          }
	       }
	
			 // Override inputEx's type with the "_type" attribute
			 if( !!p["_inputex"] && !!p["_inputex"]["_type"]) {
				fieldDef.type = p["_inputex"]["_type"];
			 }
	
	    // Add the defaultOptions
	    for(var kk in this.defaultOptions) {
	        if(this.defaultOptions.hasOwnProperty(kk) && lang.isUndefined(fieldDef[kk])) {
	        	fieldDef[kk] = this.defaultOptions[kk]; 
	        }	    	
	    }
	    return fieldDef;
	}
1206311
function checkLabelEnablementPreconditions(oControl) {
		if (!oControl) {
			throw new Error("sap.ui.core.LabelEnablement cannot enrich null");
		}
		var oMetadata = oControl.getMetadata();
		if (!oMetadata.isInstanceOf("sap.ui.core.Label")) {
			throw new Error("sap.ui.core.LabelEnablement only supports Controls with interface sap.ui.core.Label");
		}
		var oLabelForAssociation = oMetadata.getAssociation("labelFor");
		if (!oLabelForAssociation || oLabelForAssociation.multiple) {
			throw new Error("sap.ui.core.LabelEnablement only supports Controls with a to-1 association 'labelFor'");
		}
		//Add more detailed checks here ?
	}
1224303
protected void addError(String message, ASTNode node, SourceUnit source) {
        source.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(new SyntaxException(
                message,  node.getLineNumber(), node.getColumnNumber(), node.getLastLineNumber(), node.getLastColumnNumber()
                ), source));
    }
772591
private void createSchemaOnDb() {
        StringBuilder sql = new StringBuilder();
        sql.append(topology.getSqlgGraph().getSqlDialect().createSchemaStatement(this.name));
        if (this.sqlgGraph.getSqlDialect().needsSemicolon()) {
            sql.append(";");
        }
        if (logger.isDebugEnabled()) {
            logger.debug(sql.toString());
        }
        Connection conn = this.sqlgGraph.tx().getConnection();
        try (Statement stmt = conn.createStatement()) {
            stmt.execute(sql.toString());
        } catch (SQLException e) {
            logger.error("schema creation failed " + this.sqlgGraph.toString(), e);
            throw new RuntimeException(e);
        }
    }
971701
private SchemaColumnConvertNotSupportedException constructConvertNotSupportedException(
      ColumnDescriptor descriptor,
      WritableColumnVector column) {
    return new SchemaColumnConvertNotSupportedException(
      Arrays.toString(descriptor.getPath()),
      descriptor.getPrimitiveType().getPrimitiveTypeName().toString(),
      column.dataType().catalogString());
  }
1355853
def add(self, label):
        
        self._labels[label.id] = label
        self._dirty = True
905070
public void addException(String className) {
        if (mExceptions == null) {
            addAttribute(new ExceptionsAttr(mCp));
        }

        ConstantClassInfo cci = ConstantClassInfo.make(mCp, className);
        mExceptions.addException(cci);
    }
336503
def __addNode(self, name, cls):
        '''
        
        '''
        if name in self.nodes:
            raise Exception("A node by the name {} already exists.  Can't add a duplicate.".format(name))
        self.__nxgraph.add_node(name)
        self.__nxgraph.node[name]['label'] = name
        self.__nxgraph.node[name]['nodeobj'] = cls()
        self.__nxgraph.node[name]['type'] = cls.__name__
258337
public void addDict(int cp, int label, int count) {
	Element elem = (Element)dict.get(new Integer(cp));
	
	if (elem == null) {
	    // if the context predicate is not found
	    elem = new Element();
	    elem.count = count;
	    
	    CountFIdx cntFIdx = new CountFIdx(count, -1);
	    elem.lbCntFidxes.put(new Integer(label), cntFIdx);
	    
	    // insert the new element to the dict
	    dict.put(new Integer(cp), elem);
	    
	} else {
	    // update the total count
	    elem.count += count;
	    
	    CountFIdx cntFIdx = (CountFIdx)elem.lbCntFidxes.get(new Integer(label));
	    if (cntFIdx == null) {
		// the label not found
		cntFIdx = new CountFIdx(count, -1);
		elem.lbCntFidxes.put(new Integer(label), cntFIdx);
		
	    } else {
		// if label found, update the count only
		cntFIdx.count += count;
	    }
	}
    }
439109
def insert(self, schema, fields, **kwargs):
        
        r = 0

        with self.connection(**kwargs) as connection:
            kwargs['connection'] = connection
            try:
                with self.transaction(**kwargs):
                    r = self._insert(schema, fields, **kwargs)

            except Exception as e:
                exc_info = sys.exc_info()
                if self.handle_error(schema, e, **kwargs):
                    r = self._insert(schema, fields, **kwargs)
                else:
                    self.raise_error(e, exc_info)

        return r
1328690
def addinstance(self, testfile, features, classlabel="?"):
        """"""

        features = self.validatefeatures(features)

        if self.delimiter in classlabel:
            raise ValueError("Class label contains delimiter: " + self.delimiter)


        f = io.open(testfile,'a', encoding=self.encoding)
        f.write(self.delimiter.join(features) + self.delimiter + classlabel + "\n")
        f.close()
453345
public void addException(TypeDesc type) {
        if (mExceptions == null) {
            addAttribute(new ExceptionsAttr(mCp));
        }
        // TODO: Special handling for generics
        ConstantClassInfo cci = mCp.addConstantClass(type);
        mExceptions.addException(cci);
    }