Exemplo n.º 1
0
        public void UNIONClause()
        {
            var expectedQuery = "{<http://dbpedia.org/resource/Paris> <http://www.w3.org/2000/01/rdf-schema#label> ?label} UNION {<http://dbpedia.org/resource/Montreal> <http://www.w3.org/2000/01/rdf-schema#label> ?label}";

            var subject   = new UriNode("http://dbpedia.org/resource/Paris");
            var predicate = new UriNode("http://www.w3.org/2000/01/rdf-schema#label");
            var obj       = new VariableNode("label");
            var triple    = new Triple(subject, predicate, obj);
            var triples   = new List <Triple> {
                triple
            };

            subject = new UriNode("http://dbpedia.org/resource/Montreal");
            triple  = new Triple(subject, predicate, obj);
            triples.Add(triple);
            var unionClause = new dotNetSPARQL.Query.UnionClause(triples);

            Assert.AreEqual(expectedQuery, unionClause.ToString());
        }