Returns True if the given schema is already registered under the
        given subject.
19045
def schema_is_registered_for_subject(self, subject, schema):
        
        data = json.dumps({'schema': json.dumps(schema)})
        res = requests.post(self._url('/subjects/{}', subject), data=data, headers=HEADERS)
        if res.status_code == 404:
            return False
        raise_if_failed(res)
        return True
354474
public function validate($subject): bool
    {
        $validatedCount = 0;
        foreach ($this->schema['oneOf'] as $schema) {
            $nodeValidator = new NodeValidator($schema, $this->rootSchema);
            if ($nodeValidator->validate($subject)) {
                $validatedCount++;
            }
        }
        return $validatedCount === 1;
    }
1342558
final boolean match(final Subject subject,
                        final SICoreConnection coreConnection) {

        boolean subjectsMatch = (_subject == null) ? (subject == null)
                        : (_subject.equals(subject));
        boolean coreConnectionsMatch = (coreConnection == null)
                                       || coreConnection.isEquivalentTo(_coreConnection);

        return subjectsMatch && coreConnectionsMatch && isValid();

    }
993791
private function validateAdditionalItems(array $subject, array $schema): bool
    {
        $subject = \array_slice($subject, count($schema['items']));

        if (\is_bool($schema['additionalItems'])) {
            return $this->validateAdditionalItemsSchemaBoolean($subject, $schema);
        }
        if (\is_int(\array_keys($schema['additionalItems'])[0])) {
            return $this->validateAdditionalItemsSchemaArray($subject, $schema);
        }
        return $this->validateAdditionalItemsSchemaObject($subject, $schema);
    }
859259
public boolean isMultiSchema() {
    Set<String> schemas = CollectUtils.newHashSet();
    for (TableNamePattern pattern : patterns) {
      schemas.add((null == pattern.getSchema()) ? "" : pattern.getSchema());
    }
    return schemas.size() > 1;
  }
1169205
def contains(self, index: Union[SchemaKey, int, str]) -> bool:
        

        LOGGER.debug('SchemaCache.contains >>> index: %s', index)

        rv = None
        if isinstance(index, SchemaKey):
            rv = (index in self._schema_key2schema)
        elif isinstance(index, int) or (isinstance(index, str) and ':2:' not in index):
            rv = (int(index) in self._seq_no2schema_key)
        elif isinstance(index, str):
            rv = (schema_key(index) in self._schema_key2schema)
        else:
            rv = False

        LOGGER.debug('SchemaCache.contains <<< %s', rv)
        return rv
1076247
def setCurrentSchema( self, schema ):
        
        if ( not schema in self._schemas ):
            return False
        
        index = self._schemas.index(schema)
        self.setCurrentIndex(index)
        return True
369095
def IsRegistryStatEntry(self, original_result):
    """"""
    return (original_result.pathspec.pathtype ==
            rdf_paths.PathSpec.PathType.REGISTRY)
680081
def register(self, obj, force=False):
        
        if isinstance(obj, orb.Database):
            scope = self.__databases
            key = obj.code()
        elif isinstance(obj, orb.Schema):
            scope = self.__schemas
            key = obj.name()
        else:
            raise orb.errors.OrbError('Unknown object to register: {0}'.format(obj))

        try:
            existing = self.__schemas[obj.name()]
        except KeyError:
            pass
        else:
            if existing != obj and not force:
                raise orb.errors.DuplicateEntryFound('{0} is already a registered {1}.'.format(key, typ))

        scope[key] = obj
        return True
993073
private static void register(Schema schema) {
    Class clz = schema.getClass();
    synchronized(clz) {
      String clzname = clz.getSimpleName();

      // Was there a race to get here?  If so, return.
      Class<? extends Schema> existing = schemas.get(clzname);
      if (existing != null) {
        if (clz != existing)
          throw H2O.fail("Two schema classes have the same simpleName: " + clz + " and " + existing + ".");
        return;
      }

      // Check that the Schema has the correct type parameters:
      if (clz.getGenericSuperclass() instanceof ParameterizedType) {
        Type[] schema_type_parms = ((ParameterizedType) (clz.getGenericSuperclass())).getActualTypeArguments();
        if (schema_type_parms.length < 2)
          throw H2O.fail("Found a Schema that does not pass at least two type parameters.  Each Schema needs to be " +
              "parametrized on the backing class (if any, or Iced if not) and itself: " + clz);

        Class parm0 = ReflectionUtils.findActualClassParameter(clz, 0);
        Class parm1 = ReflectionUtils.findActualClassParameter(clz, 1);
        String clzstr = clzname + "<" + parm0.getSimpleName() + "," + parm1.getSimpleName() + ">";
        if (!Iced.class.isAssignableFrom(parm0))
          throw H2O.fail("Schema " + clzstr + " has bad type parameters: first arg should be a subclass of Iced");
        if (Schema.class.isAssignableFrom(parm0))
          throw H2O.fail("Schema " + clzstr + " has bad type parameters: first arg cannot be a Schema");
        if (!Schema.class.isAssignableFrom(parm1))
          throw H2O.fail("Schema " + clzstr + " has bad type parameters: second arg should be a subclass of Schema");
        if (!parm1.getSimpleName().equals(clzname))
          throw H2O.fail("Schema " + clzstr + " has bad type parameters: second arg should refer to the schema itself");

      } else {
        throw H2O.fail("Found a Schema that does not have a parametrized superclass.  Each Schema needs to be " +
            "parameterized on the backing class (if any, or Iced if not) and itself: " + clz);
      }

      // Check the version, and bump the LATEST_VERSION
      // NOTE: we now allow non-versioned schemas, for example base classes like ModelMetricsBaseV3, so that we can
      // fetch the metadata for them.
      int version = Schema.extractVersionFromSchemaName(clzname);
      if (version > HIGHEST_SUPPORTED_VERSION && version != EXPERIMENTAL_VERSION)
        throw H2O.fail("Found a schema with a version higher than the highest supported version; you probably want  " +
            "to bump the highest supported version: " + clz);
      if (version > LATEST_VERSION && version != EXPERIMENTAL_VERSION)
        synchronized (Schema.class) {
          if (version > LATEST_VERSION) LATEST_VERSION = version;
        }

      Class<? extends Iced> impl_class = ReflectionUtils.findActualClassParameter(clz, 0);
      Log.debug(String.format("Registering schema: %-40s  (v = %2d, impled by %s)",
                              clz.getCanonicalName(), version, impl_class.getCanonicalName()));
      schemas.put(clzname, clz);
      schema_to_iced.put(clzname, impl_class);

      // Check that it is possible to create a schema object
      try {
        // Validate the fields:
        SchemaMetadata meta = new SchemaMetadata(schema);
        for (SchemaMetadata.FieldMetadata field_meta : meta.fields) {
          String name = field_meta.name;

          // TODO: make a new @API field "ignore_naming_rules", and set to true for the names hardcoded below:
          //       After that these all checks could be eliminated...
          if (name.equals("__meta") || name.equals("__http_status") || name.equals("_exclude_fields") ||
              name.equals("__schema") || name.equals("_fields")) continue;
          if (name.equals("Gini")) continue; // proper name
          if (name.equals("pr_auc")) continue;
          if (name.endsWith("AUC")) continue; // trainAUC, validAUC

          // TODO: remove after we move these into a TwoDimTable:
          if ("f0point5".equals(name) || "f0point5_for_criteria".equals(name) || "f1_for_criteria".equals(name) ||
              "f2_for_criteria".equals(name)) continue;

          if (name.startsWith("_"))
            Log.warn("Found schema field which violates the naming convention; name starts with underscore: " +
                     meta.name + "." + name);
          // allow AUC but not residualDeviance
          // Note: class Word2VecParametersV3 is left as an exception, since it's already a published schema, and it
          // is not possible to alter its field names. However no other exceptions should be created!
          if (!name.equals(name.toLowerCase()) && !name.equals(name.toUpperCase()))
            if (!clzname.equals("Word2VecParametersV3"))
              Log.warn("Found schema field which violates the naming convention; name has mixed lowercase and " +
                       "uppercase characters: " + meta.name + "." + name);
        }
      } catch (Exception e) {
        throw H2O.fail("Failed to instantiate schema class " + clzname + " because: " + e);
      }

      if (impl_class != Iced.class) {
        Pair<String, Integer> versioned = new Pair<>(impl_class.getSimpleName(), version);
        // Check for conflicts
        // The check is invalid: there could be multiple schemas mapping to the same Iced object with the same version.
        // This is why all calls that depend on this mapping should ideally be eliminated (they cannot by
        // type-checked anyways, so they greatly increase bugginness of the code...)
//        if (iced_to_schema.containsKey(versioned))
//          throw H2O.fail("Found two schemas mapping to the same Iced class with the same version: " +
//              iced_to_schema.get(versioned) + " and " + clz + " both map to " +
//              "version: " + version + " of Iced class: " + impl_class);
        iced_to_schema.put(versioned, clz);
      }
    }
  }
302872
synchronized static public void registerAllSchemasIfNecessary(Schema ... schemas) {
    if (schemas_registered) return;
    long startTime = System.currentTimeMillis();
    for (Schema schema : schemas) {
      register(schema);
    }
        
    Log.info("Registered: " + schemas().size() + " schemas in " + (System.currentTimeMillis() - startTime) + "ms");
    schemas_registered = true;
  }
54458
public boolean schemaEquals(Object obj) {
		return equals(obj) && Arrays.equals(fieldNames, ((RowTypeInfo) obj).fieldNames);
	}
707273
def match_head(subject, pattern):
    """"""
    if isinstance(pattern, Pattern):
        pattern = pattern.expression
    pattern_head = get_head(pattern)
    if pattern_head is None:
        return True
    if issubclass(pattern_head, OneIdentityOperation):
        return True
    subject_head = get_head(subject)
    assert subject_head is not None
    return issubclass(subject_head, pattern_head)
1087109
def does_schema_exist(self, connection):
        

        if '.' in self.table:
            query = ("select 1 as schema_exists "
                     "from pg_namespace "
                     "where nspname = lower(%s) limit 1")
        else:
            return True

        cursor = connection.cursor()
        try:
            schema = self.table.split('.')[0]
            cursor.execute(query, [schema])
            result = cursor.fetchone()
            return bool(result)
        finally:
            cursor.close()
458073
public function validate($subject): bool
    {
        if (\is_bool($this->schema['uniqueItems']) && ($this->schema['uniqueItems'] === true)) {
            if (\count($subject) !== \count(\array_unique($subject))) {
                return false;
            }
        }
        return true;
    }
1313333
public static boolean isKeySchemaValid(Schema keySchema, Schema topicSchema) {
    return SchemaCompatibility.checkReaderWriterCompatibility(keySchema, topicSchema).getType()
        .equals(SchemaCompatibilityType.COMPATIBLE);
  }
455518
public function validate($subject): bool
    {
        if (\is_int($this->schema['minProperties']) && $this->schema['minProperties'] >= 0) {
            if (\count($subject) < $this->schema['minProperties']) {
                return false;
            }
        }
        return true;
    }