public function testFormat()
 {
     $queryBuilder = new QueryBuilder();
     $this->assertEquals("SELECT * WHERE {\n}\n", $queryBuilder->format());
 }
 public function testAliasesOfPropertiesWhichAreUsedMoreThanOnce()
 {
     $queryBuilder = new QueryBuilder(self::$prefixes + array('skos' => 'http://www.w3.org/2004/02/skos/core#'));
     $queryBuilder->select('?property', '?alias', '?occurences')->subquery($queryBuilder->newSubquery()->select('?alias', '(COUNT (?alias) AS ?occurences)')->where('?tmp', 'a', 'wikibase:Property')->also('skos:altLabel', '?alias')->filter('LANG (?alias) = "en"')->groupBy('?alias'))->where('?property', 'a', 'wikibase:Property')->also('skos:altLabel', '?alias')->filter('?occurences > 1')->orderBy('?alias');
     $this->assertIsExpected('Aliases_of_properties_which_are_used_more_than_once', $queryBuilder->format());
 }
 public function testUnion()
 {
     $queryBuilder = new QueryBuilder(array('dc10' => 'http://purl.org/dc/elements/1.0/', 'dc11' => 'http://purl.org/dc/elements/1.1/'));
     $queryBuilder->select('?title', '?author')->union($queryBuilder->newSubgraph()->where('?book', 'dc10:title', '?title')->also('dc10:creator', '?author'), $queryBuilder->newSubgraph()->where('?book', 'dc11:title', '?title')->also('dc11:creator', '?author'));
     $this->assertIsExpected('union', $queryBuilder->format());
 }