public function __construct( $collectionId, $collectionName, $languageId, $collectionType = "" ) { $this->collectionId = $collectionId; $this->languageId = $languageId; if ( $this->collectionId == 0 ) $this->collectionId = bootstrapCollection( $collectionName, $languageId, $collectionType ); $this->contents = getCollectionContents( $this->collectionId ); }
function importUMLSFromDatabase( $server, $databaseName, $userName, $password, $sources = null ) { $result = new UMLSImportResult; openDatabase( $server, $databaseName, $userName, $password ); $languageId = 85; echo "Creating UMLS collections\n"; $umlsCollectionId = bootstrapCollection( "UMLS", $languageId, "" ); $result->umlsCollectionId = $umlsCollectionId; $relationCollectionId = bootstrapCollection( "UMLS Relation Types 2005", $languageId, "RELT" ); addDefinedMeaningToCollection( getCollectionMeaningId( $relationCollectionId ), $umlsCollectionId, "rel" ); $relationAttributesCollectionId = bootstrapCollection( "UMLS Relation Attributes 2005", $languageId, "RELT" ); addDefinedMeaningToCollection( $relationAttributesCollectionId, $umlsCollectionId, "rela" ); $semanticNetworkSemanticTypesCollectionId = bootstrapCollection( "Semantic Network 2005AC Semantic Types", $languageId, "CLAS" ); addDefinedMeaningToCollection( getCollectionMeaningId( $semanticNetworkSemanticTypesCollectionId ), $umlsCollectionId, "STY" ); $semanticNetworkRelationTypesCollectionId = bootstrapCollection( "Semantic Network 2005AC Relation Types", $languageId, "RELT" ); addDefinedMeaningToCollection( getCollectionMeaningId( $semanticNetworkRelationTypesCollectionId ), $umlsCollectionId, "RL" ); echo "Loading source abbreviations\n"; $sourceAbbreviations = loadSourceAbbreviations( $sources ); echo "Loading languages\n"; $isoLanguages = loadIsoLanguages(); echo "Importing UMLS terms per source\n"; $i = 1; foreach ( $sourceAbbreviations as $sab => $source ) { $collectionId = bootstrapCollection( $source, $languageId, "" ); $result->sourceAbbreviations[$sab] = $collectionId; echo " $i: $sab - $source\n"; importUMLSTerms( $sab, $umlsCollectionId, $collectionId, $languageId, $isoLanguages ); $i++; } echo "Importing UMLS definitions per source\n"; $i = 1; foreach ( $sourceAbbreviations as $sab => $source ) { echo " $i: $sab - $source\n"; importUMLSDefinitions( $sab, $umlsCollectionId, $result->sourceAbbreviations[$sab], $languageId ); $i++; } echo "Importing UMLS relation types\n"; importUMLSRelationTypes( $relationCollectionId, $languageId ); echo "Importing UMLS attribute types\n"; importUMLSRelationAttributes( $relationAttributesCollectionId, $languageId ); echo "Importing UMLS relations per source\n"; $relationCollection = getCollectionContents( $relationCollectionId ); $relationAttributesCollection = getCollectionContents( $relationAttributesCollectionId ); $i = 1; foreach ( $sourceAbbreviations as $sab => $source ) { echo " $i: $sab - $source\n"; $query = "select cui1, cui2, rel from MRREL where sab like '$sab'"; importUMLSRelations( $umlsCollectionId , $relationCollection, $query ); $query = "select cui1, cui2, rela from MRREL where sab like '$sab' and rela!=''"; importUMLSRelations( $umlsCollectionId , $relationAttributesCollection, $query ); $i++; } echo "Importing semantic network types\n"; importSNTypes( $semanticNetworkSemanticTypesCollectionId, "SELECT semtypeab,type,definition FROM srdef WHERE type='STY'", $languageId ); importSNTypes( $semanticNetworkRelationTypesCollectionId, "SELECT semtypeab,type,definition FROM srdef WHERE type='RL'", $languageId ); echo "Importing semantic network relations\n"; importSemanticTypeRelations( $semanticNetworkSemanticTypesCollectionId, $relationCollection, "SELECT SEMTYPE1, RELATION, SEMTYPE2 from semtypehier" ); importSemanticTypeRelations( $semanticNetworkRelationTypesCollectionId, $relationCollection, "SELECT RELTYPE1, RELATION, RELTYPE2 from semrelhier" ); echo "Importing UMLS semantic type relations per source\n"; $attributeTypes = getCollectionContents( $semanticNetworkSemanticTypesCollectionId ); $i = 1; foreach ( $sourceAbbreviations as $sab => $source ) { echo " " . $i++ . ": $sab - $source\n"; importUMLSSemanticTypes( $sab, $umlsCollectionId, $attributeTypes ); } return $result; }