Add support to load YAML files.

        This will attempt to load a YAML file first, and then go back to the
        default behavior.

        :param str uri: the URI to resolve
        :returns: the retrieved document
344977
def resolve_remote(self, uri):
        
        if uri.startswith('file://'):
            try:
                path = uri[7:]
                with open(path, 'r') as schema_file:
                    result = yaml.load(schema_file)
                if self.cache_remote:
                    self.store[uri] = result
                return result
            except yaml.parser.ParserError as e:
                logging.debug('Error parsing {!r} as YAML: {}'.format(
                    uri, e))
        return super(SchemaRefResolver, self).resolve_remote(uri)
468143
def load_uri(self, uri, verbose):
        

        if verbose: printDebug("----------")
        if verbose: printDebug("Reading: <%s>" % uri)
        success = False
        for f in self.rdf_format_opts:
            if verbose: printDebug(".. trying rdf serialization: <%s>" % f)
            try:
                self.rdfgraph.parse(uri, format=f)
                if verbose: printDebug("..... success!", bold=True)
                success = True
                self.sources_valid += [uri]
                break
            except:
                if verbose: printDebug("..... failed")

        if not success == True:
            self.loading_failed(self.rdf_format_opts)
            self.sources_invalid += [uri]
636318
private OWLOntology loadOntologyFromURI(URI uri) throws OWLIOException
    {
        try
        {
            return owlOntologyManager.loadOntologyFromOntologyDocument(IRI.create(uri));
        } catch (OWLOntologyCreationException ex)
        {
            throw new OWLIOException(ioErrorMsg, ex);
        }
    }
1042728
def get(self, request, uri):
        
        uri = self.decode_uri(uri)
        revisions = cio.revisions(uri)
        revisions = [list(revision) for revision in revisions]  # Convert tuples to lists
        return self.render_to_json(revisions)
928044
def resolveURI(self, URI):
        
        ret = libxml2mod.xmlACatalogResolveURI(self._o, URI)
        return ret
854829
def load_from_file(swag_path, swag_type='yml', root_path=None):
    
    if swag_type not in ('yaml', 'yml'):
        raise AttributeError("Currently only yaml or yml supported")
        # TODO: support JSON

    try:
        enc = detect_by_bom(swag_path)
        with codecs.open(swag_path, encoding=enc) as yaml_file:
            return yaml_file.read()
    except IOError:
        # not in the same dir, add dirname
        swag_path = os.path.join(
            root_path or os.path.dirname(__file__), swag_path
        )
        try:
            enc = detect_by_bom(swag_path)
            with codecs.open(swag_path, encoding=enc) as yaml_file:
                return yaml_file.read()
        except IOError:  # pragma: no cover
            # if package dir
            # see https://github.com/rochacbruno/flasgger/pull/104
            # Still not able to reproduce this case
            # test are in examples/package_example
            # need more detail on how to reproduce IOError here
            swag_path = swag_path.replace("/", os.sep).replace("\\", os.sep)
            path = swag_path.replace(
                (root_path or os.path.dirname(__file__)), ''
            ).split(os.sep)[1:]
            site_package = imp.find_module(path[0])[1]
            swag_path = os.path.join(site_package, os.sep.join(path[1:]))
            with open(swag_path) as yaml_file:
                return yaml_file.read()
1247183
def loadYAML (filename=None, data=None):
    
    config = None

    try:
        if filename:
            data = open(filename, 'rt')

        config = yaml.load(data)

        if type(data) is file:
            data.close()
    except IOError, e:
        msg = 'Could not read AIT configuration file "%s": %s'
        log.error(msg, filename, str(e))

    return config
414752
def get(self, request, uri):
        
        uri = self.decode_uri(uri)
        node = cio.get(uri, lazy=False)

        if node.content is None:
            raise Http404

        return self.render_to_json({
            'uri': node.uri,
            'content': node.content
        })
1070069
def URI(url) # rubocop:disable Naming/MethodName
      if url.respond_to?(:host)
        url
      elsif url.respond_to?(:to_str)
        default_uri_parser.call(url)
      else
        raise ArgumentError, 'bad argument (expected URI object or URI string)'
      end
    end
116082
def load_dir(src_dir)
      merged_content = ""

      Pathname.glob("#{src_dir}/*.yml").sort.each do |yaml_path|
        content = yaml_path.read.gsub(/^---$/, "")
        merged_content << content
      end

      YAML.load(merged_content)
    end
776932
def yaml_load(path, input="", err_quit=False):
    
    try:
        if len(input) > 0:
            return yaml.safe_load(input)
        elif len(path) > 0:
            return yaml.safe_load(file_to_string(path))
    except Exception as err:
        file = os.path.basename(path)
        ui.error("",
                 c.MESSAGES["yaml_error"].replace("%file", file), err,
                 "")

        if err_quit:
            sys.exit(1)

        return False
1127839
def load_yaml(path)
      yml = YAML.load_file(path)
      raise ConfigurationError, "The YAML file at #{path} failed to load" unless yml

      apply_configuration(yml)
    end
1303625
def load_yaml(data=None, path=None, name='NT'):
    
    if data and not path:
        return mapper(yaml.load(data), _nt_name=name)
    if path and not data:
        with open(path, 'r') as f:
            data = yaml.load(f)
        return mapper(data, _nt_name=name)
    if data and path:
        raise ValueError('expected one source and received two')
937404
def load_files(self, path):
        

        if self.verbose == 2:
            print("Indexing {}".format(path))

        for filename in os.listdir(path):

            file_path = path + "/" + filename

            if os.path.isdir(file_path):
                self.load_files(file_path)
            elif filename.endswith(".yaml") or filename.endswith(".yml"):
                self.unfold_yaml(file_path)
419175
def loadFromURL(self, url):
        """"""
        if isfile(url) is True:
            file = open(url, 'r')
        else:
            file = urlopen(url)

        try:     
            result = self.loadDocument(file)
        except Exception, ex:
            file.close()
            raise ParseError(('Failed to load document %s' %url,) + ex.args)
        else:
            file.close()
        return result
536446
def _load_yaml_config(self):
        
        try:
            config = self._read_config()
        except OSError as error:
            raise ValueError('Could not read configuration file: %s' % error)
        try:
            return yaml.safe_load(config)
        except yaml.YAMLError as error:
            message = '\n'.join(['    > %s' % line
                                 for line in str(error).split('\n')])
            sys.stderr.write('\n\n  Error in the configuration file:\n\n'
                             '{}\n\n'.format(message))
            sys.stderr.write('  Configuration should be a valid YAML file.\n')
            sys.stderr.write('  YAML format validation available at '
                             'http://yamllint.com\n')
            raise ValueError(error)
1025496
def parse_uri(self, uri=None):

		'''
		
		'''

		# no uri provided, assume root
		if not uri:
			return rdflib.term.URIRef(self.root)

		# string uri provided
		elif type(uri) == str:

			# assume "short" uri, expand with repo root
			if type(uri) == str and not uri.startswith('http'):
				return rdflib.term.URIRef("%s%s" % (self.root, uri))

			# else, assume full uri
			else:
				return rdflib.term.URIRef(uri)

		# already rdflib.term.URIRef
		elif type(uri) == rdflib.term.URIRef:
			return uri

		# unknown input
		else:
			raise TypeError('invalid URI input')