public StardogQueryResult(StardogStore store, ISparqlQuery query, StardogResultHandler resultHandler)
        {
            _resultHandler = resultHandler;

            string s = null;
            string p = null;
            string o = null;

            if (query.ProvidesStatements())
            {
                // A list of global scope variables without the ?. Used to access the
                // subject, predicate and object variable in statement providing queries.
                string[] vars = query.GetGlobalScopeVariableNames();

                s = vars[0];
                p = vars[1];
                o = vars[2];
            }

            _query = query;

            if (_resultHandler.SparqlResultSet != null)
            {
                _tripleProvider = new SparqlResultSetTripleProvider(_resultHandler.SparqlResultSet, s, p, o);
            }

            _model         = query.Model;
            _resultHandler = resultHandler;
            _store         = store;
        }
Example #2
0
        /// <summary>
        /// Executes a <c>SparqlQuery</c> on the store.
        /// </summary>
        /// <param name="query">SPARQL query string to be executed.</param>
        /// <param name="transaction">An optional transaction.</param>
        /// <returns></returns>
        public StardogResultHandler ExecuteQuery(string query, ITransaction transaction = null)
        {
            Log?.Invoke(query);

            StardogResultHandler resultHandler = new StardogResultHandler();

            _connector.Query(_rdfHandler, resultHandler, query);

            return(resultHandler);
        }
Example #3
0
        /// <summary>
        /// Executes a <c>SparqlQuery</c> on the store.
        /// </summary>
        /// <param name="query">SPARQL query to be executed.</param>
        /// <param name="transaction">An optional transaction.</param>
        /// <returns></returns>
        public override ISparqlQueryResult ExecuteQuery(ISparqlQuery query, ITransaction transaction = null)
        {
            string q = query.ToString();

            Log?.Invoke(q);

            StardogResultHandler resultHandler = new StardogResultHandler();

            _connector.Query(_rdfHandler, resultHandler, q, query.IsInferenceEnabled);

            return(new StardogQueryResult(this, query, resultHandler));
        }