@param string|object $schema
@param string        $uri
@param callable      $resolver

@return object
773003
private function crawl($schema, $uri, callable $resolver)
    {
        list($schema, $uri) = $this->prepareArguments($schema, $uri);

        foreach (schema_extract($schema, 'League\JsonReference\is_ref') as $pointer => $ref) {
            $scope = $this->scopeResolver->resolve($schema, $pointer, $uri);

            $schema = $resolver($schema, $pointer, $ref, $scope);
        }

        return $schema;
    }
673331
protected function createSchemaRequest($method, $schema)
    {
        $path    = $this->buildPath('schema', $schema);
        $httpReq = $this->client->createRequest($method, $path);

        return $httpReq;
    }
355643
private function registerSchema(stdClass $schema, Uri $uri)
    {
        if (!isset($this->schemas[$uri->getPrimaryResourceIdentifier()])) {
            $this->schemas[$uri->getPrimaryResourceIdentifier()] = $schema;
        }
    }
26003
public static function ResolveUri( $relative, $baseUri )
	{
		if ( $relative instanceof Undefined )
		{
			return Undefined::getValue();
		}

		$rel = CoreFuncs::NormalizeSpace( $relative . "" );

		if ( ExtFuncs::isAbsoluteUrl( $rel ) )
		{
			return $rel;
		}

		if ( ! ExtFuncs::validateUri( $rel ) )
		{
			throw XPath2Exception::withErrorCodeAndParam( "FORG0002", Resources::FORG0002, $rel );
		}

		if ( $baseUri instanceof Undefined )
		{
			return Undefined::getValue();
		}

		$bsUri = CoreFuncs::NormalizeSpace( $baseUri . "" );

		if ( ! ExtFuncs::isAbsoluteUrl( $bsUri ) || ! ExtFuncs::validateUri( $bsUri ) )
		{
			throw XPath2Exception::withErrorCodeAndParam( "FORG0002", Resources::FORG0002, $rel );
		}

		if ( $bsUri == "" )
		{
			return new AnyUriValue( $rel );
		}

		try
		{
			$url = ExtFuncs::InternetCombineUrl( $bsUri, $rel );
			if ( ! ExtFuncs::validateUri( $url ) )
			// if ( ! filter_var( $url, FILTER_VALIDATE_URL ) )
			{
				throw XPath2Exception::withErrorCode( "FORG0009", Resources::FORG0009 );
			}
			return new AnyUriValue( $url );
		}
		catch ( UriFormatException $ex )
		{
		    throw XPath2Exception::withErrorCode( "FORG0009", Resources::FORG0009 );
		}
	}
831322
def resolve_remote(self, uri):
        """"""
        try:
            return super(LocalRefResolver, self).resolve_remote(uri)
        except ValueError:
            return super(LocalRefResolver, self).resolve_remote(
                'file://' + get_schema_path(uri.rsplit('.json', 1)[0])
            )
709252
private function prepareArguments($schema, $uri)
    {
        if (is_string($schema)) {
            $uri    = $schema;
            $schema = resolve_fragment($uri, $this->loadExternalRef($uri));
            $uri    = strip_fragment($uri);
        }

        return [$schema, $uri];
    }
989002
@Override
    public Schema fetch(URI targetUri, URI srcOrigUri, URI srcId) {
        Schema res = null;

        URI schemaUri = convertUri(resolveUri(targetUri, srcOrigUri, srcId));
        if(!schemaUri.isAbsolute()) throw new RuntimeException("Json Schema Fetcher works only with absolute URIs");
        try {
            String fragment = schemaUri.getFragment();
            JsonObject schemaJson = JsonElement.readFrom(new InputStreamReader(schemaUri.toURL().openStream())).asJsonObject();
            if(fragment!=null && !fragment.trim().isEmpty()) {
                String[] pointers = fragment.split("/");
                for (String pointer : pointers) {
                    if (pointer != null && !pointer.trim().isEmpty()) {
                        schemaJson = schemaJson.getJsonObject(pointer);

                    }
                }
            }

            String version = schemaJson.optString("$schema","");
            if(version.equals(Schema.VER_4)) {
                res = new SchemaV4().setSchemaFetcher(this).setOrigSrc(schemaUri).wrap(schemaJson);
            } else {
                res = new SchemaV4().setSchemaFetcher(this).setOrigSrc(schemaUri).wrap(schemaJson);
            }

        } catch (IOException e) {
            e.printStackTrace();
        } catch (JsonException e) {
            e.printStackTrace();
        }
        return res;
    }
238337
public function set($id, callable $resolver)
    {
        $this->innerSet($id, $resolver);
        unset($this->resolved[$id]);
        unset($this->singletons[$id]);
        return $this;
    }
1147496
private function getCreateQueryFromSchema(GetSchema\Schema $schema)
    {
        $definition = $schema->getTableDefinition($this->fromExpr);
        $defSchema = $definition->getSchema();
        $parser = new PHPSQLParser(false, false, [Options::CONSISTENT_SUB_TREES => true]);
        $query = new CreateQuery(new Query($defSchema, $parser->parse($defSchema)));

        return $query->getObjectExpression();
    }
579204
function (schema, refResolver) {

                logger.debug("Creating reader for schema", schema);

                if (!refResolver) {
                    refResolver = new AmdResolver({path: "", altSeparator: "\\.", synchronous: true}).resolver;
                }

                this.smd = schema;

                //finds all $ref instances and replaces with the actual object
                //similar to dojox.json.ref.resolveJson, but doesn't get hung up on circular references
                //TODO: should we assume all schemas have been resolved prior, and remove this step?
                function resolveRef(subobj, parent, parentKey) {
                    if (!subobj.resolved) {
                        Object.keys(subobj).forEach(function (key) {
                            var Ref, value = subobj[key];
                            if (key === "$ref") {
                                logger.debug("Resolving $ref: " + value);
                                Ref = refResolver(value);
                                value = typeof Ref === 'function' ? new Ref() : Ref;
                                if (!util.isUndefined(value) && !value.resolved) {
                                    subobj.resolved = true;
                                    resolveRef(value, subobj, key);
                                }
                                parent[parentKey] = value;
                            } else if (typeof value === "object") {
                                resolveRef(value, subobj, key);
                            }
                        });
                    }
                }

                function getExtendedProperties(obj, props) {
                    var parent = (obj && obj["extends"]), propsObj = [], items = [], itemProps;

                    if (typeof parent !== "undefined") {

                        items = util.isArray(parent) ? parent : [parent]; //can be multiple-inheritance

                        items.forEach(function (item) {
                            itemProps = item.properties || {};
                            Object.keys(itemProps).forEach(function (key) {
                                var value = item.properties[key];
                                if (key !== "__parent") {
                                    propsObj.push({
                                        parentId: item.id,
                                        key: key,
                                        value: value
                                    });
                                }
                            });

                        }, this); // jshint ignore:line

                        props.push(propsObj);
                        props = getExtendedProperties(parent, props);
                    }

                    return props;

                }

                //looks in JSONSchema objects for "extends" and copies properties to children
            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);
                }
            }

            // mix-in parameters for extended schemas
            function resolveExtendedParameters(obj) {

                // assume all references are resolved, just copy parameters down the
                // inheritence chain. If I am derived check base first.
                if (obj["extends"]) {
                    resolveExtendedParameters(obj["extends"]);
                    obj.parameters = obj.parameters || [];
                    obj.parameters = obj.parameters.concat(obj["extends"].parameters);
                }
            }

            //copies properties from parent as defaults, as well as extensions for params
            function resolveProperties(schema) {

                logger.debug("Resolving sub-properties for " + schema.id);

                // resolve inherited global parameters
                resolveExtendedParameters(schema);

                Object.keys(schema.services || {}).forEach(function (key) {
                    var value = schema.services[key];
                    //value.target = value.target ? schema.target + value.target : schema.target; //TODO: should this build concat paths? that is currently handled in getServiceUrl function
                    value.returns = value.returns || schema.returns;
                    value.transport = value.transport || schema.transport;
                    value.contentType = value.contentType || schema.contentType;
                    value.envelope = value.envelope || schema.envelope || "URL";
                    value.description = value.description || "";

                    if (value.returns) {
                        resolveExtensions(value.returns);
                    }

                    if (value.parameters) {
                        value.parameters.forEach(function (item) {
                            item.envelope = item.envelope || value.envelope;
                            item.description = item.description || "";
                        });
                    }


                    var ext = value["extends"];

                    if (ext) {

                        //resolution hasn't been completed or extends object isn't proper JSONSchema
                        if (!ext.id) {
                            throw new Error("Parent schema for method [" + key + "] in schema " + schema.id + " is invalid.");
                        }

                        //TODO: resolveExtensions for params object properties? not really needed yet (the name is fine for now...)
                        if (!value.parameters) {
                            value.parameters = ext.parameters;
                        } else {
                            value.parameters = value.parameters.concat(ext.parameters);
                        }
                    }
                });

                if (!schema.tag) {
                    schema.tag = {};
                }
                schema.tag.resolved = true;
                schema.resolvedProperties = true;
            }

            //if a schema has already been resolved, don't do it again - we can get into endless recursion
            if (!schema.resolved) {
                resolveRef(schema, null, null);
                schema.resolved = true;
            }

            //only resolve these once, or else our concats will be a problem
            if (!schema.resolvedProperties) {
                resolveProperties(schema);
            }

            var hash = {};

            //index params array by name for lookup
            hash.parameters = {};
            this.getMethodNames().forEach(function (methodName) {
                var service = this.smd.services[methodName];
                if (service.parameters) {
                    service.parameters.forEach(function (parameter) {
                        hash[methodName + "-" + parameter.name] = parameter;
                    });
                }
            }, this);

            this.findParameter = function (methodName, parameterName) {
                return hash[methodName + "-" + parameterName];
            };

        }
1021067
def resolver(self):
        """"""
        if self._resolver is not None:
            return self._resolver
        if self._schema_path is not None:
            # the documentation for ref resolving
            # https://github.com/Julian/jsonschema/issues/98
            # https://python-jsonschema.readthedocs.org/en/latest/references/
            self._resolver = SchemaRefResolver(
                'file://' + self._schema_path + '/', self.schema)
        else:
            self._resolver = SchemaRefResolver.from_schema(self.schema)
        return self._resolver
972653
public function setSchema($schema)
    {
        $schema = func_get_args();
        
        $schema = "'".implode("','", $schema)."'";
        
        $query = $this->getUtilityQuery()->setSchema($schema);
        $this->query($query);
        
        return $this;
    }
1130632
public static void setURIResolver(URIResolver resolver) {
        if (uriResolver != resolver) {
            uriResolver = resolver;
            transformerFactory = null;
            getTransformerFactory();
        }
    }
367934
public static function execute(Schema $schema, $request, $root = NULL, $variables = NULL, $operation = NULL)
    {
        try {
            $source = new Source($request ?: '', 'GraphQL request');
            $parser = new Parser();

            $ast = $parser->parse($source);
            return Executor::execute($schema, $root, $ast, $operation, $variables);
        } catch (\Exception $exception) {
            return ['errors' => $exception->getMessage()];
        }
    }
1259313
public static function ResolveUriFromContext( $context, $relative )
	{
		if ( $relative instanceof Undefined )
		    return Undefined::getValue();

		$rel = $relative . "";
		if ( is_null( $context->RunningContext->BaseUri ) )
		    throw XPath2Exception::withErrorCode( "FONS0005", Resources::FONS0005 );
		try
		{
		    return new AnyUriValue( SchemaTypes::resolve_path( $context->RunningContext->getBaseUri(), $rel ) );
		}
		catch ( UriFormatException $ex )
		{
		    throw XPath2Exception::withErrorCode( "FORG0009", Resources::FORG0009 );
		}
	}
55862
public function singleton($id, callable $resolver)
    {
        $this->innerSet($id, $resolver);
        unset($this->resolved[$id]);
        $this->singletons[$id] = true;
        return $this;
    }
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