Exemple #1
0
        /// <summary>
        /// Valida un rdf
        /// </summary>
        /// <param name="rdf">Rdf a validar</param>
        /// <param name="repositoryIdentifier">Repositorio en el que están configurados los shapes para validar</param>
        public void CallDataValidate(IFormFile rdf, Guid repositoryIdentifier)
        {
            string           response    = _serviceApi.CallPostApi(_serviceUrl.GetUrl(), $"etl/data-validate?repositoryIdentifier={ repositoryIdentifier.ToString()} ", rdf, _token, true);
            ShapeReportModel shapeReport = JsonConvert.DeserializeObject <ShapeReportModel>(response);

            if (!shapeReport.conforms && shapeReport.severity == "http://www.w3.org/ns/shacl#Violation")
            {
                throw new ValidationException(shapeReport);
            }
        }
        public void CreatePage(Guid pageId, string route, IFormFile pageHtml)
        {
            string method = $"page/load?route={route}";

            if (!Guid.Empty.Equals(pageId))
            {
                method += $"&pageId={pageId}";
            }
            if (pageHtml != null)
            {
                _serviceApi.CallPostApi(_serviceUrl.GetUrlDocumentacion(), method, pageHtml, _token, true, "html_page");
            }
            else
            {
                _serviceApi.CallPostApi(_serviceUrl.GetUrlDocumentacion(), method, pageHtml, _token);
            }
        }
        public RepositoryConfigViewModel CreateRepositoryConfigView(RepositoryConfigViewModel newRepositoryConfigView)
        {
            Guid   guidAdded;
            string result = _serviceApi.CallPostApi(_urlRepositoryConfigApi, newRepositoryConfigView);

            result = JsonConvert.DeserializeObject <string>(result);
            Guid.TryParse(result, out guidAdded);
            result = _serviceApi.CallGetApi($"{_urlRepositoryConfigApi}/{guidAdded}");
            RepositoryConfigViewModel resultObject = JsonConvert.DeserializeObject <RepositoryConfigViewModel>(result);

            return(resultObject);
        }
Exemple #4
0
        public ShapeConfigViewModel CreateShapeConfig(ShapeConfigCreateModel newRepositoryConfigView)
        {
            Guid   guidAdded;
            string parameters = $"?name={newRepositoryConfigView.Name}&repositoryID={newRepositoryConfigView.RepositoryID}";

            string result = _serviceApi.CallPostApi($"{_urlShapeConfigApi}{parameters}", newRepositoryConfigView.ShapeFile, true);

            result = JsonConvert.DeserializeObject <string>(result);
            Guid.TryParse(result, out guidAdded);
            result = _serviceApi.CallGetApi($"{_urlShapeConfigApi}/{guidAdded}");
            ShapeConfigViewModel resultObject = JsonConvert.DeserializeObject <ShapeConfigViewModel>(result);

            return(resultObject);
        }
        /// <summary>
        /// obtiene el formato en csv de la consulta sparql obtenida de la directiva
        /// </summary>
        /// <param name="htmlContent">contenido html</param>
        /// <param name="ocurrence">Posición de la cual hay que mirar</param>
        /// <returns>Resultado de la llamada en formato csv</returns>
        private string Sparql(string htmlContent, int ocurrence)
        {
            int first = htmlContent.IndexOf(DirectivesList.Sparql, ocurrence);

            first = first + DirectivesList.Sparql.Length;
            int    last   = htmlContent.IndexOf(DirectivesList.EndDirective, first);
            string queryS = $"{htmlContent.Substring(first, last - first)}";

            queryS = queryS.Replace("{URL_GRAPH}", _configUrlService.GetGraph());
            string consulta = HttpUtility.UrlEncode(queryS);

            consulta = $"query={consulta}&format=text/csv";
            string result = _callService.CallPostApi(_configUrlService.GetSaprqlEndpoint(), "", consulta, sparql: true);

            return(result);
        }
        /// <summary>
        /// obtiene el formato en csv de la consulta sparql obtenida de la directiva
        /// </summary>
        /// <param name="htmlContent">contenido html</param>
        /// <param name="ocurrence">Posición de la cual hay que mirar</param>
        /// <returns>Resultado de la llamada en formato csv</returns>
        private string Sparql(string htmlContent, int ocurrence)
        {
            int first = htmlContent.IndexOf(DirectivesList.Sparql, ocurrence);

            first = first + DirectivesList.Sparql.Length;
            int    last   = htmlContent.IndexOf(DirectivesList.EndDirective, first);
            string queryS = $"{htmlContent.Substring(first, last - first)}";

            string url      = $"{_configUrlService.GetSaprqlEndpoint()}?{_configUrlService.GetSparqlQuery()}={queryS}&format=text/csv";
            string consulta = HttpUtility.UrlEncode(queryS);

            consulta = $"query={consulta}&format=text/csv";
            //string result = _callService.CallGetApi(url, "");
            string result = _callService.CallPostApi(_configUrlService.GetSaprqlEndpoint(), "", consulta, sparql: true);

            return(result);
        }
Exemple #7
0
 /// <summary>
 /// Reemplaza el esquema de uris por uno nuevo
 /// </summary>
 /// <param name="newFile">Fichero  nuevo de configuración de uris</param>
 public void ReplaceSchema(IFormFile newFile)
 {
     string result = _serviceApi.CallPostApi(_serviceUrl.GetUrlUrisFactory(), $"{_urlSchema}", newFile, _token, true, "newSchemaConfig");
 }