public void SparqlAggregatesOverNullCount3()
        {
            SparqlQuery     q       = this._parser.ParseFromString("SELECT (COUNT(*) AS ?Count) WHERE { ?s ?p ?o } GROUP BY ?s");
            SparqlResultSet results = this._processor.ProcessQuery(q) as SparqlResultSet;

            Assert.NotNull(results);
            Assert.Equal(1, results.Count);

            SparqlResult r = results.First();

            Assert.Equal((0).ToLiteral(this._factory), r["Count"]);
        }
        public void SparqlAggregatesOverNullSum1()
        {
            SparqlQuery     q       = this._parser.ParseFromString("SELECT (SUM(?s) AS ?Sum) WHERE { ?s ?p ?o }");
            SparqlResultSet results = this._processor.ProcessQuery(q) as SparqlResultSet;

            Assert.NotNull(results);
            Assert.Equal(1, results.Count);

            SparqlResult r = results.First();

            Assert.Equal((0).ToLiteral(this._factory), r["Sum"]);
        }
        public void SparqlAggregatesOverNullGroupConcat2()
        {
            SparqlQuery     q       = this._parser.ParseFromString("SELECT (GROUP_CONCAT(?s) AS ?GroupConcat) WHERE { ?s ?p ?o } GROUP BY ?s");
            SparqlResultSet results = this._processor.ProcessQuery(q) as SparqlResultSet;

            Assert.NotNull(results);
            Assert.Equal(1, results.Count);

            SparqlResult r = results.First();

            Assert.Equal(this._factory.CreateLiteralNode(String.Empty), r["GroupConcat"]);
        }
        public void SparqlAggregatesOverNullMin2()
        {
            SparqlQuery     q       = this._parser.ParseFromString("SELECT (MIN(?s) AS ?Min) WHERE { ?s ?p ?o } GROUP BY ?s");
            SparqlResultSet results = this._processor.ProcessQuery(q) as SparqlResultSet;

            Assert.NotNull(results);
            Assert.Equal(1, results.Count);

            SparqlResult r = results.First();

            Assert.Null(r["Min"]);
        }
Ejemplo n.º 5
0
        public void SparqlAggregatesOverNullMax1()
        {
            SparqlQuery     q       = _parser.ParseFromString("SELECT (MAX(?s) AS ?Max) WHERE { ?s ?p ?o }");
            SparqlResultSet results = _processor.ProcessQuery(q) as SparqlResultSet;

            Assert.NotNull(results);
            Assert.Equal(1, results.Count);

            SparqlResult r = results.First();

            Assert.Null(r["Max"]);
        }
Ejemplo n.º 6
0
        public void SparqlAggregatesOverNullAvg1()
        {
            SparqlQuery     q       = _parser.ParseFromString("SELECT (AVG(?s) AS ?Avg) WHERE { ?s ?p ?o }");
            SparqlResultSet results = _processor.ProcessQuery(q) as SparqlResultSet;

            Assert.NotNull(results);
            Assert.Equal(1, results.Count);

            SparqlResult r = results.First();

            Assert.Equal((0).ToLiteral(_factory), r["Avg"]);
        }
        public void FullTextGraphSparqlScoping6()
        {
            LeviathanQueryProcessor processor = new LeviathanQueryProcessor(this._store);

            //Interaction of graph scope with limit
            using (LuceneSearchProvider searcher = new LuceneSearchProvider(LucUtil.Version.LUCENE_30, this._index, new StandardAnalyzer(LucUtil.Version.LUCENE_30)))
            {
                SparqlQuery q = this._parser.ParseFromString(FullTextPrefix + " SELECT * WHERE { GRAPH <http://g2> { ?s pf:textMatch ( 'sample' 5 ) } }");
                q.AlgebraOptimisers = new IAlgebraOptimiser[] { new FullTextOptimiser(searcher) };

                SparqlResultSet results = processor.ProcessQuery(q) as SparqlResultSet;
                Assert.NotNull(results);
                Assert.Equal(2, results.Count);
                Assert.Equal(new Uri("http://y"), ((IUriNode)results.First()["s"]).Uri);
            }
        }