/** * @since 2.2 * * @return QueryEngine */ public function newMasterQueryEngine() { $hierarchyTempTableBuilder = new HierarchyTempTableBuilder($this->store->getConnection('mw.db'), $this->newTemporaryIdTableCreator()); $hierarchyTempTableBuilder->setPropertyHierarchyTableDefinition($this->store->findPropertyTableID(new DIProperty('_SUBP')), $GLOBALS['smwgQSubpropertyDepth']); $hierarchyTempTableBuilder->setClassHierarchyTableDefinition($this->store->findPropertyTableID(new DIProperty('_SUBC')), $GLOBALS['smwgQSubcategoryDepth']); $querySegmentListProcessor = new QuerySegmentListProcessor($this->store->getConnection('mw.db'), $this->newTemporaryIdTableCreator(), $hierarchyTempTableBuilder); return new QueryEngine($this->store, new QuerySegmentListBuilder($this->store), $querySegmentListProcessor, new EngineOptions()); }
/** * @since 2.4 * * @return QuerySegmentListProcessor */ public function newQuerySegmentListProcessor() { $connection = $this->store->getConnection('mw.db.queryengine'); $temporaryTableBuilder = $this->newTemporaryTableBuilder(); $hierarchyTempTableBuilder = new HierarchyTempTableBuilder($connection, $temporaryTableBuilder); $hierarchyTempTableBuilder->setPropertyHierarchyTableDefinition($this->store->findPropertyTableID(new DIProperty('_SUBP')), $this->applicationFactory->getSettings()->get('smwgQSubpropertyDepth')); $hierarchyTempTableBuilder->setClassHierarchyTableDefinition($this->store->findPropertyTableID(new DIProperty('_SUBC')), $this->applicationFactory->getSettings()->get('smwgQSubcategoryDepth')); $querySegmentListProcessor = new QuerySegmentListProcessor($connection, $temporaryTableBuilder, $hierarchyTempTableBuilder); return $querySegmentListProcessor; }
public function testCreateHierarchyTempTable() { $this->connection->expects($this->once())->method('tableName')->with($this->stringContains('bar'))->will($this->returnValue('_bar')); $this->connection->expects($this->atLeastOnce())->method('query'); $instance = new HierarchyTempTableBuilder($this->connection, $this->temporaryIdTableCreator); $instance->setClassHierarchyTableDefinition('bar', 3); $instance->createHierarchyTempTableFor('class', 'foobar', '(42)'); $expected = array('(42)' => 'foobar'); $this->assertEquals($expected, $instance->getHierarchyCache()); $instance->emptyHierarchyCache(); $this->assertEmpty($instance->getHierarchyCache()); }