From: Bryan T. <tho...@us...> - 2007-04-14 13:33:58
|
Update of /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv14591/src/java/com/bigdata/rdf/inf Modified Files: AbstractRuleRdf.java InferenceEngine.java Rule.java AbstractRuleRdfs511.java RuleRdf01.java RuleRdfs11.java SPO.java AbstractRuleRdfs2379.java AbstractRuleRdfs68101213.java Added Files: SPOBuffer.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: InferenceEngine.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf/InferenceEngine.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** InferenceEngine.java 13 Apr 2007 20:37:04 -0000 1.13 --- InferenceEngine.java 14 Apr 2007 13:33:51 -0000 1.14 *************** *** 320,323 **** --- 320,329 ---- */ final int BUFFER_SIZE = 100 * Bytes.kilobyte32; + + /* + * Note: Unlike the parser buffer, making statements distinct appears + * to slow things down significantly (2x slower!). + */ + final boolean distinct = false; final Rule[] rules = this.rules; *************** *** 337,341 **** int round = 0; ! /* * This is a buffer that is used to hold entailments so that we can --- 343,352 ---- int round = 0; ! ! /* ! * The temporary store used to accumulate the entailments. ! */ ! TempTripleStore tmpStore = new TempTripleStore(); ! /* * This is a buffer that is used to hold entailments so that we can *************** *** 347,362 **** * tmp store. */ ! final SPO[] buffer = new SPO[BUFFER_SIZE]; ! ! /* ! * The temporary store used to accumulate the entailments. ! */ ! TempTripleStore entailments = new TempTripleStore(); ! Stats totalStats = new Stats(); while (true) { ! final int numEntailmentsBefore = entailments.getStatementCount(); for (int i = 0; i < nrules; i++) { --- 358,368 ---- * tmp store. */ ! final SPOBuffer buffer = new SPOBuffer(tmpStore, BUFFER_SIZE, distinct); ! Stats totalStats = new Stats(); while (true) { ! final int numEntailmentsBefore = tmpStore.getStatementCount(); for (int i = 0; i < nrules; i++) { *************** *** 368,372 **** int nbefore = ruleStats.numComputed; ! rule.apply( ruleStats, buffer, entailments ); int nnew = ruleStats.numComputed - nbefore; --- 374,378 ---- int nbefore = ruleStats.numComputed; ! rule.apply( ruleStats, buffer ); int nnew = ruleStats.numComputed - nbefore; *************** *** 422,426 **** } ! final int numEntailmentsAfter = entailments.getStatementCount(); if ( numEntailmentsBefore == numEntailmentsAfter ) { --- 428,437 ---- } ! /* ! * Flush the statements in the buffer to the temporary store. ! */ ! buffer.flush(); ! ! final int numEntailmentsAfter = tmpStore.getStatementCount(); if ( numEntailmentsBefore == numEntailmentsAfter ) { *************** *** 437,441 **** final long insertStart = System.currentTimeMillis(); ! final int numInserted = transferBTrees(entailments); final long insertTime = System.currentTimeMillis() - insertStart; --- 448,452 ---- final long insertStart = System.currentTimeMillis(); ! final int numInserted = copyStatements(tmpStore); final long insertTime = System.currentTimeMillis() - insertStart; *************** *** 477,487 **** /** ! * Copies the entailments from the temporary store into the main store. * * @param tmpStore * ! * @return The #of entailments inserted into the main store. */ ! private int transferBTrees( TempTripleStore tmpStore ) { int numInserted = 0; --- 488,500 ---- /** ! * Copies the statements from the temporary store into the main store. * * @param tmpStore * ! * @return The #of statements inserted into the main store (the count only ! * reports those statements that were not already in the main ! * store). */ ! public int copyStatements( TempTripleStore tmpStore ) { int numInserted = 0; Index: AbstractRuleRdfs511.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf/AbstractRuleRdfs511.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractRuleRdfs511.java 13 Apr 2007 20:37:04 -0000 1.6 --- AbstractRuleRdfs511.java 14 Apr 2007 13:33:51 -0000 1.7 *************** *** 47,53 **** import com.bigdata.rdf.KeyOrder; ! import com.bigdata.rdf.TempTripleStore; ! public class AbstractRuleRdfs511 extends AbstractRuleRdf { --- 47,70 ---- import com.bigdata.rdf.KeyOrder; ! import com.bigdata.rdf.TripleStore; + /** + * Abstract rule for chain triple patterns where the object position in the + * first triple pattern is the same variable as the subject position in the + * second triple pattern and where the predicate is bound to the same constant + * for both triple patterns and also appears in the predicate position in the + * entailed triple. + * + * <pre> + * triple(?u,C,?x) :- + * triple(?u,C,?v), + * triple(?v,C,?x). + * </pre> + * + * where C is a constant. + * + * @author <a href="mailto:tho...@us...">Bryan Thompson</a> + * @version $Id$ + */ public class AbstractRuleRdfs511 extends AbstractRuleRdf { *************** *** 62,66 **** } ! public Stats apply( final Stats stats, SPO[] buffer, TempTripleStore tmpStore ) { final long computeStart = System.currentTimeMillis(); --- 79,83 ---- } ! public Stats apply( final Stats stats, SPOBuffer buffer) { final long computeStart = System.currentTimeMillis(); *************** *** 89,93 **** final SPO[] stmts1 = store.getStatements(store.getPOSIndex(), KeyOrder.POS, pkey, pkey1); ! stats.stmts1 += stmts1.length; --- 106,110 ---- final SPO[] stmts1 = store.getStatements(store.getPOSIndex(), KeyOrder.POS, pkey, pkey1); ! stats.stmts1 += stmts1.length; *************** *** 97,132 **** // a clone of the answer set // SPO[] stmts2 = stmts1.clone(); ! final SPO[] stmts2 = stmts1; ! ! stats.stmts2 += stmts2.length; ! int n = 0; // the simplest n^2 algorithm for (int i = 0; i < stmts1.length; i++) { // printStatement(stmts1[i]); ! for (int j = 0; j < stmts2.length; j++) { ! ! if (stmts1[i].o == stmts2[j].s) { ! ! buffer[n++] = new SPO(stmts1[i].s, p, stmts2[j].o); ! ! if (n == buffer.length) { ! insertStatements(buffer, n, tmpStore); ! n = 0; ! } ! stats.numComputed++; ! } } } - - insertStatements( buffer, n, tmpStore ); stats.computeTime += System.currentTimeMillis() - computeStart; --- 114,160 ---- // a clone of the answer set // SPO[] stmts2 = stmts1.clone(); ! // final SPO[] stmts2 = stmts1; ! // stats.stmts2 += stmts2.length; // the simplest n^2 algorithm for (int i = 0; i < stmts1.length; i++) { + SPO left = stmts1[i]; + // printStatement(stmts1[i]); ! /* ! * Search for the index of the first statement having left.s as its ! * subject. Note that the object is NULL, so this should always ! * return a negative index which we then convert to the insert ! * position. The insert position is the first index at which a ! * matching statement would be found. We then scan statements from ! * that point. As soon as there is no match (and it may be that ! * there is no match even on the first statement tested) we break ! * out of the inner loop and continue with the outer loop. ! */ ! int j = Arrays.binarySearch(stmts1, new SPO(left.o, p, ! TripleStore.NULL), SPOComparator.INSTANCE); ! if (j < 0) { ! // Convert the position to obtain the insertion point. ! j = -j - 1; ! ! } ! ! // process only the stmts with left.s as their subject. ! for (; j < stmts1.length; j++) { ! if (left.o != stmts1[j].s) break; ! ! buffer.add(new SPO(left.s, p, stmts1[j].o)); + stats.numComputed++; + } } stats.computeTime += System.currentTimeMillis() - computeStart; Index: AbstractRuleRdfs2379.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf/AbstractRuleRdfs2379.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractRuleRdfs2379.java 13 Apr 2007 20:37:04 -0000 1.5 --- AbstractRuleRdfs2379.java 14 Apr 2007 13:33:52 -0000 1.6 *************** *** 47,51 **** import com.bigdata.rdf.KeyOrder; - import com.bigdata.rdf.TempTripleStore; public abstract class AbstractRuleRdfs2379 extends AbstractRuleRdf { --- 47,50 ---- *************** *** 61,65 **** } ! public Stats apply( final Stats stats, final SPO[] buffer, TempTripleStore tmpStore ) { final long computeStart = System.currentTimeMillis(); --- 60,64 ---- } ! public Stats apply( final Stats stats, final SPOBuffer buffer) { final long computeStart = System.currentTimeMillis(); *************** *** 69,74 **** stats.stmts1 += stmts1.length; - int n = 0; - for (int i = 0; i < stmts1.length; i++) { --- 68,71 ---- *************** *** 79,91 **** for (int j = 0; j < stmts2.length; j++) { ! buffer[n++] = buildStmt3(stmts1[i], stmts2[j]); ! ! if (n == buffer.length) { ! ! insertStatements(buffer, n, tmpStore); ! ! n = 0; ! ! } stats.numComputed++; --- 76,80 ---- for (int j = 0; j < stmts2.length; j++) { ! buffer.add(buildStmt3(stmts1[i], stmts2[j])); stats.numComputed++; *************** *** 95,100 **** } - insertStatements(buffer, n, tmpStore); - stats.computeTime += System.currentTimeMillis() - computeStart; --- 84,87 ---- Index: RuleRdf01.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf/RuleRdf01.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RuleRdf01.java 13 Apr 2007 20:37:04 -0000 1.7 --- RuleRdf01.java 14 Apr 2007 13:33:51 -0000 1.8 *************** *** 46,50 **** import com.bigdata.btree.IEntryIterator; import com.bigdata.rdf.KeyOrder; - import com.bigdata.rdf.TempTripleStore; --- 46,49 ---- *************** *** 60,64 **** } ! public Stats apply( final Stats stats, final SPO[] buffer, TempTripleStore btree ) { final long computeStart = System.currentTimeMillis(); --- 59,63 ---- } ! public Stats apply( final Stats stats, final SPOBuffer buffer ) { final long computeStart = System.currentTimeMillis(); *************** *** 66,71 **** long lastP = -1; - int n = 0; - IEntryIterator it = store.getPOSIndex().rangeIterator(null,null); --- 65,68 ---- *************** *** 82,95 **** lastP = stmt.p; ! buffer[n++] = new SPO(stmt.p, store.rdfType.id, ! store.rdfProperty.id); ! ! if (n == buffer.length) { ! ! insertStatements(buffer, n, btree); ! ! n = 0; ! ! } stats.numComputed++; --- 79,84 ---- lastP = stmt.p; ! buffer.add(new SPO(stmt.p, store.rdfType.id, ! store.rdfProperty.id)); stats.numComputed++; *************** *** 99,104 **** } - insertStatements( buffer, n, btree ); - stats.computeTime += System.currentTimeMillis() - computeStart; --- 88,91 ---- Index: SPO.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf/SPO.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SPO.java 26 Jan 2007 20:51:25 -0000 1.2 --- SPO.java 14 Apr 2007 13:33:52 -0000 1.3 *************** *** 46,49 **** --- 46,50 ---- import com.bigdata.rdf.KeyOrder; import com.bigdata.rdf.RdfKeyBuilder; + import com.bigdata.rdf.TripleStore; /** *************** *** 129,131 **** --- 130,232 ---- } + /** + * The #of times this SPO is encountered in an {@link SPOBuffer}. + * + * @todo drop this field if making {@link SPO}s distinct in the + * {@link SPOBuffer} does not prove cost effective. + */ + int count = 0; + + // private int hashCode = 0; + // + // /** + // * @todo validate the manner in which we are combining the hash codes for + // * the individual components of the triple (each component uses the + // * same hash code algorithm as {@link Long#hashCode()}). + // */ + // public int hashCode() { + // + // if(hashCode==0) { + // + // // compute and cache. + // hashCode = (int) ((s ^ (s >>> 32)) | (p ^ (p >>> 32)) | (o ^ (o >>> 32))); + // + // } + // + // return hashCode; + // + // } + + /** + * Imposes s:p:o ordering based on termIds. + */ + public int compareTo(Object other) { + + if (other == this) { + + return 0; + + } + + final SPO stmt1 = this; + + final SPO stmt2 = (SPO) other; + + /* + * Note: logic avoids possible overflow of [long] by not computing the + * difference between two longs. + */ + int ret; + + ret = stmt1.code - stmt2.code; + + if (ret == 0) { + + ret = stmt1.s < stmt2.s ? -1 : stmt1.s > stmt2.s ? 1 : 0; + + if (ret == 0) { + + ret = stmt1.p < stmt2.p ? -1 : stmt1.p > stmt2.p ? 1 : 0; + + if (ret == 0) { + + ret = stmt1.o < stmt2.o ? -1 : stmt1.o > stmt2.o ? 1 : 0; + + } + + } + + } + + return ret; + + } + + /** + * True iff the statements are the same object or if they have the code and + * the same same term identifiers assigned for the subject, predicate and + * object positions. + */ + public boolean equals(SPO stmt2) { + + if (stmt2 == this) + return true; + + return this.code == stmt2.code && this.s == stmt2.s + && this.p == stmt2.p && this.o == stmt2.o; + + } + + /** + * Return a representation of the statement using the term identifiers (the + * identifers are NOT resolved to terms). + * + * @see TripleStore#toString(long, long, long) + */ + public String toString() { + + return (""+s+","+p+","+o); + + } + } --- NEW FILE: SPOBuffer.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 java.util.HashMap; import java.util.Map; import com.bigdata.rdf.TempTripleStore; import com.bigdata.rdf.TripleStore; import com.bigdata.rdf.rio.Buffer; /** * A buffer for distinct {@link SPO}s. * * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ */ public class SPOBuffer { /** * The array in which the statements are stored. */ final private SPO[] stmts; /** * The #of statements currently in the buffer. */ private int numStmts; /** * Map used to filter out duplicate statements. */ final private Map<SPO,SPO> distinctStmtMap; /** * The backing store into which the statements are added when the buffer * overflows. */ protected final TempTripleStore store; /** * The buffer capacity -or- <code>-1</code> if the {@link Buffer} object * is signaling that no more buffers will be placed onto the queue by the * producer and that the consumer should therefore terminate. */ protected final int capacity; /** * When true only distinct statements are stored in the buffer. */ protected final boolean distinct; /** * Create a buffer. * * @param store * The database into which the terms and statements will be * inserted. * @param capacity * The maximum #of Statements, URIs, Literals, or BNodes that the * buffer can hold. * @param distinct * When true only distinct terms and statements are stored in the * buffer. */ public SPOBuffer(TempTripleStore store, int capacity, boolean distinct) { this.store = store; this.capacity = capacity; this.distinct = distinct; if (capacity == -1) { stmts = null; distinctStmtMap = null; return; } else { stmts = new SPO[capacity]; if (distinct) { distinctStmtMap = new HashMap<SPO, SPO>(capacity); } else { distinctStmtMap = null; } } } /** * Returns true there are no slots remaining in the statements array. Under * those conditions adding another statement to the buffer could cause an * overflow. * * @return True if the buffer might overflow if another statement were * added. */ final private boolean nearCapacity() { if (numStmts + 1 > capacity) return true; return false; } /** * Uniquify a statement. * * @param stmt * * @return Either the statement or the pre-existing statement in the buffer * with the same data. */ protected SPO getDistinctStatement(SPO stmt) { assert distinct == true; SPO existingStmt = distinctStmtMap.get(stmt); if (existingStmt != null) { // return the pre-existing statement. return existingStmt; } else { // put the new statement in the map. if (distinctStmtMap.put(stmt, stmt) != null) { throw new AssertionError(); } // return the new statement. return stmt; } } /** * Flush any buffer statements to the backing store. */ public void flush() { if (numStmts > 0) overflow(); } private void overflow() { /* * batch insert statements into the store. */ store.addStatements(stmts, numStmts); /* * reset the buffer. */ numStmts = 0; if(distinctStmtMap!=null) { distinctStmtMap.clear(); } } /** * Adds the statement into the buffer. When the buffer is * {@link #nearCapacity()} the statements in the buffer will be flushed into * the backing store. * * @param stmt * The statement. * * @see #nearCapacity() */ public void add( SPO stmt ) { if(nearCapacity()) { overflow(); } if(distinct) { SPO tmp = getDistinctStatement(stmt); if(tmp.count++ == 0){ stmts[numStmts++] = tmp; } } else { stmts[numStmts++] = stmt; } } /** * Dumps the state of the buffer on {@link System#err}. * * @param store * The terms in the statements are resolved against this store. */ public void dump(InferenceEngine store) { System.err.println("capacity="+capacity); System.err.println("numStmts="+numStmts); if(distinct) { System.err.println("#distinct="+distinctStmtMap.size()); } for (int i = 0; i < numStmts; i++) { SPO stmt = stmts[i]; System.err.println("#" + i + "\t" + store.toString(stmt.s, stmt.p, stmt.o)); } } } Index: Rule.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf/Rule.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Rule.java 13 Apr 2007 20:37:04 -0000 1.5 --- Rule.java 14 Apr 2007 13:33:51 -0000 1.6 *************** *** 44,47 **** --- 44,48 ---- package com.bigdata.rdf.inf; + import com.bigdata.btree.BTree; import com.bigdata.rdf.TempTripleStore; *************** *** 102,105 **** --- 103,110 ---- * Apply the rule, creating entailments that are inserted into the temporary * store. + * <p> + * Note: the {@link BTree} class is NOT safe for concurrent modification + * under traversal so implementations of this method need to buffer the + * statements that they will insert. See {@link SPOBuffer} * * @param stats *************** *** 107,113 **** * @param buffer * Used to buffer entailments so that we can perform batch btree ! * operations. ! * @param tmpStore ! * The temporary store into which the entailments are placed. * * @return The statistics object. --- 112,117 ---- * @param buffer * Used to buffer entailments so that we can perform batch btree ! * operations. Entailments are batch inserted into the backing ! * store (for the buffer) when the buffer overflows. * * @return The statistics object. *************** *** 120,128 **** * operation variant for insert. * - * @todo the btree class is NOT safe for concurrent modification under - * traversal so implementations of this method need to bufferQueue the - * statements that they will insert. */ ! public abstract Stats apply( final Stats stats, final SPO[] buffer, TempTripleStore tmpStore ); /** --- 124,129 ---- * operation variant for insert. * */ ! public abstract Stats apply( final Stats stats, final SPOBuffer buffer ); /** Index: AbstractRuleRdf.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf/AbstractRuleRdf.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractRuleRdf.java 13 Apr 2007 20:37:04 -0000 1.7 --- AbstractRuleRdf.java 14 Apr 2007 13:33:51 -0000 1.8 *************** *** 44,53 **** package com.bigdata.rdf.inf; - import java.util.Arrays; - import org.openrdf.model.URI; import com.bigdata.btree.IIndex; - import com.bigdata.rdf.TempTripleStore; public abstract class AbstractRuleRdf extends Rule { --- 44,50 ---- *************** *** 59,114 **** } - /** - * Copies the entailments from the array into the {@link TempTripleStore}. - * - * @param stmts - * The source statements. - * - * @param n - * The #of statements in the buffer. - * - * @param store - * The target store. - */ - protected void insertStatements(SPO[] stmts, int n, TempTripleStore store) { - - // deal with the SPO index - IIndex spo = store.getSPOIndex(); - Arrays.sort(stmts,0,n,SPOComparator.INSTANCE); - for ( int i = 0; i < n; i++ ) { - byte[] key = store.keyBuilder.statement2Key - ( stmts[i].s, stmts[i].p, stmts[i].o - ); - if ( !spo.contains(key) ) { - spo.insert(key, null); - } - } - - // deal with the POS index - IIndex pos = store.getPOSIndex(); - Arrays.sort(stmts,0,n,POSComparator.INSTANCE); - for ( int i = 0; i < n; i++ ) { - byte[] key = store.keyBuilder.statement2Key - ( stmts[i].p, stmts[i].o, stmts[i].s - ); - if ( !pos.contains(key) ) { - pos.insert(key, null); - } - } - - // deal with the OSP index - IIndex osp = store.getOSPIndex(); - Arrays.sort(stmts,0,n,OSPComparator.INSTANCE); - for ( int i = 0; i < n; i++ ) { - byte[] key = store.keyBuilder.statement2Key - ( stmts[i].o, stmts[i].s, stmts[i].p - ); - if ( !osp.contains(key) ) { - osp.insert(key, null); - } - } - - } - // /** // * Copies the statements into the primary store. --- 56,59 ---- *************** *** 174,197 **** // } - protected void printStatement( SPO stmt ) { - - IIndex ndx = store.getIdTermIndex(); - - URI s = (URI) ndx.lookup(store.keyBuilder.id2key(stmt.s)); - - URI p = (URI) ndx.lookup(store.keyBuilder.id2key(stmt.p)); - - URI o = (URI) ndx.lookup(store.keyBuilder.id2key(stmt.o)); - - System.err.println(abbrev(s)+","+abbrev(p)+","+abbrev(o)); - - } - - protected String abbrev( URI uri ) { - - return uri.getURI().substring(uri.getURI().lastIndexOf('#')); - - } - // protected TempTripleStore convert( SPO[] stmts ) { // --- 119,122 ---- Index: RuleRdfs11.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf/RuleRdfs11.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RuleRdfs11.java 31 Jan 2007 05:23:20 -0000 1.3 --- RuleRdfs11.java 14 Apr 2007 13:33:51 -0000 1.4 *************** *** 52,56 **** * triple(?u,rdfs:subClassOf,?x) :- * triple(?u,rdfs:subClassOf,?v), ! * triple(?v,rdf:subClassOf,?x). * </pre> */ --- 52,56 ---- * triple(?u,rdfs:subClassOf,?x) :- * triple(?u,rdfs:subClassOf,?v), ! * triple(?v,rdfs:subClassOf,?x). * </pre> */ Index: AbstractRuleRdfs68101213.java =================================================================== RCS file: /cvsroot/cweb/bigdata-rdf/src/java/com/bigdata/rdf/inf/AbstractRuleRdfs68101213.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractRuleRdfs68101213.java 13 Apr 2007 20:37:04 -0000 1.7 --- AbstractRuleRdfs68101213.java 14 Apr 2007 13:33:52 -0000 1.8 *************** *** 46,50 **** import com.bigdata.btree.IEntryIterator; import com.bigdata.rdf.KeyOrder; - import com.bigdata.rdf.TempTripleStore; --- 46,49 ---- *************** *** 61,65 **** } ! public Stats apply( final Stats stats, final SPO[] buffer, TempTripleStore tmpStore ) { final long computeStart = System.currentTimeMillis(); --- 60,64 ---- } ! public Stats apply( final Stats stats, final SPOBuffer buffer) { final long computeStart = System.currentTimeMillis(); *************** *** 90,102 **** long _o = head.o.isVar() ? stmt.s : head.o.id; ! buffer[n++] = new SPO(_s, _p, _o); ! ! if (n == buffer.length) { ! ! insertStatements(buffer, n, tmpStore); ! ! n = 0; ! ! } stats.numComputed++; --- 89,93 ---- long _o = head.o.isVar() ? stmt.s : head.o.id; ! buffer.add( new SPO(_s, _p, _o) ); stats.numComputed++; *************** *** 104,109 **** } - insertStatements( buffer, n, tmpStore ); - stats.computeTime += System.currentTimeMillis() - computeStart; --- 95,98 ---- |