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


Java DBConnection类代码示例

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


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

示例1: saveToStore

import com.hp.hpl.jena.db.DBConnection; //导入依赖的package包/类
private void saveToStore(String rdfFileName) throws ClassNotFoundException, IOException
{
	String M_DBDRIVER_CLASS = "com.mysql.jdbc.Driver";
	// load the the driver class
	Class.forName(M_DBDRIVER_CLASS);

	String dbUrl = "jdbc:mysql://" + hostName + "/" + dbName;
	// create a database connection
	IDBConnection conn = new DBConnection(dbUrl, userName, password, "MySQL");

	// create a model maker with the given connection parameters
	ModelMaker maker = ModelFactory.createModelRDBMaker(conn);

	ModelRDB model = (ModelRDB) maker.openModel(modelName);
	InputStream file = new FileInputStream(rdfFileName);
	model.read(file,null,"N3");
	file.close();
}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:19,代码来源:PublishRDFCommand.java

示例2: getRDBModel

import com.hp.hpl.jena.db.DBConnection; //导入依赖的package包/类
/**
 * <p>Method that returns a new or an existing Jena RDB model</p>
 * @param dbUrl - the database url
 * @param dbUser - the database user
 * @param dbPass - the database password
 * @param dbType - the database type
 * @param create - true iff a new model is to be created, false otherwise
 * @return a new or an existing Jena RDB model
 */
public Model getRDBModel( String dbUrl, String dbUser, String dbPass, String dbType, boolean create )
{
	//Create a database model maker
	ModelMaker rdbModelMaker = ModelFactory.createModelRDBMaker( new DBConnection( dbUrl, dbUser, dbPass, dbType ) );
	
	//If the model does not exist create a new model, else return the existing model
	if( !rdbModelMaker.hasModel( "rdbModel" ) )
	{
		if ( create )
			return rdbModelMaker.createModel( "rdbModel" );
		else
			return null;
	}
	else
		return rdbModelMaker.openModel( "rdbModel" );
}
 
开发者ID:vaibhavkhadilkar,项目名称:D2RQ-Update,代码行数:26,代码来源:RDBModelForD2RQRW.java

示例3: GeneNames

import com.hp.hpl.jena.db.DBConnection; //导入依赖的package包/类
public GeneNames(String u, String p, boolean clear) { 
    cxn = new DBConnection(host+dbName, u, p, dbType);
    ModelMaker maker = ModelFactory.createModelRDBMaker(cxn);
    model = maker.createModel(dbURL);
    System.out.println("Connected to Model: " + dbURL);

    synonymOf = model.getProperty(gnURL + "/properties#synonymOf");
    value = model.getProperty(gnURL + "/properties#value");
    annotationOf = model.getProperty(gnURL + "/properties#annotationOf");
}
 
开发者ID:shaunmahony,项目名称:multigps-archive,代码行数:11,代码来源:GeneNames.java

示例4: GoDBInterface

import com.hp.hpl.jena.db.DBConnection; //导入依赖的package包/类
public GoDBInterface(String u, String p, boolean clear) { 
    cxn = new DBConnection(host+dbName, u, p, dbType);
    ModelMaker maker = ModelFactory.createModelRDBMaker(cxn);
    model = maker.createModel(dbURL);
    System.out.println("Connected to Model: " + dbURL);
}
 
开发者ID:shaunmahony,项目名称:multigps-archive,代码行数:7,代码来源:GoDBInterface.java


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