for resolving import statements in Schema instance
           schema -- schema instance
           _imported_schemas
968659
def addImportSchema(self, schema):
        
        if not isinstance(schema, XMLSchema):
            raise TypeError, 'expecting a Schema instance'
        if schema.targetNamespace != self.targetNamespace:
            self._imported_schemas[schema.targetNamespace] = schema
        else:
            raise SchemaError, 'import schema bad targetNamespace'
368529
def _resolve(self, path, migration_file):
        
        name = "_".join(migration_file.split("_")[4:])
        migration_file = os.path.join(path, "%s.py" % migration_file)

        # Loading parent module
        parent = os.path.join(path, "__init__.py")
        if not os.path.exists(parent):
            with open(parent, "w"):
                pass

        load_module("migrations", parent)

        # Loading module
        mod = load_module("migrations.%s" % name, migration_file)

        klass = getattr(mod, inflection.camelize(name))

        instance = klass()
        instance.set_connection(self.get_repository().get_connection())

        return instance
305649
public static void addImport( Instance instance, String componentOrFacetName, Import imp ) {

		Collection<Import> imports = instance.getImports().get( componentOrFacetName );
		if(imports == null) {
			imports = new LinkedHashSet<Import> ();
			instance.getImports().put( componentOrFacetName, imports );
		}

		if( ! imports.contains( imp ))
			imports.add( imp );
	}
1055551
def resolve(self) -> SchemaDefinition:
        

        if not isinstance(self.schema.slots, dict):
            raise ValueError(f"File: {self.schema.source_file} Slots are not a dictionary")

        if not isinstance(self.schema.classes, dict):
            raise ValueError(f"File: {self.schema.source_file} Classes are not a dictionary")

        # Process imports
        for sname in self.schema.imports:
            if sname not in self.loaded:
                self.loaded.add(sname)
                merge_schemas(self.schema, load_raw_schema(sname + '.yaml', base_dir=self.base_dir))

        # slot.domain --> class.slots
        for slot in self.schema.slots.values():
            if slot.domain in self.schema.classes and slot.name not in self.schema.classes[slot.domain].slots:
                self.schema.classes[slot.domain].slots.append(slot.name)

        # class.slots --> slot.domain
        for cls in self.schema.classes.values():
            if not isinstance(cls, ClassDefinition):
                raise ValueError(
                    f'File: {self.schema.source_file} Class "{cls} (type: {type(cls)})" definition is peculiar')
            if isinstance(cls.slots, str):
                print(f"File: {self.schema.source_file} Class: {cls.name} Slots are not an array", file=sys.stderr)
                cls.slots = [cls.slots]
            for slotname in cls.slots:
                if slotname in self.schema.slots:
                    if self.schema.slots[slotname].domain is None:
                        self.schema.slots[slotname].domain = cls.name

        # apply to --> mixins
        for cls in self.schema.classes.values():
            if cls.apply_to in self.schema.classes:
                self.schema.classes[cls.apply_to].mixins.append(cls.name)

        # Override class slots with slot usage definitions
        for cls in self.schema.classes.values():
            for slot_name, slot_usage in cls.slot_usage.items():
                # Construct a new slot
                # Follow the ancestry of the class to get the most proximal parent
                parent_slot = self.slot_definition_for(slot_name, cls)
                if not parent_slot and slot_name in self.schema.slots:
                    parent_slot = self.schema.slots[slot_name]
                # If parent slot is still not defined, it means that we introduced a NEW slot in the slot usages
                child_name = SlotDefinitionName(cls.name + ' ' + slot_name) if parent_slot else slot_name
                new_slot = SlotDefinition(name=child_name, alias=slot_name, domain=cls.name)
                merge_slots(new_slot, slot_usage)

                # Copy the parent definition.  If there is no parent definition, the slot is being defined
                # locally as a slot_usage
                if parent_slot is not None:
                    new_slot.is_a = parent_slot.name
                    merge_slots(new_slot, parent_slot)

                # Add the slot usage overrides
                merge_slots(new_slot, slot_usage)
                self.schema.slots[child_name] = new_slot

                # Add or replace the slot in the class definition
                append = True
                for i, s in enumerate(cls.slots):
                    if s == slot_name:
                        cls.slots[i] = SlotDefinitionName(child_name)
                        append = False
                        break
                if append:
                    cls.slots.append(SlotDefinitionName(child_name))

        # Update slots with parental information
        merged_slots: List[SlotDefinition] = []
        for slot in self.schema.slots.values():
            self.merge_slot(slot, merged_slots)

        # Clean up the slot range defaults
        for slot in self.schema.slots.values():
            if not slot.range:
                slot.range = 'string'

        return self.schema
699488
def resolve_path(schema, fragment):
    
    fragment = fragment.lstrip('/')
    parts = unquote(fragment).split('/') if fragment else []
    for part in parts:
        part = part.replace('~1', '/').replace('~0', '~')
        if isinstance(schema, list):
            schema = schema[int(part)]
        elif part in schema:
            schema = schema[part]
        else:
            raise JsonSchemaException('Unresolvable ref: {}'.format(part))
    return schema
1223768
def resolving(self, ref: str):
        
        new_uri = urlparse.urljoin(self.resolution_scope, ref)
        uri, fragment = urlparse.urldefrag(new_uri)

        if normalize(uri) in self.store:
            schema = self.store[normalize(uri)]
        elif not uri or uri == self.base_uri:
            schema = self.schema
        else:
            schema = resolve_remote(uri, self.handlers)
            if self.cache:
                self.store[normalize(uri)] = schema

        old_base_uri, old_schema = self.base_uri, self.schema
        self.base_uri, self.schema = uri, schema
        try:
            with self.in_scope(uri):
                yield resolve_path(schema, fragment)
        finally:
            self.base_uri, self.schema = old_base_uri, old_schema
918851
def schema_handler(self, schema):
        '''
        
        '''
        dict_for_render = schema.get('properties', dict()).items()
        if schema.get('$ref', None):
            def_name = schema.get('$ref').split('/')[-1]
            dict_for_render = self.definitions[def_name].get('properties', dict()).items()
        elif schema.get('properties', None) is None:
            return ''

        answer_dict = dict()
        json_dict = dict()
        for opt_name, opt_value in dict_for_render:
            var_type = opt_value.get('format', None) or opt_value.get('type', None) or 'object'
            json_name = self.indent + ':jsonparameter {} {}:'.format(var_type, opt_name)
            json_dict[json_name] = self.get_json_props_for_response(var_type, opt_value)

            answer_dict[opt_name] = self.get_response_example(opt_name, var_type, opt_value)
            if var_type == 'string':
                answer_dict[opt_name] = answer_dict[opt_name].format(opt_name)

        self.write('')
        for line in json.dumps(answer_dict, indent=4).split('\n'):
            self.write(line, self.indent_depth)

        self.write('')
        for json_param_name, json_param_value in json_dict.items():
            desc = '{}{}'.format(
                json_param_value['title'], json_param_value['props_str']
            ) or 'None'
            self.write(json_param_name + ' ' + desc)
55247
private static function fixupForeignDefinitionsFromStore( $schemas )
	{
		$context = XBRL_Global::getInstance();

		foreach ( $schemas as $namespace => $data )
		{
			if ( ! isset( $data['foreignDefinitionRoleRefs'] ) || ! $data['foreignDefinitionRoleRefs'] ) continue;

			$schemaTaxonomy = $context->getTaxonomyForXSD( $data['schemaLocation'] );
			foreach( $data['foreignDefinitionRoleRefs'] as $definitionRoleRefKey => $definitionRoleRef )
			{
				$home_taxonomy = $context->getTaxonomyForXSD( $definitionRoleRef['href'] );
				if ( ! $home_taxonomy )
				{
					$ex = new \Exception("Unable to locate taxonomy instance for '{$definitionRoleRef['href']}'");
					// error_log($ex->getTraceAsString());
					throw $ex;
				}
				$roleRef =& $home_taxonomy->getDefinitionRoleRef( $definitionRoleRef['roleUri'] );
				$roleRef = $schemaTaxonomy->mergeExtendedRoles( $roleRef, $definitionRoleRef, $mergedRoles, false );
				$context->setPrimaryItemsCache( null );
			}
		}
	}
733274
static void loadSchemas(MessageStore msgStore, long[] schemaIds) throws MessageRestoreFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "loadSchemas");
    try {
      // Get the SchemaStore reference, creating a new one if necessary
      SchemaStoreItemStream schemaStore = getSchemaStore(msgStore);

      // Check for any unknown schemas
      for (int i = 0; i < schemaIds.length; i++) {
        if (JMFRegistry.instance.retrieve(schemaIds[i]) == null) {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Restoring schema:" + schemaIds[i]);
          JMFRegistry.instance.register(schemaStore.findSchema(schemaIds[i]));
        }
      }
    } catch (MessageStoreException e) {
      FFDCFilter.processException(e, "loadSchemas", "105");
      throw new MessageRestoreFailedException(e);
    } catch (JMFException e) {
      FFDCFilter.processException(e, "loadSchemas", "108");
      throw new MessageRestoreFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "loadSchemas");
  }
809496
public ImportDescr importStatement(PackageDescrBuilder pkg) throws RecognitionException {
        try {
            String kwd;
            if (helper.validateLT(2, kwd = DroolsSoftKeywords.ACC) ||
                    helper.validateLT(2, kwd = DroolsSoftKeywords.ACCUMULATE)) {
                AccumulateImportDescrBuilder imp = helper.start(pkg,
                        AccumulateImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // import accumulate
                    match(input,
                            DRL6Lexer.ID,
                            kwd,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;
                    
                    // function name
                    Token id = match(input,
                            DRL6Lexer.ID,
                            null,
                            null,
                            DroolsEditorType.IDENTIFIER);
                    if (state.failed)
                        return null;
                    if (state.backtracking == 0) {
                        imp.target(target).functionName(id.getText());
                    }

                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(AccumulateImportDescrBuilder.class,
                            imp);
                }
            } else {
                ImportDescrBuilder imp = helper.start(pkg,
                        ImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    if (helper.validateIdentifierKey(kwd = DroolsSoftKeywords.FUNCTION) ||
                            helper.validateIdentifierKey(kwd = DroolsSoftKeywords.STATIC)) {
                        // function
                        match(input,
                                DRL6Lexer.ID,
                                kwd,
                                null,
                                DroolsEditorType.KEYWORD);
                        if (state.failed)
                            return null;
                    }

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;

                    if (input.LA(1) == DRL6Lexer.DOT && input.LA(2) == DRL6Lexer.STAR) {
                        // .*
                        match(input,
                                DRL6Lexer.DOT,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        match(input,
                                DRL6Lexer.STAR,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        target += ".*";
                    }
                    if (state.backtracking == 0)
                        imp.target(target);
                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(ImportDescrBuilder.class,
                            imp);
                }
            }

        } catch (RecognitionException re) {
            reportError(re);
        }
        return null;
    }
271118
def _locate_schemas(self, schemas, skip_missing_schemas):
        
        for schema in schemas:
            if schema == os.path.abspath(schema):
                schema_file = schema
            else:
                schema_file = os.path.join(self.paths.schemas, schema)

            if os.path.isfile(schema_file):
                # Absolute path: use it.
                yield schema_file
            elif skip_missing_schemas:
                logger.warning("Unable to locate schema %s at %s", schema, schema_file)
            else:
                raise PathError("Unable to locate schema %s at %s" % (schema, schema_file))
994808
def compile_schema(self, schema):
        
        compiler = self.get_schema_compiler(schema)

        if compiler is None:
            raise SchemaError(_(u'Unsupported schema data type {!r}').format(type(schema).__name__))

        return compiler(schema)
863725
def _compile_schema(self, schema):
        
        assert self.matcher == schema.matcher

        self.name = schema.name
        self.compiled_type = schema.compiled_type

        return schema.compiled
479225
private Collection<Import> resolveImport(Path path) throws IOException, URISyntaxException {
		URL resource = resolveResource(path);

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

		// calculate a webapp absolute URI
		final URI uri = new URI(
			Paths.get("/").resolve(
				Paths.get(getServletContext().getResource("/").toURI()).relativize(Paths.get(resource.toURI()))
			).toString()
		);
		final String source = IOUtils.toString(resource, StandardCharsets.UTF_8);

		final Import scssImport = new Import(uri, uri, source);
		return Collections.singleton(scssImport);
	}
1053326
function resolveExtensions(schema) {

                var xprops, props;

                xprops = getExtendedProperties(schema, []);

                //unwind the property stack so that the earliest gets inheritance link
                schema.properties = schema.properties || {};
                function copyprop(item) { //util to get around jslint complaints about doing this directly in loop
                    schema.properties[item.key] = item.val;
                }

                while (xprops.length > 0) {
                    props = xprops.pop();
                    props.forEach(copyprop);
                }
            }
232240
def _resolve_definitions(self, schema, definitions):
        
        if not definitions:
            return schema

        if not isinstance(schema, dict):
            return schema

        ref = schema.pop('$ref', None)
        if ref:
            path = ref.split('/')[2:]
            definition = definitions
            for component in path:
                definition = definitions[component]

            if definition:
                # Only update specified fields
                for (key, val) in six.iteritems(definition):
                    if key not in schema:
                        schema[key] = val

        for key in six.iterkeys(schema):
            schema[key] = self._resolve_definitions(schema[key], definitions)

        return schema
479579
def db_import(ctx, schema, uuid, object_filter, import_format, filename, all_schemata, dry):
    """"""

    import_format = import_format.upper()

    with open(filename, 'r') as f:
        json_data = f.read()
    data = json.loads(json_data)  # , parse_float=True, parse_int=True)

    if schema is None:
        if all_schemata is False:
            log('No schema given. Read the help', lvl=warn)
            return
        else:
            schemata = data.keys()
    else:
        schemata = [schema]

    from hfos import database
    database.initialize(ctx.obj['dbhost'], ctx.obj['dbname'])

    all_items = {}
    total = 0

    for schema_item in schemata:
        model = database.objectmodels[schema_item]

        objects = data[schema_item]
        if uuid:
            for item in objects:
                if item['uuid'] == uuid:
                    items = [model(item)]
        else:
            items = []
            for item in objects:
                thing = model(item)
                items.append(thing)

        schema_total = len(items)
        total += schema_total

        if dry:
            log('Would import', schema_total, 'items of', schema_item)
        all_items[schema_item] = items

    if dry:
        log('Would import', total, 'objects.')
    else:
        log('Importing', total, 'objects.')
        for schema_name, item_list in all_items.items():
            log('Importing', len(item_list), 'objects of type', schema_name)
            for item in item_list:
                item._fields['_id'] = bson.objectid.ObjectId(item._fields['_id'])
                item.save()