Exemplo n.º 1
0
 public override org.openrdf.query.TupleQuery prepareTupleQuery(org.openrdf.query.QueryLanguage ql, string str)
 {
     if (!this.SupportsQueryLanguage(ql))
     {
         throw UnsupportedQueryLanguage(ql);
     }
     return(new InMemoryTupleQuery(str, this._store));
 }
Exemplo n.º 2
0
 public override org.openrdf.query.TupleQuery prepareTupleQuery(org.openrdf.query.QueryLanguage ql, string str)
 {
     if (!this.SupportsQueryLanguage(ql))
     {
         throw UnsupportedQueryLanguage(ql);
     }
     if (this._manager is IQueryableGenericIOManager)
     {
         return(new GenericTupleQuery(str, (IQueryableGenericIOManager)this._manager));
     }
     else
     {
         throw new dotSesameRepo.RepositoryException("This dotNetRDF Generic Repository does not support SPARQL Queries");
     }
 }
Exemplo n.º 3
0
        public override org.openrdf.query.Query prepareQuery(org.openrdf.query.QueryLanguage ql, string str)
        {
            if (!this.SupportsQueryLanguage(ql))
            {
                throw UnsupportedQueryLanguage(ql);
            }

            if (!(this._manager is IQueryableGenericIOManager))
            {
                throw new dotSesameRepo.RepositoryException("This dotNetRDF Generic Repository does not support SPARQL Queries");
            }

            try
            {
                SparqlQueryParser parser = new SparqlQueryParser();
                SparqlQuery       q      = parser.ParseFromString(str);

                switch (q.QueryType)
                {
                case SparqlQueryType.Ask:
                    return(new GenericBooleanQuery(str, (IQueryableGenericIOManager)this._manager));

                case SparqlQueryType.Construct:
                case SparqlQueryType.Describe:
                case SparqlQueryType.DescribeAll:
                    return(new GenericGraphQuery(str, (IQueryableGenericIOManager)this._manager));

                case SparqlQueryType.Select:
                case SparqlQueryType.SelectAll:
                case SparqlQueryType.SelectAllDistinct:
                case SparqlQueryType.SelectAllReduced:
                case SparqlQueryType.SelectDistinct:
                case SparqlQueryType.SelectReduced:
                    return(new GenericTupleQuery(str, (IQueryableGenericIOManager)this._manager));

                case SparqlQueryType.Unknown:
                default:
                    throw new dotSesameQuery.MalformedQueryException("Unable to parse the given Query into a valid SPARQL Query as the Query Type is unknown");
                }
            }
            catch (RdfParseException parseEx)
            {
                throw new dotSesameQuery.MalformedQueryException("Unable to parse the given Query into a valid SPARQL Query due to the following error: " + parseEx.Message);
            }
        }