|
From: Bryan T. <tho...@us...> - 2007-04-14 13:33:57
|
Update of /cvsroot/cweb/bigdata-rdf/src/test/com/bigdata/rdf/inf In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14591/src/test/com/bigdata/rdf/inf Modified Files: TestFullForwardClosure.java TestMagicSets.java AbstractInferenceEngineTestCase.java Added Files: TestRuleRdfs11.java Log Message: Modified RuleRdfs11 to use a binary search to locate possible matches during the self-join. This gives a big speedup on the nciOncology dataset. There is more work to do here. I think that RuleRdfs11 should fix point all by itself in order to compute the transative closure of the subClassOf relationship as quickly as possible (in as few rounds). This the join is handled in the abstract rule shared by the subPropertyOf rule, this will also provide a fast fixed point for that relation. Index: AbstractInferenceEngineTestCase.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/test/com/bigdata/rdf/inf/AbstractInferenceEngineTestCase.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AbstractInferenceEngineTestCase.java 22 Mar 2007 21:11:29 -0000 1.8 --- AbstractInferenceEngineTestCase.java 14 Apr 2007 13:33:49 -0000 1.9 *************** *** 85,94 **** properties = super.getProperties(); ! // properties.setProperty(Options.BUFFER_MODE, BufferMode.Transient ! // .toString()); ! properties.setProperty(Options.BUFFER_MODE, getBufferMode().toString()); ! // properties.setProperty(Options.BUFFER_MODE, BufferMode.Disk ! // .toString()); ! // properties.setProperty(Options.SLOT_SIZE, ""+Bytes.kilobyte32); if(properties.getProperty(Options.FILE)==null) { properties.setProperty(Options.FILE, getName()+".jnl"); --- 85,94 ---- properties = super.getProperties(); ! if(properties.getProperty(Options.BUFFER_MODE)==null) { ! ! // override if not specified. ! properties.setProperty(Options.BUFFER_MODE, getBufferMode().toString()); ! ! } if(properties.getProperty(Options.FILE)==null) { properties.setProperty(Options.FILE, getName()+".jnl"); *************** *** 97,101 **** properties.setProperty(Options.BASENAME, getName()); } - // properties.setProperty(Options.INITIAL_EXTENT,""+getInitialExtent()); } --- 97,100 ---- *************** *** 118,122 **** protected BufferMode getBufferMode() { ! return BufferMode.Direct; } --- 117,121 ---- protected BufferMode getBufferMode() { ! return BufferMode.Transient; } Index: TestFullForwardClosure.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/test/com/bigdata/rdf/inf/TestFullForwardClosure.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TestFullForwardClosure.java 13 Apr 2007 20:37:04 -0000 1.6 --- TestFullForwardClosure.java 14 Apr 2007 13:33:49 -0000 1.7 *************** *** 71,75 **** super(name); } ! /** * Test of full forward closure. --- 71,75 ---- super(name); } ! /** * Test of full forward closure. *************** *** 83,88 **** * hand-crafted data sets to test the rule implementations. */ ! // store.loadData(new File("data/alibaba_v41.rdf"),"",false); ! store.loadData(new File("data/nciOncology.owl"),"",false); store.fullForwardClosure(); --- 83,88 ---- * hand-crafted data sets to test the rule implementations. */ ! store.loadData(new File("data/alibaba_v41.rdf"),"",false); ! // store.loadData(new File("data/nciOncology.owl"),"",false); store.fullForwardClosure(); --- NEW FILE: TestRuleRdfs11.java --- /** The Notice below must appear in each file of the Source Code of any copy you distribute of the Licensed Product. Contributors to any Modifications may add their own copyright notices to identify their own contributions. License: The contents of this file are subject to the CognitiveWeb Open Source License Version 1.1 (the License). You may not copy or use this file, in either source code or executable form, except in compliance with the License. You may obtain a copy of the License from http://www.CognitiveWeb.org/legal/license/ Software distributed under the License is distributed on an AS IS basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Copyrights: Portions created by or assigned to CognitiveWeb are Copyright (c) 2003-2003 CognitiveWeb. All Rights Reserved. Contact information for CognitiveWeb is available at http://www.CognitiveWeb.org Portions Copyright (c) 2002-2003 Bryan Thompson. Acknowledgements: Special thanks to the developers of the Jabber Open Source License 1.0 (JOSL), from which this License was derived. This License contains terms that differ from JOSL. Special thanks to the CognitiveWeb Open Source Contributors for their suggestions and support of the Cognitive Web. Modifications: */ /* * Created on Apr 13, 2007 */ package com.bigdata.rdf.inf; import org.openrdf.model.URI; import org.openrdf.vocabulary.RDFS; import com.bigdata.rdf.TempTripleStore; import com.bigdata.rdf.inf.Rule.Stats; import com.bigdata.rdf.model.OptimizedValueFactory._URI; /** * @see RuleRdfs11 * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ */ public class TestRuleRdfs11 extends AbstractInferenceEngineTestCase { /** * */ public TestRuleRdfs11() { } /** * @param name */ public TestRuleRdfs11(String name) { super(name); } public void test_rdfs11() { URI A = new _URI("http://www.foo.org/A"); URI B = new _URI("http://www.foo.org/B"); URI C = new _URI("http://www.foo.org/C"); URI rdfsSubClassOf = new _URI(RDFS.SUBCLASSOF); store.addStatement(A, rdfsSubClassOf, B); store.addStatement(B, rdfsSubClassOf, C); assertTrue(store.containsStatement(A, rdfsSubClassOf, B)); assertTrue(store.containsStatement(B, rdfsSubClassOf, C)); assertFalse(store.containsStatement(A, rdfsSubClassOf, C)); // store.fullForwardClosure(); Stats stats = new Stats(); TempTripleStore tmpStore = new TempTripleStore(); final int capacity = 10; final boolean distinct = false; SPOBuffer buffer = new SPOBuffer(tmpStore,capacity,distinct); // apply the rule. store.rdfs11.apply(stats, buffer); // dump entailments on the console. buffer.dump(store); assertEquals("numComputed",stats.numComputed,1); // flush entailments into the temporary store. buffer.flush(); /* * transfer the entailments from the temporary store to the primary * store. */ assertEquals("#copied",1,store.copyStatements(tmpStore)); /* * validate the state of the primary store. */ assertTrue(store.containsStatement(A, rdfsSubClassOf, B)); assertTrue(store.containsStatement(B, rdfsSubClassOf, C)); assertTrue(store.containsStatement(A, rdfsSubClassOf, C)); } } Index: TestMagicSets.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/test/com/bigdata/rdf/inf/TestMagicSets.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestMagicSets.java 13 Apr 2007 20:37:04 -0000 1.8 --- TestMagicSets.java 14 Apr 2007 13:33:49 -0000 1.9 *************** *** 161,169 **** * Applies the base rule iff the {@link Magic} is matched. */ ! public Rule.Stats apply( Stats stats, SPO[] buffer, TempTripleStore tmpStore ) { if(match()) { ! return rule.apply( stats, buffer, tmpStore ); } --- 161,169 ---- * Applies the base rule iff the {@link Magic} is matched. */ ! public Rule.Stats apply( Stats stats, SPOBuffer buffer) { if(match()) { ! return rule.apply( stats, buffer ); } |