Returns true if the given schema contains any references
420432
function checkSchemaHasReferences(schema) {
  if (schema.$ref) {
    return true;
  }

  return Object.values(schema).some((value) => {
    if (_.isArray(value)) {
      return value.some(checkSchemaHasReferences);
    } else if (_.isObject(value)) {
      return checkSchemaHasReferences(value);
    }

    return false;
  });
}
1325005
def has_elem(elem_ref):
    
    if not is_elem_ref(elem_ref):
        return False
    elif elem_ref[0] == ElemRefObj:
        return hasattr(elem_ref[1], elem_ref[2])
    elif elem_ref[0] == ElemRefArr:
        return elem_ref[2] in elem_ref[1]
1230664
function includeSchema(mReferencedScope) {
			var oElement,
				sKey;

			if (!(sSchema in mReferencedScope)) {
				fnLog(WARNING, sUrl, " does not contain ", sSchema);
				return;
			}

			fnLog(DEBUG, "Including ", sSchema, " from ", sUrl);
			for (sKey in mReferencedScope) {
				// $EntityContainer can be ignored; $Reference, $Version is handled above
				if (sKey[0] !== "$" && schema(sKey) === sSchema) {
					oElement = mReferencedScope[sKey];
					mScope[sKey] = oElement;
					mergeAnnotations(oElement, mScope.$Annotations);
				}
			}
		}
1052066
function getdbrefs (schema, options) {
  options = options || {}
  
  schema.method('getdbrefs', function (fn) {
    var refs = {}
      , self = this
    
    schema.eachPath(function (name, path) {
      var caster = path.caster
        , opt = path.options
      
      if (caster && caster.options && caster.options.ref) {
        refs[caster.options.ref] = self[name]
      } else if (opt && opt.ref) {
        refs[opt.ref] = self[name]
      }
    })
    fn && fn(refs)
    return refs
  })
}
657907
static boolean isNameReferenced(Node node, String name, Predicate<Node> traverseChildrenPred) {
    return has(node, new MatchNameNode(name), traverseChildrenPred);
  }
657654
function findReferences(schema) {
  if (schema.$ref) {
    return [schema.$ref];
  }

  let references = [];

  if (schema.allOf) {
    references = references.concat(...schema.allOf.map(findReferences));
  }

  if (schema.anyOf) {
    references = references.concat(...schema.anyOf.map(findReferences));
  }

  if (schema.oneOf) {
    references = references.concat(...schema.oneOf.map(findReferences));
  }

  if (schema.not) {
    references = references.concat(...findReferences(schema.not));
  }

  // Array

  if (schema.items) {
    if (Array.isArray(schema.items)) {
      references = references.concat(...schema.items.map(findReferences));
    } else {
      references = references.concat(findReferences(schema.items));
    }
  }

  if (schema.additionalItems && typeof schema.additionalItems === 'object') {
    references = references.concat(findReferences(schema.additionalItems));
  }

  // Object

  if (schema.properties) {
    Object.keys(schema.properties).forEach((key) => {
      references = references.concat(findReferences(schema.properties[key]));
    });
  }

  if (schema.patternProperties) {
    Object.keys(schema.patternProperties).forEach((key) => {
      references = references.concat(findReferences(schema.patternProperties[key]));
    });
  }

  if (schema.additionalProperties && typeof schema.additionalProperties === 'object') {
    references = references.concat(findReferences(schema.additionalProperties));
  }

  return references;
}
1312400
public static boolean isReference(KeyValue kv) {
        if (Bytes.equals(kv.getFamily(), REF_COLUMN_FAMILY)) {
            return true;
        }
        return false;
    }
270239
private boolean scopeIncludesImplicitOrAttributeTypes(GraqlCompute query) {
        if (query.in().isEmpty()) return false;
        return query.in().stream().anyMatch(t -> {
            Label label = Label.of(t);
            SchemaConcept type = tx.getSchemaConcept(label);
            return (type != null && (type.isAttributeType() || type.isImplicit()));
        });
    }
401961
def has_index(self, columns):
        """"""
        if not self.exists:
            return False
        columns = set([normalize_column_name(c) for c in columns])
        if columns in self._indexes:
            return True
        for column in columns:
            if not self.has_column(column):
                return False
        indexes = self.db.inspect.get_indexes(self.name, schema=self.db.schema)
        for index in indexes:
            if columns == set(index.get('column_names', [])):
                self._indexes.append(columns)
                return True
        return False
24566
public boolean hasSchemaUpdateOrGrantRights(String schemaName) {

        // If a DBA
        if (isAdmin()) {
            return true;
        }

        Grantee schemaOwner =
            granteeManager.database.schemaManager.toSchemaOwner(schemaName);

        // If owner of Schema
        if (schemaOwner == this) {
            return true;
        }

        // If a member of Schema authorization role
        if (hasRole(schemaOwner)) {
            return true;
        }

        return false;
    }
325299
public boolean equalsOnlyNames(NodeSchema otherSchema) {
        if (otherSchema == null) {
            return false;
        }

        if (otherSchema.size() != size()) {
            return false;
        }

        for (int colIndex = 0; colIndex < size(); colIndex++ ) {
            SchemaColumn col1 = otherSchema.getColumn(colIndex);
            SchemaColumn col2 = m_columns.get(colIndex);
            if (col1.compareNames(col2) != 0) {
                return false;
            }
        }

        return true;
    }
485491
def _is_reference(bpe):
    """"""
    if isinstance(bpe, _bp('ProteinReference')) or \
        isinstance(bpe, _bpimpl('ProteinReference')) or \
        isinstance(bpe, _bp('SmallMoleculeReference')) or \
        isinstance(bpe, _bpimpl('SmallMoleculeReference')) or \
        isinstance(bpe, _bp('RnaReference')) or \
        isinstance(bpe, _bpimpl('RnaReference')) or \
        isinstance(bpe, _bp('EntityReference')) or \
        isinstance(bpe, _bpimpl('EntityReference')):
        return True
    else:
        return False
336255
def __setIncludes(self, schema):
        
        for schemaLocation, val in schema.includes.items(): 
            if self._includes.has_key(schemaLocation):
                schema.addIncludeSchema(schemaLocation, self._imports[schemaLocation])
412530
private boolean isRelational(EntityMetadata m)
    {
        // if related via join table OR contains relations.
        return m.isRelationViaJoinTable() || (m.getRelationNames() != null && (!m.getRelationNames().isEmpty()));
    }
1179371
function schemaRequiresTrueValue(schema) {
  // Check if const is a truthy value
  if (schema.const) {
    return true;
  }

  // Check if an enum has a single value of true
  if (schema.enum && schema.enum.length === 1 && schema.enum[0] === true) {
    return true;
  }

  // If anyOf has a single value, evaluate the subschema
  if (schema.anyOf && schema.anyOf.length === 1) {
    return schemaRequiresTrueValue(schema.anyOf[0]);
  }

  // If oneOf has a single value, evaluate the subschema
  if (schema.oneOf && schema.oneOf.length === 1) {
    return schemaRequiresTrueValue(schema.oneOf[0]);
  }

  // Evaluate each subschema in allOf, to see if one of them requires a true
  // value
  if (schema.allOf) {
    return schema.allOf.some(schemaRequiresTrueValue);
  }
}
1218789
def contains(self, em):
        '''
            
        '''
        for rootNode in self.getRootNodes():
            if rootNode.contains(em):
                return True

        return False
1215288
public function checkDbTableExists() {
		$ds = $this->getDataSource();
		$existsTables = $ds->listSources();
		if (empty($existsTables)) {
			return false;
		}

		$schemaList = [];
		$schemaCheckingList = [''];
		$schemaCheckingListCfg = $this->_modelConfigInstaller->getListSchemaChecking();
		if (!empty($schemaCheckingList)) {
			$schemaCheckingList = array_merge($schemaCheckingList, $schemaCheckingListCfg);
		}
		foreach ($schemaCheckingList as $schemaCheckingListItem) {
			$name = null;
			$path = null;
			$file = null;
			$connection = null;
			$plugin = null;

			if (preg_match('/[\s\b]?\-\-name\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				list($plugin, $name) = pluginSplit($matches[1]);
			} elseif (preg_match('/^(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$name = $matches[1];
			}

			if (preg_match('/[\s\b]?(?:\-p|\-\-plugin)\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$plugin = $matches[1];
			}

			if (preg_match('/[\s\b]?(?:\-c|\-\-connection)\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$connection = $matches[1];
			}

			if (preg_match('/[\s\b]?\-\-path\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$path = $matches[1];
			}

			if (preg_match('/[\s\b]?\-\-file\s+(\w+)/', $schemaCheckingListItem, $matches) && (count($matches) == 2)) {
				$file = $matches[1];
			}

			if (!empty($name)) {
				$file = Inflector::underscore($name);
			} elseif (empty($file)) {
				$file = 'schema.php';
			}

			if (strpos($file, '.php') === false) {
				$file .= '.php';
			}

			if (!empty($plugin) && empty($name)) {
				$name = $plugin;
			}

			$name = Inflector::camelize($name);
			$schemaList[] = compact('name', 'path', 'file', 'connection', 'plugin');
		}

		$existsTables = array_flip($existsTables);
		foreach ($schemaList as $schemaListItem) {
			$Schema = new CakeSchema($schemaListItem);
			$oldSchema = $Schema->load();
			if (!$oldSchema) {
				return false;
			}

			$diffTables = array_diff_key($oldSchema->tables, $existsTables);
			if (!empty($diffTables)) {
				return false;
			}
			unset($Schema);
		}

		return true;
	}