示例#1
0
        public static bool UpdateDifference(GraphDiffReport difference, Logger logger)
        {
            Stopwatch externalTimer     = Stopwatch.StartNew();
            DateTime  externalStartTime = DateTime.UtcNow;
            bool      externalCallOk    = true;

            try
            {
                logger.Verbose("Updating graph");
                using (GraphDBConnector connector = new GraphDBConnector(string.Empty))
                {
                    connector.Timeout = 180 * 1000;
                    Uri uri = null;
                    connector.UpdateGraph(uri, difference);
                }
            }
            catch (Exception e)
            {
                externalCallOk = false;
                logger.Exception(e);
            }
            finally
            {
                externalTimer.Stop();
                logger.Dependency("GraphUpdate", $"+{difference.AddedTriples.Count()}/-{difference.RemovedTriples.Count()}", externalStartTime, externalTimer.Elapsed, externalCallOk);
            }
            return(externalCallOk);
        }
示例#2
0
        private static IGraph executeGraphQuery(string sparql, string infer)
        {
            IGraph result = new Graph();

            using (GraphDBConnector connector = new GraphDBConnector($"infer={infer}"))
            {
                connector.Timeout = 180 * 1000;
                GraphHandler rdfHandler = new GraphHandler(result);
                connector.Query(rdfHandler, null, sparql);
            }
            return(result);
        }
示例#3
0
        private static SparqlResultSet executeSparqlResultQuery(string sparql, string infer)
        {
            SparqlResultSet result = new SparqlResultSet();

            using (GraphDBConnector connector = new GraphDBConnector($"infer={infer}"))
            {
                connector.Timeout = 180 * 1000;
                ResultSetHandler sparqlHandler = new ResultSetHandler(result);
                connector.Query(null, sparqlHandler, sparql);
            }
            return(result);
        }