Exemple #1
0
        public static LinqToSparqlQuery <T> Reduced <T>(this LinqToSparqlQuery <T> q)
        {
            LinqToSparqlQuery <T> temp = q.CloneQueryForNewType <T>();

            if (!temp.Expressions.ContainsKey("Reduced"))
            {
                temp.Expressions.Add("Reduced", null);
            }
            return(temp);
        }
Exemple #2
0
        protected internal LinqToSparqlQuery <S> CloneQueryForNewType <S>()
        {
            var newQuery = new LinqToSparqlQuery <S>(DataContext);

            newQuery.TripleStore          = tripleStore;
            newQuery.OriginalType         = OriginalType;
            newQuery.ProjectionFunction   = ProjectionFunction;
            newQuery.QueryGraphParameters = QueryGraphParameters;
            newQuery.FilterClause         = FilterClause;
            newQuery.Log                  = externalLogger;
            newQuery.QueryFactory         = new QueryFactory <S>(QueryFactory.QueryType, DataContext);
            newQuery.Parser               = QueryFactory.CreateExpressionTranslator();
            newQuery.Parser.StringBuilder = new StringBuilder(parser.StringBuilder.ToString());
            newQuery.Expressions          = expressions;
            return(newQuery);
        }
Exemple #3
0
        private void RegisterResults(LinqToSparqlQuery <T> query, IEnumerable <T> results)
        {
            string queryHashCode = query.GetHashCode().ToString();

            foreach (T t in results)
            {
                var i = t as OwlInstanceSupertype;
                if (i != null)
                {
                    i.DataContext = query.DataContext;
                }
            }

            //discard any old results (not sure whether this will ever get invoked)
            if (query.CachedResults != null)
            {
                query.DataContext.ResultsCache.Remove(queryHashCode);
            }
            query.CachedResults = results;
        }
Exemple #4
0
        public IQueryable <S> CreateQuery <S>(Expression expression)
        {
            Expression exp;

            if (!ExpressionWillCauseInfiniteLoop(expression))
            {
                exp = Evaluator.PartialEval(expression);
            }
            else
            {
                exp = expression;
            }
            LinqToSparqlQuery <S> newQuery = CloneQueryForNewType <S>();

            var call = exp as MethodCallExpression;

            if (call != null)
            {
                newQuery.Expressions[call.Method.Name] = call;
            }
            return(newQuery);
        }
Exemple #5
0
 public LinqToSparqlConnection(LinqToSparqlQuery <T> sparqlQuery)
 {
     this.sparqlQuery = sparqlQuery;
     store            = sparqlQuery.TripleStore;
 }