function bootStrappedDefinedMeanings( $dc ) { global $definedMeaningMeaningName, $definitionMeaningName, $relationMeaningName, $synTransMeaningName, $annotationMeaningName, $wgCommandLineMode; $wgCommandLineMode = true; $dbr = wfGetDB( DB_MASTER ); $dbr->query( "DROP TABLE IF EXISTS `{$dc}_bootstrapped_defined_meanings`;" ); $dbr->query( "CREATE TABLE `{$dc}_bootstrapped_defined_meanings` ( `name` VARCHAR(255) NOT NULL , `defined_meaning_id` INT NOT NULL);" ); $userId = getUserId( 'Root' ); if ( $userId == - 1 ) { echo "root user undefined\n"; return; } setUser( $userId ); setDefaultDC( $dc ); $rdc = wdGetDataSetContext(); startNewTransaction( $userId, 0, "Script bootstrap class attribute meanings", $dc ); $languageId = 85; $collectionId = bootstrapCollection( "Class attribute levels", $languageId, "LEVL" ); $meanings = array(); $meanings[$definedMeaningMeaningName] = bootstrapDefinedMeaning( $definedMeaningMeaningName, $languageId, "The combination of an expression and definition in one language defining a concept." ); $meanings[$definitionMeaningName] = bootstrapDefinedMeaning( $definitionMeaningName, $languageId, "A paraphrase describing a concept." ); $meanings[$synTransMeaningName] = bootstrapDefinedMeaning( $synTransMeaningName, $languageId, "A translation or a synonym that is equal or near equal to the concept defined by the defined meaning." ); $meanings[$relationMeaningName] = bootstrapDefinedMeaning( $relationMeaningName, $languageId, "The association of two defined meanings through a specific relation type." ); $meanings[$annotationMeaningName] = bootstrapDefinedMeaning( $annotationMeaningName, $languageId, "Characteristic information of a concept." ); foreach ( $meanings as $internalName => $meaningId ) { addDefinedMeaningToCollection( $meaningId, $collectionId, $internalName ); $dbr->query( "INSERT INTO `{$dc}_bootstrapped_defined_meanings` (name, defined_meaning_id) " . "VALUES (" . $dbr->addQuotes( $internalName ) . ", " . $meaningId . ")" ); } $timestamp = wfTimestampNow(); $dbr->query( "INSERT INTO {$dc}_script_log (time, script_name, comment) " . "VALUES (" . $timestamp . "," . $dbr->addQuotes( '23 - Bootstrap class attribute meanings.php' ) . "," . $dbr->addQuotes( 'create bootstrap class attribute meanings' ) . ")" ); }
$result = $dbr->query( "select user_id from user where user_name = '$userName'" ); if ( $row = $dbr->fetchObject( $result ) ) { return $row->user_id; } else { return - 1; } } $userId = getUserId( 'Root' ); if ( $userId == - 1 ) { echo "root user undefined\n"; die; } setUser( $userId ); $datasets = getDatasets(); $dbr = wfGetDB( DB_SLAVE ); foreach ( $datasets as $dataset ) { foreach ( $datasets as $otherdataset ) { if ( $dataset != $otherdataset ) { echo "mapping between $otherdataset and $dataset\n"; setDefaultDC( $otherdataset ); startNewTransaction( $userId, wfGetIP(), 'Add collection ', $dataset ); bootstrapCollection( $dataset, '85', 'MAPP' ); } } } ?>
} $wdDefaultViewDataSet = $dc; } $beginTime = time(); $wgCommandLineMode = true; $dc = "uw"; $arg = reset( $argv ); if ( $arg !== false ) { $dc = next( $argv ); } echo "dc = $dc\n"; setDefaultDC( $dc ); $dbr = wfGetDB( DB_MASTER ); $timestamp = wfTimestampNow(); $dbr->query( "DROP TABLE `{$dc}_bootstrapped_defined_meanings`;" ); $dbr->query( "CREATE TABLE `{$dc}_bootstrapped_defined_meanings` ( `name` VARCHAR(255) NOT NULL , `defined_meaning_id` INT NOT NULL);" ); $userId = getUserId( 'Root' ); if ( $userId == - 1 ) { echo "root user undefined\n"; die;