public Response Pull(string projectName, string applicationName, string graphName, Request request) { Status status = new Status(); status.Messages = new Messages(); try { status.Identifier = String.Format("{0}.{1}", projectName, applicationName); InitializeScope(projectName, applicationName); InitializeDataLayer(); DateTime startTime = DateTime.Now; if (!request.ContainsKey("targetEndpointUri")) { throw new Exception("Target Endpoint Uri is required"); } string targetEndpointUri = request["targetEndpointUri"]; if (!request.ContainsKey("targetGraphBaseUri")) { throw new Exception("Target graph uri is required"); } string targetGraphBaseUri = request["targetGraphBaseUri"]; _settings["TargetGraphBaseUri"] = targetGraphBaseUri; SparqlRemoteEndpoint endpoint = new SparqlRemoteEndpoint(new Uri(targetEndpointUri), targetGraphBaseUri); if (request.ContainsKey("targetCredentials")) { string targetCredentialsXML = request["targetCredentials"]; WebCredentials targetCredentials = Utility.Deserialize <WebCredentials>(targetCredentialsXML, true); if (targetCredentials.isEncrypted) { targetCredentials.Decrypt(); } endpoint.SetCredentials( targetCredentials.GetNetworkCredential().UserName, targetCredentials.GetNetworkCredential().Password, targetCredentials.GetNetworkCredential().Domain); } string proxyHost = _settings["ProxyHost"]; string proxyPort = _settings["ProxyPort"]; if (!String.IsNullOrEmpty(proxyHost) && !String.IsNullOrEmpty(proxyPort)) { WebProxy webProxy = new WebProxy(proxyHost, Int32.Parse(proxyPort)); WebProxyCredentials proxyCrendentials = _settings.GetWebProxyCredentials(); if (proxyCrendentials != null) { webProxy.Credentials = _settings.GetProxyCredential(); } endpoint.SetProxyCredentials(proxyCrendentials.userName, proxyCrendentials.password, proxyCrendentials.domain); endpoint.SetProxy(webProxy.Address); } String query = "CONSTRUCT {?s ?p ?o} WHERE {?s ?p ?o}"; VDS.RDF.IGraph graph = endpoint.QueryWithResultGraph(query); System.Text.StringBuilder sb = new System.Text.StringBuilder(); TextWriter textWriter = new StringWriter(sb); VDS.RDF.Writing.RdfXmlWriter rdfWriter = new VDS.RDF.Writing.RdfXmlWriter(); rdfWriter.Save(graph, textWriter); XDocument xDocument = XDocument.Parse(sb.ToString()); // call RdfProjectionEngine to fill data objects from a given graph _projectionEngine = _kernel.Get <IProjectionLayer>("rdf"); _dataObjects = _projectionEngine.ToDataObjects(graphName, ref xDocument); // post data objects to data layer _dataLayer.Post(_dataObjects); DateTime endTime = DateTime.Now; TimeSpan duration = endTime.Subtract(startTime); status.Messages.Add(string.Format("Graph [{0}] has been posted to legacy system successfully.", graphName)); status.Messages.Add(String.Format("Execution time [{0}:{1}.{2}] minutes.", duration.Minutes, duration.Seconds, duration.Milliseconds)); } catch (Exception ex) { _logger.Error("Error in Pull(): ", ex); status.Level = StatusLevel.Error; status.Messages.Add(string.Format("Error pulling graph: {0}", ex)); } _response.Append(status); return(_response); }