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

📄 benchmark.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;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.util.Properties;import org.openrdf.util.log.ThreadLog;import org.openrdf.sesame.sail.RdfRepository;import org.openrdf.sesame.sail.RdfSchemaRepository;import org.openrdf.sesame.sail.RdfSchemaSource;import org.openrdf.sesame.sail.RdfSource;import org.openrdf.sesame.sail.Sail;import org.openrdf.sesame.sail.test.benchmark.util.BMUtil;/** * Main class benchmark test. * * @author Peter van 't Hof. * @version %I%, %G% */public class Benchmark {/*--------+| Methods |+--------*/		/**	 * Main method.	 *	 * @param args String array containing location configuration file.	 */	public static void main(String[] args) {		BMUtil.notify			("Welcome to Benchmark (Version 0.1).\n" + 			 "\t  Copyright (c) 2002 Aidministrator.\n" + 			 "\t  Please send any comments to phof@aidministrator.nl.");				// Get location configuration file.		String file = null;		if (args.length > 0) {			file = args[0];		}		else {			_exit("No properties file specified. Usage: java org.openrdf.sesame.sail.test.benchmark.Benchmark <properties_file>");		}				try {				_status("Configuring benchmark test...");			// Load configuration file.			Properties properties = new Properties();						try {				properties.load(new FileInputStream(file));			}			catch (FileNotFoundException e) {				_exit("File " + file + " could not be found.");			}			// Instantiate Sail.			Sail sail = null;			SailBMTest test = null;					String sailClassName = properties.getProperty("sailClass");						if (sailClassName == null) {				_exit("sailClass missing.");			}						try {				Class sailClass = Class.forName(sailClassName);								// Suppress traces.				ThreadLog.registerThread(null, 0);							try {					sail = (org.openrdf.sesame.sail.Sail)sailClass.newInstance();				}				catch (InstantiationException e) {					_exit("Class " + sailClassName + " could not be instantiated.");				}				catch (IllegalAccessException e) {					_exit("Class " + sailClassName + " could not be accessed.");				}				catch (ClassCastException e) {					_exit("Class " + sailClassName + 						  " does not implement interface nl.aidministrator.sail.Sail.");				}				// Show traces.				ThreadLog.registerThread(null, 5);							}			catch (ClassNotFoundException e) {				_exit("Class " + sailClassName + " not found.");			}						if (sail instanceof RdfSchemaRepository) { 				test = new RdfSchemaRepositoryBMTest((RdfSchemaRepository)sail, properties);	 		} 			else if (sail instanceof RdfSchemaSource) { 				test = 	 				new RdfSchemaSourceBMTest((RdfSchemaSource)sail, properties); 			}	 		else if (sail instanceof RdfRepository) { 				test = new RdfRepositoryBMTest((RdfRepository)sail, properties); 			} 	 		else if (sail instanceof RdfSource) { 		 		test = new RdfSourceBMTest((RdfSource)sail, properties);			}			else {				test = new SailBMTest(sail, properties);			}			_status("Benchmark test configured.");			test.test(); 		}		catch(Exception e) {			e.printStackTrace(System.out);			_exit("An Exception was thrown.");		}	}	protected static void _status(String status) {		BMUtil.status(status);	}	protected static void _exit(String error) {		BMUtil.exit(error);	}}

⌨️ 快捷键说明

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