コード例 #1
0
        public async Task <IActionResult> GetResources([FromQuery] QueryStringParameters queryStringParametersDto)
        {
            Parameters parameters =
                _parametersProcessorService.ProcessParameters(Request.RouteValues, Request.QueryString);
            string?query = _sparqlFactoryService.GetFinalQuery(
                _endpointService.GetEntryResourceQuery(parameters.RouteParameters.Endpoint,
                                                       parameters.RouteParameters.Graph), parameters);

            if (query != null)
            {
                var sparqlResults =
                    await _endpointService.ExecuteSelectSparqlQueryAsync(parameters.RouteParameters.Endpoint,
                                                                         parameters.RouteParameters.Graph, query);

                if (sparqlResults != null)
                {
                    CurieVm curiesVm = _resultFormatterService.FormatSparqlResultToCurieList(sparqlResults);
                    return(Ok(curiesVm));
                }
            }

            return(NotFound(new CustomErrorVm()
            {
                CustomErrorMessage =
                    $"No results were found! Check endpoint configuration at {UrlHelperClass.GetEndpointUrl(Request.GetEncodedUrl())}.",
                GeneratedQuery = query
            }));
        }