⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sailpool.java

📁 这是外国一个开源推理机
💻 JAVA
字号:
/*  Sesame - Storage and Querying architecture for RDF and RDF Schema *  Copyright (C) 2001-2005 Aduna * *  Contact:  *  	Aduna *  	Prinses Julianaplein 14 b *  	3817 CS Amersfoort *  	The Netherlands *  	tel. +33 (0)33 465 99 87 *  	fax. +33 (0)33 465 99 87 * *  	http://aduna.biz/ *  	http://www.openrdf.org/ *   *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Lesser General Public *  License as published by the Free Software Foundation; either *  version 2.1 of the License, or (at your option) any later version. * *  This library is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *  Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with this library; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */package org.openrdf.sesame.sail.test.benchmark.pools;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import org.openrdf.sesame.sail.Sail;import org.openrdf.sesame.sail.test.benchmark.util.BMUtil;/** * Pool used by benchmark test for testing of performance of implementations of * org.openrdf.sesame.sail.Sail. * * The pool is a kind of subset of the dataset the benchmark test generates * before testing a Sail. The test uses both the dataset and the pool. The pool * consists of variables the test uses. * Generating a pool takes a long time, from a few minutes up to days, depending * on the speed of the CPU, the size of the repository and the complexity of the * dataset.  * The pool must be generated on a correct version of the Sail, otherwise it * could be incorrect. This means for every Sail you test, you should first run * the test on a correct version of the Sail. * The test generates a pool if it cannot find it in the path specified in the * configuration file. This means it will only generate one the very first time * you test a Sail. The test saves the pool, so it can be reused. * * @author Peter van 't Hof * @version %I%, %G% */public class SailPool {/*----------+| Variables |+----------*/	// Sail which to extract pool from.	protected Sail _sail;/*-------------+| Constructors |+-------------*/	/**	 * Creates a new pool which contains variables which are used by benchmark	 * test for testing of org.openrdf.sesame.sail.Sail.	 *	 * @param sail Sail which to extract variables from.	 */	public SailPool(Sail sail) {		_sail = sail;	}/*--------+| Methods |+--------*/	/**	 * Loads pool.	 *	 * @param file Path of file to load.	 * @throws IOException If an I/O error occurs.	 * @throws ClassNotFoundException If class of a serialized object cannot be	 * found.	 */	public void load(String file)		throws IOException, ClassNotFoundException {		// FileNotFoundException could be thrown.		FileInputStream fileInputStream = new FileInputStream(file);		ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);		_status("Loading pool...");		_load(objectInputStream);		objectInputStream.close();		fileInputStream.close();		_status("Pool loaded.");	}	protected void _load(ObjectInputStream inputStream)		throws IOException, ClassNotFoundException {}	/**	 * Saves pool.	 *	 * @param file Path of file to save.	 * @throws IOException If an I/O error occurs.	 */	public void save(String file) 		throws IOException {		_status("Saving pool...");		FileOutputStream fileOutputStream = new FileOutputStream(file);		ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);		_save(objectOutputStream);		objectOutputStream.flush();		objectOutputStream.close();				fileOutputStream.close();		_status("Pool saved.");	}	protected void _save(ObjectOutputStream outputStream)		throws IOException {}	/**	 * Initializes pool.	 */	public void initialize() {		_status("Initializing pool...");				_initialize();		_status("Pool initialized.");	}	protected void _initialize() {}	protected void _status(String status) {		BMUtil.status(status);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -