private function getSQLForLevels( $language = "<ANY>" ) {
		global $classAttributeLevels, $dataSet;

		$o = OmegaWikiAttributes::getInstance();
		// TO DO: Add support for multiple languages here
		return
			selectLatest(
				array( $dataSet->bootstrappedDefinedMeanings->definedMeaningId, $dataSet->expression->spelling ),
				array( $dataSet->definedMeaning, $dataSet->expression, $dataSet->bootstrappedDefinedMeanings ),
				array(
					'name IN (' . implodeFixed( $classAttributeLevels ) . ')',
					equals( $dataSet->definedMeaning->definedMeaningId, $dataSet->bootstrappedDefinedMeanings->definedMeaningId ),
					equals( $dataSet->definedMeaning->expressionId, $dataSet->expression->expressionId )
				)
			);
	}
Exemplo n.º 2
0
	public function __construct( $definedMeaningId ) {
		$dc = wdGetDataSetContext();
		$dbr = wfGetDB( DB_SLAVE );

		global
			$wgDefaultClassMids, $dataSet;

		$queryResult = $dbr->query(
			SelectLatestDistinct(
				array(
					$dataSet->classAttributes->attributeMid,
					$dataSet->classAttributes->attributeType,
					$dataSet->bootstrappedDefinedMeanings->name
				),
				array( $dataSet->classAttributes, $dataSet->bootstrappedDefinedMeanings ),
				array(
					equals( $dataSet->classAttributes->levelMid, $dataSet->bootstrappedDefinedMeanings->definedMeaningId ),
					sqlOr(
						in( $dataSet->classAttributes->classMid,
							selectLatest(
								array( $dataSet->classMemberships->classMid ),
								array( $dataSet->classMemberships ),
								array( equals( $dataSet->classMemberships->classMemberMid, $definedMeaningId ) )
							)
						),
						inArray( $dataSet->classAttributes->classMid, $wgDefaultClassMids )
					)
				)
			)
		);

		$this->classAttributes = array();
		
		while ( $row = $dbr->fetchRow( $queryResult ) ) {
			$classAttribute = new ClassAttribute();
			$classAttribute->attributeId = $row[0];
			$classAttribute->type = $row[1];
			$classAttribute->levelName = $row[2];
			
			$this->classAttributes[] = $classAttribute;
		}
	}