public void COUNTClause() { var expectedClause = "(COUNT(?uri) as ?count)"; var countClause = new dotNetSPARQL.Query.CountClause("uri"); Assert.AreEqual(expectedClause, countClause.ToString()); }
public void COUNTQuery() { var expectedQuery = "SELECT (COUNT(?uri) as ?count) WHERE { <http://dbpedia.org/resource/Paris> <http://dbpedia.org/ontology/wikiPageExternalLink> ?uri }"; var subject = new UriNode(new Uri("http://dbpedia.org/resource/Paris")); var predicate = new UriNode(new Uri("http://dbpedia.org/ontology/wikiPageExternalLink")); var obj = new VariableNode("uri"); var triple = new Triple(subject, predicate, obj); var countClause = new dotNetSPARQL.Query.CountClause("uri"); var clauses = new dotNetSPARQL.Query.BaseClause[] { countClause }; var triples = new List <Triple> { triple }; var selectCountQuery = new dotNetSPARQL.Query.Select( triples, clauses, new string[0]); Assert.AreEqual(expectedQuery, selectCountQuery.ToString()); }