function execute( $par ) {

		global $wgOut, $wgUser, $wgRequest;

		$wgOut->setPageTitle( 'Add Collection' );

		if ( !$wgUser->isAllowed( 'addcollection' ) ) {
			$wgOut->addHTML( 'You do not have permission to add a collection.' );
			return false;
		}

		$dbr = wfGetDB( DB_MASTER );

		if ( $wgRequest->getText( 'collection' ) ) {
			require_once( 'WikiDataAPI.php' );
			require_once( 'Transaction.php' );

			$dc = $wgRequest->getText( 'dataset' );
			$collectionName = $wgRequest->getText( 'collection' );
			startNewTransaction( $wgUser->getID(), wfGetIP(), 'Add collection ' . $collectionName );
			bootstrapCollection( $collectionName, $wgRequest->getText( 'language' ), $wgRequest->getText( 'type' ), $dc );
			$wgOut->addHTML( wfMsg( 'ow_collection_added', $collectionName ) . "<br />" );
		}
		$datasets = wdGetDatasets();
		$datasetarray[''] = wfMsgSc( "none_selected" );
		foreach ( $datasets as $datasetid => $dataset ) {
			$datasetarray[$datasetid] = $dataset->fetchName();
		}

		$wgOut->addHTML( getOptionPanel(
			array(
				'Collection name:' => getTextBox( 'collection' ),
				'Language of name:' => getSuggest( 'language', 'language' ),
				'Collection type:' => getSelect( 'type', array( '' => 'None', 'RELT' => 'RELT', 'LEVL' => 'LEVL', 'CLAS' => 'CLAS', 'MAPP' => 'MAPP' ) ),
				'Dataset:' => getSelect( 'dataset', $datasetarray )
			),
			'', array( 'create' => wfMsg( 'ow_create' ) )
		) );
	}
	$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' );
		}
	}
}
?>
예제 #3
0
/** Write the dm to the correct collection for a particular dc */

function writeDmToCollection( $dc, $collid, $uuid, $dm_id, $override_transaction = null ) {
	global
		$wgUser;
	// if(is_null($dc)) {
	//	$dc=wdGetDataSetContext();
	// } 
    	$dbw = & wfGetDB( DB_MASTER );

	$collection_contents = "{$dc}_collection_contents";
	$collid = $dbw->addQuotes( $collid );
	$uuid = $dbw->addQuotes( $uuid );
	$dm_id = $dbw->addQuotes( $dm_id );

	$add_transaction_id = $override_transaction;
	if ( is_null( $add_transaction_id ) ) {
		startNewTransaction( $wgUser->getId(), wfGetIP(), "inserting collection $collid", $dc );
		$add_transaction_id = getUpdateTransactionId();
	}

	$sql = "
		INSERT INTO $collection_contents
		SET 	collection_id=$collid,
			internal_member_id=$uuid,
			member_mid=$dm_id,
			add_transaction_id=$add_transaction_id		
		";
	$result = $dbw->query( $sql );
}
예제 #4
0
	/** start a new copy transaction
	 * Gets a virtual user id from the wikidata_sets table, if available
	 * (else uses user 0)
	 * There's still some issues with transactions  especially wrt with user assignment
	 * where we intersect with the (old) "WikiDataAPI".
	 */
	public static function newCopyTransaction( $dc1, $dc2 ) {

		$datasets = CopyTools::getRow_noDC( "wikidata_sets", "WHERE set_prefix=\"$dc1\"" );
		if (  $datasets == false  ) {
			throw new Exception( "Dataset info for $dc1 not found." );
		}
		
		if (  array_key_exists( "virtual_user_id", $datasets )  ) {
			$virtual_user_id = $datasets["virtual_user_id"];
		} else {
			$virtual_user_id = 0;
		}
	
		# The id might exist, but still be null. 
		if ( is_null( $virtual_user_id ) ) {
			$virtual_user_id = 0;
		}

		startNewTransaction(
			$virtual_user_id,
			"0.0.0.0",
			"copying from $dc1 to $dc2",
			$dc2	);
	}
function rollBackTransactions( $recordSet ) {

	$o = OmegaWikiAttributes::getInstance();
	global
		$wgRequest, $wgUser;
		
	$summary = $wgRequest->getText( 'summary' );
	startNewTransaction( $wgUser->getID(), wfGetIP(), $summary );
		
	$idStack = new IdStack( 'transaction' );
	$transactionKeyStructure = $recordSet->getKey();
	
	for ( $i = 0; $i < $recordSet->getRecordCount(); $i++ ) {
		$transactionRecord = $recordSet->getRecord( $i );

		$transactionId = $transactionRecord->transactionId;
		$idStack->pushKey( simpleRecord( $transactionKeyStructure, array( $transactionId ) ) );

		$updatesInTransaction = $transactionRecord->updatesInTransaction;
		$idStack->pushAttribute( $o->updatesInTransaction );

		$updatedDefinitions = $updatesInTransaction->updatedDefinition;
		$idStack->pushAttribute( $o->updatedDefinition );
		rollBackDefinitions( $idStack, $updatedDefinitions );
		$idStack->popAttribute();

		$updatedRelations = $updatesInTransaction->updatedRelations;
		$idStack->pushAttribute( $o->updatedRelations );
		rollBackRelations( $idStack, $updatedRelations );
		$idStack->popAttribute();
		
		$updatedClassMemberships = $updatesInTransaction->updatedClassMembership;
		$idStack->pushAttribute( $o->updatedClassMembership );
		rollBackClassMemberships( $idStack, $updatedClassMemberships );
		$idStack->popAttribute();
		
		$updatedClassAttributes = $updatesInTransaction->updatedClassAttributes;
		$idStack->pushAttribute( $o->updatedClassAttributes );
		rollBackClassAttributes( $idStack, $updatedClassAttributes );
		$idStack->popAttribute();
		
		$updatedTranslatedTexts = $updatesInTransaction->updatedTranslatedText;
		$idStack->pushAttribute( $o->updatedTranslatedText );
		rollBackTranslatedTexts( $idStack, $updatedTranslatedTexts );
		$idStack->popAttribute();

		$updatedTranslatedTextProperties = $updatesInTransaction->updatedTranslatedTextProperty;
		$idStack->pushAttribute( $o->updatedTranslatedTextProperty );
		rollBackTranslatedTextProperties( $idStack, $updatedTranslatedTextProperties );
		$idStack->popAttribute();

		$o->updatedLinks = $updatesInTransaction->updatedLink;
		$idStack->pushAttribute( $o->updatedLink );
		rollBackLinkAttributes( $idStack, $o->updatedLinks );
		$idStack->popAttribute();

		$o->updatedTexts = $updatesInTransaction->updatedText;
		$idStack->pushAttribute( $o->updatedText );
		rollBackTextAttributes( $idStack, $o->updatedTexts );
		$idStack->popAttribute();

		$updatedSyntranses = $updatesInTransaction->updatedSyntranses;
		$idStack->pushAttribute( $o->updatedSyntranses );
		rollBackSyntranses( $idStack, $updatedSyntranses );
		$idStack->popAttribute();

		$updatedAlternativeDefinitionTexts = $updatesInTransaction->updatedAlternativeDefinitionText;
		$idStack->pushAttribute( $o->updatedAlternativeDefinitionText );
		rollBackAlternativeDefinitionTexts( $idStack, $updatedAlternativeDefinitionTexts );
		$idStack->popAttribute();

		$updatedAlternativeDefinitions = $updatesInTransaction->updatedAlternativeDefinitions;
		$idStack->pushAttribute( $o->updatedAlternativeDefinitions );
		rollBackAlternativeDefinitions( $idStack, $updatedAlternativeDefinitions );
		$idStack->popAttribute();

		$updatedCollectionMemberships = $updatesInTransaction->updatedCollectionMembership;
		$idStack->pushAttribute( $o->updatedCollectionMembership );
		rollBackCollectionMemberships( $idStack, $updatedCollectionMemberships );
		$idStack->popAttribute();

		$idStack->popAttribute();
		$idStack->popKey();
	}
}
$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;
}

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 . ")" );
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' ) . ")" );
	
}
예제 #8
0
	public function saveWithinTransaction() {
		global
			$wgTitle, $wgUser, $wgRequest;

		$summary = $wgRequest->getText( 'summary' );

		// Insert transaction information into the DB
		startNewTransaction( $wgUser->getID(), wfGetIP(), $summary );

		// Perform regular save
		$this->save( new QueryAtTransactionInformation( $wgRequest->getInt( 'transaction' ), false ) );

		// Update page caches
		$wgTitle->invalidateCache();

		// Add change to RC log
		$now = wfTimestampNow();
		RecentChange::notifyEdit( $now, $wgTitle, false, $wgUser, $summary, 0, $now, false, '', 0, 0, 0 );
	}
	function execute( $par ) {

		global $wgOut, $wgUser, $wgRequest;

		$wgOut->setPageTitle( wfMsg( 'ow_importtsv_title1' ) );
		if ( !$wgUser->isAllowed( 'importtsv' ) ) {
			$wgOut->addHTML( wfMsg( 'ow_importtsv_not_allowed' ) );
			return false;
		}
		
		$dbr = wfGetDB( DB_MASTER );
		$dc = wdGetDataSetcontext();
		$wgOut->setPageTitle( wfMsg( 'ow_importtsv_importing' ) );
		setlocale( LC_ALL, 'en_US.UTF-8' );
		if ( $wgRequest->getFileName( 'tsvfile' ) ) {
			
			// *****************
			//    process tsv
			// *****************

			require_once( 'WikiDataAPI.php' );
			require_once( 'Transaction.php' );
			
			$testRun = $wgRequest->getCheck( 'testrun' );
			
			// lets do some tests first. Is this even a tsv file? 
			// It is _very_ important that the file is utf-8 encoded.
			// also, this is a good time to determine the max line length for the 
			// fgetcsv function.
			$file = fopen( $wgRequest->getFileTempname( 'tsvfile' ), 'r' );
			$myLine = "";
			$maxLineLength = 0;
			while ( $myLine = fgets( $file ) ) {
				if ( !preg_match( '/./u', $myLine ) ) {
					$wgOut->setPageTitle( wfMsg( 'ow_importtsv_import_failed' ) );
					$wgOut->addHTML( wfMsg( 'ow_importtsv_not_utf8' ) );
					return false;
				}
				$maxLineLength = max( $maxLineLength, strlen( $myLine ) + 2 );
			}
			
			// start from the beginning again. Check if the column names are valid
			rewind( $file );
			$columns = fgetcsv( $file, $maxLineLength, "\t" );
			// somehow testing for $columns[0] fails sometimes. Byte Order Mark?
			if ( !$columns || count( $columns ) <= 2 || $columns[1] != "defining expression" ) {
				$wgOut->setPageTitle( wfMsg( 'ow_importtsv_import_failed' ) );
				$wgOut->addHTML( wfMsg( 'ow_importtsv_not_tsv' ) );
				return false;
			}
			for ( $i = 2; $i < count( $columns ); $i++ ) {
				$columnName = $columns[$i];
				$baseName = substr( $columnName, 0, strrpos( $columnName, '_' ) );
				if ( $baseName == "definition" || $baseName == "translations" ) {
					$langCode = substr( $columnName, strrpos( $columnName, '_' ) + 1 );
					if ( !getLanguageIdForIso639_3( $langCode ) ) {
						$wgOut->setPageTitle( wfMsg( 'ow_importtsv_import_failed' ) );
						$wgOut->addHTML( wfMsg( 'ow_impexptsv_unknown_lang', $langCode ) );
						return false;
					}
				}
				else { // column name does not start with definition or translations. 
						$wgOut->setPageTitle( wfMsg( 'ow_importtsv_import_failed' ) );
						$wgOut->addHTML( wfMsg( 'ow_importtsv_bad_columns', $columnName ) );
						return false;
				}
				
			}
			
		
			//
			// All tests passed. lets get started
			//

			if ( $testRun ) {
				$wgOut->setPageTitle( wfMsg( 'ow_importtsv_test_run_title' ) );
			}
			else {
				$wgOut->setPageTitle( wfMsg( 'ow_importtsv_importing' ) );
			}
			
			startNewTransaction( $wgUser->getID(), wfGetIP(), "Bulk import via Special:ImportTSV", $dc );	# this string shouldn't be localized because it will be stored in the db

			$row = "";
			$line = 1; // actually 2, 1 was the header, but increased at the start of while
			$definitions = 0; // definitions added
			$translations = 0; // translations added

			while ( $row = fgetcsv( $file, $maxLineLength, "\t" ) ) {
				$line++;
				
				$dmid = $row[0];
				$exp = $row[1];
				
				// find the defined meaning record
				$qry = "SELECT dm.meaning_text_tcid, exp.spelling ";
				$qry .= "FROM {$dc}_defined_meaning dm INNER JOIN {$dc}_expression exp ON dm.expression_id=exp.expression_id ";
				$qry .= "WHERE dm.defined_meaning_id=$dmid ";
				$qry .= "AND " . getLatestTransactionRestriction( 'dm' );
				$qry .= "AND " . getLatestTransactionRestriction( 'exp' );
				
				$dmResult = $dbr->query( $qry );
				$dmRecord = null;
				// perfomr some tests
				if ( $dmRecord = $dbr->fetchRow( $dmResult ) ) {
					if ( $dmRecord['spelling'] != $exp ) {
						$wgOut->addHTML( "Skipped line $line: defined meaning id $dmid does not match defining expression. Should be '{$dmRecord['spelling']}', found '$exp'.<br />" );
						continue;
					}
				}
				else {
					$wgOut->addHTML( "Skipped line $line: unknown defined meaning id $dmid. The id may have been altered in the imported file, or the defined meaning or defining expression was removed from the database.<br />" );
					continue;
				}
				
				
				// all is well. Get the translated content id
				$tcid = $dmRecord['meaning_text_tcid'];
				
				
				for ( $columnIndex = 2; $columnIndex < count( $columns ); $columnIndex++ ) {
					
					// Google docs removes empty columns at the end of a row,
					// so if column index is higher than the length of the row, we can break
					// and move on to the next defined meaning.
					if ( columnIndex >= count( $row ) ) {
						break;
					}
					
					$columnValue = $row[$columnIndex];
					if ( !$columnValue ) {
						continue;
					}
				
					$columnName = $columns[$columnIndex];
					$langCode = substr( $columnName, strrpos( $columnName, '_' ) + 1 );
					$langId = getLanguageIdForIso639_3( $langCode );
					if ( strpos( $columnName, 'definition' ) === 0 ) {
						if ( !translatedTextExists( $tcid, $langId ) ) {
							if ( $testRun ) {
								$wgOut->addHTML( "Would add definition for $exp ($dmid) in $langCode: $columnValue.<br />" );
							} else {
								addTranslatedText( $tcid, $langId, $columnValue );
								$wgOut->addHTML( "Added definition for $exp ($dmid) in $langCode: $columnValue.<br />" );
								$definitions++;
							}
						}
					}
					if ( strpos( $columnName, 'translation' ) === 0 ) {
						$spellings = explode( '|', $columnValue );
						foreach ( $spellings as $spelling ) {
							$spelling = trim( $spelling );
							$expression = findExpression( $spelling, $langId );
							if ( !$expression ) { // expression does not exist
								if ( $testRun ) {
									$wgOut->addHTML( "Would add translation for $exp ($dmid) in $langCode: $spelling. Would also add new page.<br />" );
								}
								else {
									$expression = createExpression( $spelling, $langId );
									$expression->bindToDefinedMeaning( $dmid, 1 );

									// not nescesary to check page exists, createPage does that.
									$title = getPageTitle( $spelling );
									createPage( 16, $title );

									$wgOut->addHTML( "Added translation for $exp ($dmid) in $langCode: $spelling. Also added new page.<br />" );
									$translations++;
								}
							}
							else { // expression exists, but may not be bound to this defined meaning.
								if ( !$expression->isBoundToDefinedMeaning( $dmid ) ) {
									if ( $testRun ) {
										$wgOut->addHTML( "Would add translation for $exp ($dmid) in $langCode: $spelling.<br />" );
									}
									else {
										$expression->bindToDefinedMeaning( $dmid, 1 );
										$wgOut->addHTML( "Added translation for $exp ($dmid) in $langCode: $spelling.<br />" );
										$translations++;
									}
								}
							}
						}
					}
				}
			}
			
			if ( $definitions == 0 && $translations == 0 ) {
				$wgOut->addHTML( "<br />" );
				if ( $testRun ) {
					$wgOut->addHTML( wfMsg( 'ow_importtsv_nothing_added_test' ) );
				}
				else {
					$wgOut->addHTML( wfMsg( 'ow_importtsv_nothing_added' ) );
				}
				$wgOut->addHTML( "<br />" );
			}
			else {
				$wgOut->addHTML( "<br />" . wfMsgExt( 'ow_importtsv_results', 'parsemag', $definitions, $translations ) . "<br />" );
			}
				
		}
		else {
			// render the page
			$wgOut->setPageTitle( wfMsg( 'ow_importtsv_title2' ) );
			$wgOut->addHTML( wfMsg( 'ow_importtsv_header' ) );
			
			$wgOut->addHTML( getOptionPanelForFileUpload(
				array(
					wfMsg( 'ow_importtsv_file' ) => getFileField( 'tsvfile' ),
					wfMsg( 'ow_importtsv_test_run' ) => getCheckBox( 'testrun', true )
				)
			) );
		}

	}
	/**
	 * FIXME - work in progress
	 */
	public function saveWithinTransaction() {
#		global
# 			$wgTitle, $wgUser, $wgRequest;

		global
			$wgUser, $wgOut;

		if ( !$wgUser->isAllowed( 'wikidata-copy' ) ) {
 			$wgOut->addWikiText( wfMsgSc( "noedit", $dc->fetchName() ) );
			$wgOut->setPageTitle( wfMsgSc( "noedit_title" ) );
 			return false;
 		}
		# $summary = $wgRequest->getText('summary');

		
		// Insert transaction information into the DB
		# startNewTransaction($wgUser->getID(), wfGetIP(), $summary);
		startNewTransaction( 0, "0.0.0.0", "copy operation" );

		// Perform regular save
		# $this->save(new QueryAtTransactionInformation($wgRequest->getInt('transaction'), false));
		$newDefinedMeaningId = $this->save();

		// Update page caches
		# Title::touchArray(array($wgTitle));

		// Add change to RC log
		# $now = wfTimestampNow();
		# RecentChange::notifyEdit($now, $wgTitle, false, $wgUser, $summary, 0, $now, false, '', 0, 0, 0);
		return $newDefinedMeaningId;
	}
$beginTime = time();
$wgCommandLineMode = true;
$wdDefaultViewDataSet = 'umls';

$arg = reset( $argv );
if ( $arg !== false ) {
 	$wdDefaultViewDataSet = next( $argv );
}

/*
 * User IDs to use during the import of both UMLS and Swiss-Prot
 */
$nlmUserID = getUserId( $wdDefaultViewDataSet );
if ( $nlmUserId == - 1 ) {
	echo "Swiss-Prot user not defined in the database.\n";
	die;
}

$wgUser->setID( $nlmUserID );
startNewTransaction( $nlmUserID, 0, "UMLS Import" );
echo "Importing UMLS\n";
$umlsImport = importUMLSFromDatabase( "localhost", "umls2007aa", "root", "crosby9" );// , array("NCI", "GO"));
// $umlsImport = importUMLSFromDatabase("localhost", "umls", "root", "nicheGod", array("GO", "SRC", "NCI", "HUGO"));
// $umlsImport = importUMLSFromDatabase("localhost", "umls", "root", NULL, array("GO", "SRC", "NCI", "HUGO"));


$endTime = time();
echo "\n\nTime elapsed: " . durationToString( $endTime - $beginTime );

?>
예제 #12
0
// $nlmUserID = $sibUserID;
// $wgUser->setID($nlmUserID);
// startNewTransaction($nlmUserID, 0, "UMLS Import");
// echo "Importing UMLS\n";
// $umlsImport = importUMLSFromDatabase("localhost", "umls", "root", "", array("NCI", "GO"));
// $umlsImport = importUMLSFromDatabase("localhost", "umls", "root", "nicheGod", array("GO", "SRC", "NCI", "HUGO"));
// $umlsImport = importUMLSFromDatabase("localhost", "umls", "root", NULL, array("GO", "SRC", "NCI", "HUGO"));

// $EC2GoMapping = loadEC2GoMapping($linkEC2GoFileName);
// $SP2GoMapping = loadSwissProtKeyWord2GoMapping($linkSwissProtKeyWord2GoFileName);

ini_set( 'memory_limit', '256M' );

$wgUser->setID( $sibUserID );
startNewTransaction( $sibUserID, 0, "Swiss-Prot Import" );
echo "\nImporting Swiss-Prot\n";
# $nsstore=wfGetNamespaceStore();
# print_r($nsstore->nsarray);
# "Namespace id for expression=" . MWNamespace::getIndexForName('expression');

// $umlsImport = new UMLSImportResult;
// $umlsImport->umlsCollectionId = 5;
// $umlsImport->sourceAbbreviations['GO'] = 30; 
// $umlsImport->sourceAbbreviations['HUGO'] = 69912;

// importSwissProt($swissProtXMLFileName, $umlsImport->umlsCollectionId, $umlsImport->sourceAbbreviations['GO'], $umlsImport->sourceAbbreviations['HUGO'], $EC2GoMapping, $SP2GoMapping);
importSwissProt( $swissProtXMLFileName );

$endTime = time();
echo "\n\nTime elapsed: " . durationToString( $endTime - $beginTime );