当前位置: 首页>>代码示例>>Java>>正文


Java Row类代码示例

本文整理汇总了Java中org.ohdsi.utilities.files.Row的典型用法代码示例。如果您正苦于以下问题:Java Row类的具体用法?Java Row怎么用?Java Row使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Row类属于org.ohdsi.utilities.files包,在下文中一共展示了Row类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTableNames

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public List<String> getTableNames(String database) {
	List<String> names = new ArrayList<String>();
	String query = null;
	if (dbType.equals(DbType.MYSQL)) {
		if (database == null)
			query = "SHOW TABLES";
		else
			query = "SHOW TABLES IN " + database;
	} else if (dbType.equals(DbType.MSSQL)) {
		query = "SELECT name FROM " + database + ".sys.tables ";
	} else if (dbType.equals(DbType.ORACLE)) {
		query = "SELECT table_name FROM all_tables WHERE owner='" + database.toUpperCase() + "'";
	} else if (dbType.equals(DbType.POSTGRESQL)) {
		query = "SELECT table_name FROM information_schema.tables WHERE table_schema = '" + database + "'";
	}

	for (Row row : query(query))
		names.add(row.get(row.getFieldNames().get(0)));
	return names;
}
 
开发者ID:OHDSI,项目名称:MedlineXmlToDatabase,代码行数:21,代码来源:ConnectionWrapper.java

示例2: characters

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public void characters(char ch[], int start, int length) throws SAXException {
	String traceString = trace.toString();
	if (traceString.equalsIgnoreCase("DescriptorRecordSet.DescriptorRecord.DescriptorUI")) {
		ui = new String(ch, start, length);
		row.add("ui", ui);
	} else if (traceString.equalsIgnoreCase("DescriptorRecordSet.DescriptorRecord.DescriptorName.String")) {
		row.add("name", new String(ch, start, length));
	} else if (traceString.equalsIgnoreCase("DescriptorRecordSet.DescriptorRecord.TreeNumberList.TreeNumber")) {
		treeNumberToUi.put(new String(ch, start, length), ui);
	} else if (traceString.equalsIgnoreCase("DescriptorRecordSet.DescriptorRecord.PharmacologicalActionList.PharmacologicalAction.DescriptorReferredTo.DescriptorUI")) {
		Row rowPa = new Row();
		rowPa.add("ui_1", ui);
		rowPa.add("ui_2", new String(ch, start, length));
		rowPa.add("relationship_id", "Pharmacological action");
		outRelationship.write(rowPa);
	}
}
 
开发者ID:OHDSI,项目名称:MedlineXmlToDatabase,代码行数:18,代码来源:MainMeshParser.java

示例3: loadAncestors

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
private void loadAncestors(String conceptAncestorFileName, IntHashSet validConceptIds) {
	File file = new File(conceptAncestorFileName);
	if (file.exists()) {
		buildThread.report("Loading parent-child information");
		int count = 0;
		for (Row row : new ReadAthenaFile(conceptAncestorFileName)) {
			if (row.get("min_levels_of_separation").equals("1") && !row.get("ancestor_concept_id").equals(row.get("descendant_concept_id"))
					&& validConceptIds.contains(row.getInt("ancestor_concept_id")) && validConceptIds.contains(row.getInt("descendant_concept_id"))) {
				ParentChildRelationShip parentChildRelationship = new ParentChildRelationShip(row);
				dbEngine.put(parentChildRelationship);
			}
			count++;
			if (count % 100000 == 0)
				System.out.println("Processed " + count + " relationships");
		}
	}
}
 
开发者ID:OHDSI,项目名称:Usagi,代码行数:18,代码来源:BerkeleyDbBuilder.java

示例4: loadConcepts

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
private void loadConcepts(String conceptFileName, String loincFileName) {
	Map<String, String> loincToInfo = null;
	if (loincFileName != null) {
		buildThread.report("Loading LOINC additional information");
		loincToInfo = loadLoincInfo(loincFileName);
	}
	buildThread.report("Loading concept information");
	int count = 0;
	for (Row row : new ReadAthenaFile(conceptFileName)) {
		Concept concept = new Concept(row);
		if (concept.invalidReason == null) {
			if (loincToInfo != null) {
				String info = loincToInfo.get(concept.conceptCode);
				if (info != null)
					concept.additionalInformation = info;
			}
			concept.parentCount = dbEngine.getParentChildRelationshipsByChildConceptId(concept.conceptId).size();
			concept.childCount = dbEngine.getParentChildRelationshipsByParentConceptId(concept.conceptId).size();
			dbEngine.put(concept);
			count++;
			if (count % 100000 == 0)
				System.out.println("Loaded " + count + " concepts");
		}
	}
}
 
开发者ID:OHDSI,项目名称:Usagi,代码行数:26,代码来源:BerkeleyDbBuilder.java

示例5: write

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public void write(CodeMapping codeMapping) {
	List<Concept> targetConcepts;
	if (codeMapping.targetConcepts.size() == 0) {
		targetConcepts = new ArrayList<Concept>(1);
		targetConcepts.add(Concept.EMPTY_CONCEPT);
	} else
		targetConcepts = codeMapping.targetConcepts;
	for (Concept targetConcept : targetConcepts) {
		Row row = codeMapping.sourceCode.toRow();
		row.add("matchScore", codeMapping.matchScore);
		row.add("mappingStatus", codeMapping.mappingStatus.toString());
		row.add("conceptId", targetConcept.conceptId);
		row.add("comment", codeMapping.comment);
		out.write(row);
	}
}
 
开发者ID:OHDSI,项目名称:Usagi,代码行数:17,代码来源:WriteCodeMappingsToFile.java

示例6: getTableNames

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public List<String> getTableNames(String database) {
	List<String> names = new ArrayList<String>();
	String query = null;
	if (dbType == DbType.MYSQL) {
		query = "SHOW TABLES IN " + database;
	} else if (dbType == DbType.MSSQL || dbType == DbType.PDW) {
		query = "SELECT name FROM " + database + ".sys.tables ORDER BY name";
	} else if (dbType == DbType.ORACLE) {
		query = "SELECT table_name FROM all_tables WHERE owner='" + database.toUpperCase() + "'";
	} else if (dbType == DbType.POSTGRESQL || dbType == DbType.REDSHIFT) {
		query = "SELECT table_name FROM information_schema.tables WHERE table_schema = '" + database.toLowerCase() + "' ORDER BY table_name";
	} else if (dbType == DbType.MSACCESS) {
		query = "SELECT Name FROM sys.MSysObjects WHERE Type=1 AND Flags=0;";
	} else if (dbType == DbType.TERADATA) {
		query = "SELECT TableName from dbc.tables WHERE tablekind = 'T' and databasename='" + database + "'";
	}

	for (Row row : query(query))
		names.add(row.get(row.getFieldNames().get(0)));
	return names;
}
 
开发者ID:OHDSI,项目名称:WhiteRabbit,代码行数:22,代码来源:RichConnection.java

示例7: insertIntoTable

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
/**
 * Inserts the rows into a table in the database.
 * 
 * @param iterator
 * @param tableName
 * @param create
 *            If true, the data format is determined based on the first batch of rows and used to create the table structure.
 */
public void insertIntoTable(Iterator<Row> iterator, String table, boolean create) {
	List<Row> batch = new ArrayList<Row>(INSERT_BATCH_SIZE);

	boolean first = true;
	SimpleCounter counter = new SimpleCounter(1000000, true);
	while (iterator.hasNext()) {
		if (batch.size() == INSERT_BATCH_SIZE) {
			if (first && create)
				createTable(table, batch);
			insert(table, batch);
			batch.clear();
			first = false;
		}
		batch.add(iterator.next());
		counter.count();
	}
	if (batch.size() != 0) {
		if (first && create)
			createTable(table, batch);
		insert(table, batch);
	}
}
 
开发者ID:OHDSI,项目名称:WhiteRabbit,代码行数:31,代码来源:RichConnection.java

示例8: main

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public static void main(String[] args) {
	RichConnection connection = new RichConnection("127.0.0.1/ohdsi", null, "postgres", "F1r3starter", DbType.POSTGRESQL);
	connection.use("cdm5");
	
	WriteCSVFileWithHeader out = new WriteCSVFileWithHeader("c:/temp/CDMV5Model.csv");
	String query = "SELECT table_name,column_name,is_nullable,data_type FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'cdm5';";
	for (Row row : connection.query(query)){
		row.upperCaseFieldNames();
		Row newRow = new Row();
		for (String field : row.getFieldNames())
			newRow.add(field, row.get(field).toUpperCase());
		out.write(newRow);
	}
	out.close();
	
}
 
开发者ID:OHDSI,项目名称:WhiteRabbit,代码行数:17,代码来源:FetchCDMModelFromServer.java

示例9: write

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public void write(Row row) {
	if (firstRow) {
		createTable(row);
		firstRow = false;
	}
	batch.add(row);
	if (batch.size() == batchSize) {
		connectionWrapper.insertIntoTable(tableName, batch, true);
		batch.clear();
	}
}
 
开发者ID:OHDSI,项目名称:MedlineXmlToDatabase,代码行数:12,代码来源:InsertableDbTable.java

示例10: createTable

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
private void createTable(Row row) {
	connectionWrapper.dropTableIfExists(tableName);
	List<String> fields = row.getFieldNames();
	List<String> types = new ArrayList<String>(fields.size());
	for (int i = 0; i < fields.size(); i++) {
		try {
			Integer.parseInt(row.get(i));
			types.add("INT");
		} catch (NumberFormatException e) {
			types.add("VARCHAR(512)");
		}
	}
	connectionWrapper.createTable(tableName, fields, types, null);
}
 
开发者ID:OHDSI,项目名称:MedlineXmlToDatabase,代码行数:15,代码来源:InsertableDbTable.java

示例11: insertIntoTable

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public void insertIntoTable(String tableName, List<Row> rows, boolean emptyStringToNull) {
	List<String> columns = rows.get(0).getFieldNames();
	String sql = "INSERT INTO " + tableName;
	sql = sql + " (" + StringUtilities.join(columns, ",") + ")";
	sql = sql + " VALUES (?";
	for (int i = 1; i < columns.size(); i++)
		sql = sql + ",?";
	sql = sql + ")";
	try {
		connection.setAutoCommit(false);
		PreparedStatement statement = connection.prepareStatement(sql);
		for (Row row : rows) {
			for (int i = 0; i < columns.size(); i++) {
				String value = row.get(columns.get(i));
				if (value == null)
					System.out.println(row.toString());
				if (value.length() == 0 && emptyStringToNull)
					value = null;
				if (dbType.equals(DbType.POSTGRESQL)) // PostgreSQL does not allow unspecified types
					statement.setObject(i + 1, value, Types.OTHER);
				else if (dbType.equals(DbType.ORACLE)) {
					statement.setString(i + 1, value);
				} else
					statement.setString(i + 1, value);
			}
			statement.addBatch();
		}
		statement.executeBatch();
		connection.commit();
		statement.close();
		connection.setAutoCommit(true);
		connection.clearWarnings();
	} catch (SQLException e) {
		e.printStackTrace();
		if (e instanceof BatchUpdateException) {
			System.err.println(((BatchUpdateException) e).getNextException().getMessage());
		}
	}
}
 
开发者ID:OHDSI,项目名称:MedlineXmlToDatabase,代码行数:40,代码来源:ConnectionWrapper.java

示例12: next

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
@Override
public Row next() {
	try {
		Row row = new Row();
		ResultSetMetaData metaData;
		metaData = resultSet.getMetaData();
		columnNames.clear();

		for (int i = 1; i < metaData.getColumnCount() + 1; i++) {
			String columnName = metaData.getColumnName(i);
			if (columnNames.add(columnName)) {
				String value = resultSet.getString(i);
				if (value == null)
					value = "";

				row.add(columnName, value.replace(" 00:00:00", ""));
			}
		}
		hasNext = resultSet.next();
		if (!hasNext) {
			resultSet.close();
			resultSet = null;
		}
		return row;
	} catch (SQLException e) {
		e.printStackTrace();
		throw new RuntimeException(e);
	}
}
 
开发者ID:OHDSI,项目名称:MedlineXmlToDatabase,代码行数:30,代码来源:ConnectionWrapper.java

示例13: startElement

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public void startElement(String uri, String localName, String name, Attributes a) {
	trace.push(name);
	if (name.equalsIgnoreCase("SupplementalRecord")) {
		row = new Row();
		recordName = new StringBuilder();
	}
}
 
开发者ID:OHDSI,项目名称:MedlineXmlToDatabase,代码行数:8,代码来源:SupplementaryMeshParser.java

示例14: Concept

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public Concept(Row row) {
	conceptId = row.getInt("concept_id");
	conceptName = row.get("concept_name");
	domainId = row.get("domain_id");
	vocabularyId = row.get("vocabulary_id");
	conceptClassId = row.get("concept_class_id");
	standardConcept = row.get("standard_concept");
	conceptCode = row.get("concept_code");
	validStartDate = row.get("valid_start_date");
	validEndDate = row.get("valid_end_date");
	invalidReason = row.get("invalid_reason");
	additionalInformation = "";
}
 
开发者ID:OHDSI,项目名称:Usagi,代码行数:14,代码来源:Concept.java

示例15: grabVersion

import org.ohdsi.utilities.files.Row; //导入依赖的package包/类
public void grabVersion(String vocabFolder) {
	for (Row row : new ReadAthenaFile(vocabFolder + "/VOCABULARY.csv")) {
		if (row.get("vocabulary_name").contains("Standardized Vocabularies")) {
			WriteTextFile out = new WriteTextFile(Global.folder + "/vocabularyVersion.txt");
			out.writeln(row.get("vocabulary_version"));
			out.close();
		}
	}
}
 
开发者ID:OHDSI,项目名称:Usagi,代码行数:10,代码来源:VocabVersionGrabber.java


注:本文中的org.ohdsi.utilities.files.Row类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。