function updateDefinedMeaningInCollection( $definedMeaningId, $collectionId, $internalId ) { removeDefinedMeaningFromCollection( $definedMeaningId, $collectionId ); addDefinedMeaningToCollection( $definedMeaningId, $collectionId, $internalId ); }
function rollBackCollectionMembership( $rollBackAction, $collectionId, $collectionMemberId, $sourceIdentifier, $operation ) { if ( shouldRemove( $rollBackAction, $operation ) ) { removeDefinedMeaningFromCollection( $collectionMemberId, $collectionId ); } elseif ( shouldRestore( $rollBackAction, $operation ) ) { addDefinedMeaningToCollection( $collectionMemberId, $collectionId, $sourceIdentifier ); } }
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' ) . ")" ); }
setUser( $userId ); startNewTransaction( $userId, 0, "Script bootstrap class attribute meanings" ); $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 . ")" ); } $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' ) . ")" ); $endTime = time(); echo "\n\nTime elapsed: " . durationToString( $endTime - $beginTime ); function bootstrapDefinedMeaning( $spelling, $languageId, $definition ) { $expression = findOrCreateExpression( $spelling, $languageId ); $definedMeaningId = createNewDefinedMeaning( $expression->id, $languageId, $definition );
public function addExpressionAsDefinedMeaning( $spelling, $definition, $internalIdentifier, $collectionId ) { $expression = $this->getOrCreateExpression( $spelling ); $definedMeaningId = createNewDefinedMeaning( $expression->id, $this->languageId, $definition ); addDefinedMeaningToCollection( $definedMeaningId, $collectionId, $internalIdentifier ); return $definedMeaningId; }
function importSNTypes( $collectionId, $query, $languageId ) { global $db; $queryResult = mysql_query( $query, $db ); while ( $semanticNetworkType = mysql_fetch_object( $queryResult ) ) { $expressionText = $semanticNetworkType->semtypeab; $expressionText = strtolower( str_replace( "_", " ", $expressionText ) ); $definedMeaningId = getDefinedMeaningFromCollection( $collectionId, $semanticNetworkType->semtypeab ); $expression = findOrCreateExpression( $expressionText, $languageId ); if ( !$definedMeaningId ) { $definedMeaningId = createNewDefinedMeaning( $expression->id, $languageId, $semanticNetworkType->definition ); addDefinedMeaningToCollection( $definedMeaningId, $collectionId, $semanticNetworkType->semtypeab ); } } mysql_free_result( $queryResult ); }