public void SparqlGroupByWithEmptyResultSet()
        {
            //var query = "SELECT ?s  (COUNT(?o) AS ?c) WHERE {?s a ?o} GROUP BY ?s";
            var query  = "SELECT ?s  (COUNT(?o) AS ?c) WHERE {?s a ?o} GROUP BY ?s";
            var m      = new InMemoryManager();
            var result = (SparqlResultSet)m.Query(query);

            Assert.Empty(result.Results);
        }
Esempio n. 2
0
        private static void Test(string query, bool isNamedGraph, int expectedCount)
        {
            IGraph graph = new Graph();

            if (isNamedGraph)
            {
                graph.BaseUri = new Uri("http://g");
            }
            new TurtleParser().Load(graph, new StringReader(TestData));

            IInMemoryQueryableStore store = new TripleStore();

            store.Add(graph);
            IQueryableStorage storage = new InMemoryManager(store);

            using (SparqlResultSet resultSet = (SparqlResultSet)storage.Query(query))
            {
                Assert.Equal(expectedCount, resultSet.Count);
            }
        }
        private static void Test(string query, string literal)

        {
            IGraph graph = new Graph();

            graph.LoadFromString(TestData);

            IInMemoryQueryableStore store = new TripleStore();

            store.Add(graph);
            IQueryableStorage storage = new InMemoryManager(store);

            using (SparqlResultSet resultSet = (SparqlResultSet)storage.Query(query))
            {
                TestTools.ShowResults(resultSet);
                Assert.Equal(1, resultSet.Count);

                SparqlResult result = resultSet[0];
                Assert.True(result.HasBoundValue("oo"));
                Assert.Equal(graph.CreateLiteralNode(literal), result["oo"]);
            }
        }