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

📄 sailutiltest.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;import java.util.HashMap;import java.util.Map;import junit.framework.TestCase;import org.openrdf.model.BNode;import org.openrdf.model.Literal;import org.openrdf.model.URI;import org.openrdf.model.impl.BNodeImpl;import org.openrdf.model.impl.LiteralImpl;import org.openrdf.model.impl.URIImpl;public class SailUtilTest extends TestCase {/*--------------------------------------+| Variables                             |+--------------------------------------*/	protected org.openrdf.sesame.sail.RdfRepository _model1;	protected org.openrdf.sesame.sail.RdfRepository _model2;	protected org.openrdf.sesame.sail.RdfRepository _model3;	protected org.openrdf.sesame.sail.RdfRepository _model4;/*--------------------------------------+| Constructors                          |+--------------------------------------*/	public SailUtilTest() {		super();	}	public SailUtilTest(String name) {		super(name);	}/*--------------------------------------+| Methods                               |+--------------------------------------*/	protected void setUp() {		URI fooBar = new URIImpl("foo:bar");		URI someProp = new URIImpl("some:prop");		URI barFoo = new URIImpl("bar:foo");		URI rdfsLabel = new URIImpl("rdfs:label");		BNode bNodeA = new BNodeImpl("a");		BNode bNodeB = new BNodeImpl("b");		BNode bNodeC = new BNodeImpl("c");		BNode bNodeD = new BNodeImpl("d");		Literal helloWorld = new LiteralImpl("Hello world!");		_model1 = new org.openrdf.sesame.sailimpl.memory.RdfRepository();		_model2 = new org.openrdf.sesame.sailimpl.memory.RdfRepository();		_model3 = new org.openrdf.sesame.sailimpl.memory.RdfRepository();		_model4 = new org.openrdf.sesame.sailimpl.memory.RdfRepository();		try {			Map noParams = new HashMap();			_model1.initialize(noParams);			_model2.initialize(noParams);			_model3.initialize(noParams);			_model4.initialize(noParams);		}		catch (SailInitializationException e) {			fail("Unable to initialize models: " + e.getMessage());		}		try {			_model1.startTransaction();			_model1.addStatement(fooBar, someProp, barFoo);			_model1.addStatement(fooBar, rdfsLabel, helloWorld);			_model1.commitTransaction();			_model2.startTransaction();			_model2.addStatement(fooBar, someProp, barFoo);			_model2.addStatement(fooBar, rdfsLabel, helloWorld);			_model2.commitTransaction();			_model3.startTransaction();			_model3.addStatement(bNodeA, someProp, barFoo);			_model3.addStatement(bNodeB, rdfsLabel, helloWorld);			_model3.commitTransaction();			_model4.startTransaction();			_model4.addStatement(bNodeC, someProp, barFoo);			_model4.addStatement(bNodeD, rdfsLabel, helloWorld);			_model4.commitTransaction();		}		catch (SailUpdateException e) {			fail("Unable to add statements to models: " + e.getMessage());		}	}	protected void tearDown() {		_model1.shutDown();		_model2.shutDown();		_model3.shutDown();		_model4.shutDown();		_model1 = _model2 = _model3 = _model4 = null;	}/*--------------------------------------+| Test methods                          |+--------------------------------------*/	public void testModel1EqualsModel2() {		assertTrue(SailUtil.modelsEqual(_model1, _model2));	}	public void testModel1NotEqualsModel3() {		assertFalse(SailUtil.modelsEqual(_model1, _model3));	}	public void testModel3EqualsModel4() {		assertTrue(SailUtil.modelsEqual(_model3, _model4));	}}

⌨️ 快捷键说明

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