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

📄 issubpropertyof.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.tests;import java.util.Iterator;import org.openrdf.model.Resource;import org.openrdf.sesame.sail.RdfSchemaSource;import org.openrdf.sesame.sail.test.benchmark.model.Binary;import org.openrdf.sesame.sail.test.benchmark.pools.RdfSchemaSourcePool;/** * Tests performance of org.openrdf.sesame.sail.RdfSchemaSource.isSubPropertyOf. * * @author Peter van 't Hof. * @version %I%, %G% */public class IsSubPropertyOf extends RdfSchemaSourceBMTestB {/*-------------+| Constructors |+-------------*/	/**	 * Creates a new benchmark test which tests	 * org.openrdf.sesame.sail.RdfSchemaSource.isSubPropertyOf.	 *	 * @param rdfSchemaSource RdfSchemaSource to test.	 */	public IsSubPropertyOf(RdfSchemaSource rdfSchemaSource) {		super("isSubPropertyOf", rdfSchemaSource);		_needsPool = true;	}/*--------+| Methods |+--------*/   	/* Queries if a subProperty which is a subProperty of superProperty is a	 * subProperty of superProperty.	 */	protected void _testA() {		Iterator i = _cutDown(RdfSchemaSourcePool.subPropertyOfRelations, 100).iterator();				while (i.hasNext()) {			Binary subPropertyOfRelation = (Binary)i.next();			Resource subProperty = (Resource)subPropertyOfRelation.getLeft();			Resource superProperty = (Resource)subPropertyOfRelation.getRight();						_startA();							_isSubPropertyOf(subProperty, superProperty, true);			_stopA();		}	}	protected void _testB() {		// Part one: query if resources are a subProperty of eachother, pattern		// consists of resources which do not exist, resources which do exist but		// are no property and properties.		Iterator noPropertiesIter = _cutDown(RdfSchemaSourcePool.noProperties, 100).iterator();		Iterator propertiesIter = _cutDown(RdfSchemaSourcePool.properties, 100).iterator();		while (noPropertiesIter.hasNext() && propertiesIter.hasNext()) {			Resource noProperty = (Resource)noPropertiesIter.next();			Resource propertyResource = (Resource)propertiesIter.next();						_startB();			_isSubPropertyOf(noProperty, RdfSchemaSourcePool.noSubject, false);			_isSubPropertyOf(RdfSchemaSourcePool.noSubject, noProperty, false);			_isSubPropertyOf(noProperty, noProperty, false);			_isSubPropertyOf(propertyResource, RdfSchemaSourcePool.noSubject, false);			_isSubPropertyOf(RdfSchemaSourcePool.noSubject, propertyResource, false);			_isSubPropertyOf(noProperty, propertyResource, false);			_isSubPropertyOf(propertyResource, noProperty, false);			_stopB(7);		}		// Part two: query if subproperty which is NOT a subProperty of superProperty		// is a subProperty of superProperty.		Iterator i = _cutDown(RdfSchemaSourcePool.noSubPropertyOfRelations, 100).iterator();				while (i.hasNext()) {			Binary subPropertyOfRelation = (Binary)i.next();			Resource subProperty = (Resource)subPropertyOfRelation.getLeft();			Resource superProperty = (Resource)subPropertyOfRelation.getRight();			_startB();			_isSubPropertyOf(subProperty, superProperty, false);			_stopB();		}	}	protected void _isSubPropertyOf(			Resource subProperty, Resource superProperty, boolean expected)	{		if (expected != _rdfSchemaSource.isSubPropertyOf(subProperty, superProperty)) {			_error("isSubPropertyOf(" + subProperty + ", " + superProperty + ") should be " + expected);		}	}	public String toString() {		return _toString("True", "False");	}}

⌨️ 快捷键说明

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