qualifierType_2 : ':' dataType
                       | ':' dataType defaultValue
2738
def p_qualifierType_2(p):
    
    dv = None
    if len(p) == 4:
        dv = p[3]
    p[0] = (p[2], False, None, dv)
1184586
@Nullable
    private AttributeType.DataType<?> validateAndGetTargetDataType(GraqlCompute.Statistics.Value query) {
        AttributeType.DataType<?> dataType = null;
        for (Type type : targetTypes(query)) {
            // check if the selected type is a attribute type
            if (!type.isAttributeType()) throw GraqlQueryException.mustBeAttributeType(type.label());
            AttributeType<?> attributeType = type.asAttributeType();
            if (dataType == null) {
                // check if the attribute type has data-type LONG or DOUBLE
                dataType = attributeType.dataType();
                if (!dataType.equals(AttributeType.DataType.LONG) && !dataType.equals(AttributeType.DataType.DOUBLE)) {
                    throw GraqlQueryException.attributeMustBeANumber(dataType, attributeType.label());
                }
            } else {
                // check if all the attribute types have the same data-type
                if (!dataType.equals(attributeType.dataType())) {
                    throw GraqlQueryException.attributesWithDifferentDataTypes(query.of());
                }
            }
        }
        return dataType;
    }
1121373
function normalizeFilterValues(sType, oFilter) {
		switch (sType) {
			case "Edm.Decimal":
			case "Edm.Int64":
				if (typeof oFilter.oValue1 == "number") {
					oFilter.oValue1 = oFilter.oValue1.toString();
				}
				if (typeof oFilter.oValue2 == "number") {
					oFilter.oValue2 = oFilter.oValue2.toString();
				}
				break;
			case "Edm.Byte":
			case "Edm.Int16":
			case "Edm.Int32":
			case "Edm.SByte":
				if (typeof oFilter.oValue1 == "string") {
					oFilter.oValue1 = parseInt(oFilter.oValue1);
				}
				if (typeof oFilter.oValue2 == "string") {
					oFilter.oValue2 = parseInt(oFilter.oValue2);
				}
				break;
			case "Edm.Float":
			case "Edm.Single":
			case "Edm.Double":
				if (typeof oFilter.oValue1 == "string") {
					oFilter.oValue1 = parseFloat(oFilter.oValue1);
				}
				if (typeof oFilter.oValue2 == "string") {
					oFilter.oValue2 = parseFloat(oFilter.oValue2);
				}
				break;
			default:
				// Nothing to do
		}
	}
998561
public Object convertToDefaultType(SessionInterface session, Object a) {

        if (a == null) {
            return a;
        }

        Type otherType;

        if (a instanceof Number) {
            if (a instanceof BigInteger) {
                a = new BigDecimal((BigInteger) a);
            } else if (a instanceof Float) {
                a = new Double(((Float) a).doubleValue());
            } else if (a instanceof Byte) {
                a = ValuePool.getInt(((Byte) a).intValue());
            } else if (a instanceof Short) {
                a = ValuePool.getInt(((Short) a).intValue());
            }

            if (a instanceof Integer) {
                otherType = Type.SQL_INTEGER;
            } else if (a instanceof Long) {
                otherType = Type.SQL_BIGINT;
            } else if (a instanceof Double) {
                otherType = Type.SQL_DOUBLE;
            } else if (a instanceof BigDecimal) {
                // BEGIN Cherry-picked code change from hsqldb-2.2.8
                otherType = Type.SQL_DECIMAL_DEFAULT;
/*
                if (typeCode == Types.SQL_DECIMAL
                        || typeCode == Types.SQL_NUMERIC) {
                    return convertToTypeLimits(session, a);
                }

                BigDecimal val = (BigDecimal) a;

                otherType = getNumberType(Types.SQL_DECIMAL,
                                          JavaSystem.precision(val), scale);
*/
                // END Cherry-picked code change from hsqldb-2.2.8
            } else {
                throw Error.error(ErrorCode.X_42561);
            }

            // BEGIN Cherry-picked code change from hsqldb-2.2.8
            switch (typeCode) {

                case Types.TINYINT :
                case Types.SQL_SMALLINT :
                case Types.SQL_INTEGER :
                    return convertToInt(session, a, Types.INTEGER);

                case Types.SQL_BIGINT :
                    return convertToLong(session, a);

                case Types.SQL_REAL :
                case Types.SQL_FLOAT :
                case Types.SQL_DOUBLE :
                    return convertToDouble(a);

                case Types.SQL_NUMERIC :
                case Types.SQL_DECIMAL : {
                    a = convertToDecimal(a);

                    BigDecimal dec = (BigDecimal) a;

                    if (scale != dec.scale()) {
                        dec = dec.setScale(scale, BigDecimal.ROUND_HALF_DOWN);
                    }

                    return dec;
                }
                default :
                    throw Error.error(ErrorCode.X_42561);
            }
            // END Cherry-picked code change from hsqldb-2.2.8
        } else if (a instanceof String) {
            otherType = Type.SQL_VARCHAR;
        } else {
            throw Error.error(ErrorCode.X_42561);
        }

        return convertToType(session, a, otherType);
    }
610935
function defaultValue(spec)
{
  if (util.isRegExp(spec)) return "";
	return ({
        "string": "",
        "id": null,
        "number": 0,
        "boolean": false,
        "date": new Date(),
        "regexp": new RegExp(),
        "function": function() { },
        "array": [],
        "object": {}
    })[spec];
}
667133
public static void blankValue(CodeBuilder b, TypeDesc type) {
        switch (type.getTypeCode()) {
        default:
            b.loadNull();
            break;

        case TypeDesc.BYTE_CODE:
        case TypeDesc.CHAR_CODE:
        case TypeDesc.SHORT_CODE:
        case TypeDesc.INT_CODE:
            b.loadConstant(0);
            break;

        case TypeDesc.BOOLEAN_CODE:
            b.loadConstant(false);
            break;

        case TypeDesc.LONG_CODE:
            b.loadConstant(0L);
            break;

        case TypeDesc.FLOAT_CODE:
            b.loadConstant(0.0f);
            break;

        case TypeDesc.DOUBLE_CODE:

            b.loadConstant(0.0);
            break;
        }
    }
1287404
public void setQualifierName(String v) {
    if (MeshHeading_Type.featOkTst && ((MeshHeading_Type)jcasType).casFeat_qualifierName == null)
      jcasType.jcas.throwFeatMissing("qualifierName", "de.julielab.jules.types.MeshHeading");
    jcasType.ll_cas.ll_setStringValue(addr, ((MeshHeading_Type)jcasType).casFeatCode_qualifierName, v);}
241227
private void loadBlankValue(CodeAssembler a, TypeDesc type) {
        switch (type.getTypeCode()) {
        case TypeDesc.OBJECT_CODE:
            a.loadNull();
            break;
        case TypeDesc.LONG_CODE:
            a.loadConstant(0L);
            break;
        case TypeDesc.FLOAT_CODE:
            a.loadConstant(0.0f);
            break;
        case TypeDesc.DOUBLE_CODE:
            a.loadConstant(0.0d);
            break;
        case TypeDesc.INT_CODE: default:
            a.loadConstant(0);
            break;
        }
    }
710626
private String validateDialect(String confParam)
   {
      for (String dbType : DBConstants.DB_DIALECTS)
      {
         if (confParam.equals(dbType))
         {
            return dbType;
         }
      }

      return DBConstants.DB_DIALECT_AUTO; // by default
   }
106747
public void setQualifier(String qualifier) {
        SystemAssert.requireArgument(qualifier != null && !qualifier.isEmpty(), "Namespace qualifier cannot be null or empty.");
        this.qualifier = qualifier;
    }
1308082
def _ValidateDataTypeDefinition(cls, data_type_definition):
    
    if not cls._IsIdentifier(data_type_definition.name):
      raise ValueError(
          'Data type definition name: {0!s} not a valid identifier'.format(
              data_type_definition.name))

    if keyword.iskeyword(data_type_definition.name):
      raise ValueError(
          'Data type definition name: {0!s} matches keyword'.format(
              data_type_definition.name))

    members = getattr(data_type_definition, 'members', None)
    if not members:
      raise ValueError(
          'Data type definition name: {0!s} missing members'.format(
              data_type_definition.name))

    defined_attribute_names = set()

    for member_definition in members:
      attribute_name = member_definition.name

      if not cls._IsIdentifier(attribute_name):
        raise ValueError('Attribute name: {0!s} not a valid identifier'.format(
            attribute_name))

      if attribute_name.startswith('_'):
        raise ValueError('Attribute name: {0!s} starts with underscore'.format(
            attribute_name))

      if keyword.iskeyword(attribute_name):
        raise ValueError('Attribute name: {0!s} matches keyword'.format(
            attribute_name))

      if attribute_name in defined_attribute_names:
        raise ValueError('Attribute name: {0!s} already defined'.format(
            attribute_name))

      defined_attribute_names.add(attribute_name)
1116566
def _enforceDataType(self, data):
        
        idx = int(data)
        if idx < 0:
            idx += len(self._displayValues)
        assert 0 <= idx < len(self._displayValues), \
            "Index should be >= 0 and < {}. Got {}".format(len(self._displayValues), idx)
        return idx
755057
static String checkDefaultJson(JsonNode defaultJson, Schema schema) {
        Schema.Type fieldType = schema.getType();
        String expectedVal = null;
        switch(fieldType) {
            case NULL:
                if(!defaultJson.isNull()) {
                    expectedVal = "null";
                }

                break;
            case BOOLEAN:
                if(!defaultJson.isBoolean()) {
                    expectedVal = "boolean";
                }
                break;
            case INT:
                if(!defaultJson.isInt()) {
                    expectedVal = "int";
                }
                break;
            case LONG:
                if(!defaultJson.isInt() && !defaultJson.isLong()) {
                    expectedVal = "long";
                }
                break;
            case FLOAT:
            case DOUBLE:
                if(!defaultJson.isNumber()) {
                    expectedVal = "number";
                }
                break;
            case BYTES:
                if(defaultJson.isTextual()) {
                    break;
                }
                expectedVal = "bytes (ex. \"\\u00FF\")";
                break;
            case STRING:
                if(!defaultJson.isTextual()) {
                    expectedVal = "string";
                }
                break;
            case ENUM:
                if(defaultJson.isTextual()) {
                    if(schema.hasEnumSymbol(defaultJson.getTextValue())) {
                        break;
                    }
                }
                expectedVal = "valid enum";
                break;
            case FIXED:
                if(defaultJson.isTextual()) {
                    byte[] fixed = defaultJson.getValueAsText().getBytes();
                    if(fixed.length == schema.getFixedSize()) {
                        break;
                    }
                    expectedVal = "fixed size incorrect. Expected size: " + schema.getFixedSize()
                                  + " got size " + fixed.length;
                    break;
                }
                expectedVal = "fixed (ex. \"\\u00FF\")";
                break;
            case ARRAY:
                if(defaultJson.isArray()) {
                    // Check all array variables
                    boolean isGood = true;
                    for(JsonNode node: defaultJson) {
                        String val = checkDefaultJson(node, schema.getElementType());
                        if(val == null) {
                            continue;
                        } else {
                            isGood = false;
                            break;
                        }
                    }

                    if(isGood) {
                        break;
                    }
                }
                expectedVal = "array of type " + schema.getElementType().toString();
                break;
            case MAP:
                if(defaultJson.isObject()) {
                    boolean isGood = true;
                    for(JsonNode node: defaultJson) {
                        String val = checkDefaultJson(node, schema.getValueType());
                        if(val == null) {
                            continue;
                        } else {
                            isGood = false;
                            break;
                        }
                    }

                    if(isGood) {
                        break;
                    }
                }

                expectedVal = "map of type " + schema.getValueType().toString();
                break;
            case RECORD:
                if(defaultJson.isObject()) {
                    boolean isGood = true;
                    for(Field field: schema.getFields()) {
                        JsonNode jsonNode = defaultJson.get(field.name());

                        if(jsonNode == null) {
                            jsonNode = field.defaultValue();
                            if(jsonNode == null) {
                                isGood = false;
                                break;
                            }
                        }

                        String val = checkDefaultJson(jsonNode, field.schema());
                        if(val != null) {
                            isGood = false;
                            break;
                        }
                    }

                    if(isGood) {
                        break;
                    }
                }

                expectedVal = "record of type " + schema.toString();
                break;
            case UNION:
                // Avro spec states we only need to match with the first item
                expectedVal = checkDefaultJson(defaultJson, schema.getTypes().get(0));
                break;
        }

        return expectedVal;
    }
983655
@Override
    public void validateDefault(InputProblemReporter rep, boolean normalize)
        throws XMLStreamException
    {
        // First, basic checks that it's a valid non-empty name:
        String def = validateDefaultName(rep, normalize);

        // And then that it's one of listed values:
        String shared = mEnumValues.find(def);
        if (shared == null) {
            reportValidationProblem(rep, "Invalid default value '"+def+"': has to be one of ("
                                    +mEnumValues+")");
        }

        // Ok, cool it's ok...
        if (normalize) {
            mDefValue.setValue(shared);
        }
    }
10202
def check_value_and_type(value, data_type):
        
        if value is not None and data_type is not type(None):
            # if not isinstance(value, data_type):
            if not type_inherits_of_type(data_type, type(value)):
                raise TypeError(
                    "Value: '{0}' is not of data type: '{1}', value type: {2}".format(value, data_type, type(value)))
1063379
function $$getDefaultValue() {
      if (!injector) throw new Error("Injectable functions cannot be called at configuration time");
      var defaultValue = injector.invoke(config.$$fn);
      if (defaultValue !== null && defaultValue !== undefined && !self.type.is(defaultValue))
        throw new Error("Default value (" + defaultValue + ") for parameter '" + self.id + "' is not an instance of Type (" + self.type.name + ")");
      return defaultValue;
    }
848695
private void parseDefault(String elementName, String name, String type,
            String enumer) throws Exception {
        int valueType = ATTRIBUTE_DEFAULT_SPECIFIED;
        String value = null;
        int flags = LIT_ATTRIBUTE;
        boolean saved = expandPE;
        String defaultType = null;

        // LIT_ATTRIBUTE forces '<' checks now (ASAP) and turns whitespace
        // chars to spaces (doesn't matter when that's done if it doesn't
        // interfere with char refs expanding to whitespace).

        if (!skippedPE) {
            flags |= LIT_ENTITY_REF;
            if (handler.stringInterning) {
                if ("CDATA" != type) {
                    flags |= LIT_NORMALIZE;
                }
            } else {
                if (!"CDATA".equals(type)) {
                    flags |= LIT_NORMALIZE;
                }
            }
        }

        expandPE = false;
        if (tryRead('#')) {
            if (tryRead("FIXED")) {
                defaultType = "#FIXED";
                valueType = ATTRIBUTE_DEFAULT_FIXED;
                requireWhitespace();
                value = readLiteral(flags);
            } else if (tryRead("REQUIRED")) {
                defaultType = "#REQUIRED";
                valueType = ATTRIBUTE_DEFAULT_REQUIRED;
            } else if (tryRead("IMPLIED")) {
                defaultType = "#IMPLIED";
                valueType = ATTRIBUTE_DEFAULT_IMPLIED;
            } else {
                fatal("illegal keyword for attribute default value");
            }
        } else {
            value = readLiteral(flags);
        }
        expandPE = saved;
        setAttribute(elementName, name, type, enumer, value, valueType);
        if (handler.stringInterning) {
            if ("ENUMERATION" == type) {
                type = enumer;
            } else if ("NOTATION" == type) {
                type = "NOTATION " + enumer;
            }
        } else {
            if ("ENUMERATION".equals(type)) {
                type = enumer;
            } else if ("NOTATION".equals(type)) {
                type = "NOTATION " + enumer;
            }
        }
        if (!skippedPE) {
            handler.getDeclHandler().attributeDecl(elementName, name, type,
                    defaultType, value);
        }
    }