function importUMLSRelations( $umlsCollectionId, $relationCollectionContents, $query ) { global $db; $queryResult = mysql_query( $query, $db ); $progressBar = new ProgressBar( mysql_num_rows( $queryResult ), 100 ); while ( $relation = mysql_fetch_row( $queryResult ) ) { $relationType = $relation[2]; if ( strcmp( $relationType, 'CHD' ) == 0 ) { $relationType = 'RN'; } elseif ( strcmp( $relationType, 'PAR' ) == 0 ) { $relationType = 'RB'; } // echo "$definedMeaningId1 = $relation[0]\n"; $definedMeaningId1 = getDefinedMeaningFromCollection( $umlsCollectionId, $relation[0] ); $definedMeaningId2 = getDefinedMeaningFromCollection( $umlsCollectionId, $relation[1] ); $relationMeaningId = $relationCollectionContents[$relationType]; // echo "$definedMeaningId1 = $relation[0]\n"; // echo "$definedMeaningId1 = $relation[1]\n"; // echo "umlsCollectionId = $umlsCollectionId\n"; if ( !$definedMeaningId1 ) { echo "Unknown cui $relation[0]\n"; print_r( $relation ); } if ( !$definedMeaningId2 ) { echo "Unknown cui $relation[1]\n"; print_r( $relation ); } if ( !$relationMeaningId ) { echo "Unknown relation $relationType\n"; print_r( $relationCollectionContents ); print_r( $relation ); } if ( $definedMeaningId2 > 0 && $definedMeaningId1 > 0 && $relationMeaningId > 0 ) addRelation( $definedMeaningId2, $relationMeaningId, $definedMeaningId1 ); $progressBar->advance( 1 ); } $progressBar->clear(); }