From: <mrp...@us...> - 2013-12-17 01:00:24
|
Revision: 7666 http://bigdata.svn.sourceforge.net/bigdata/?rev=7666&view=rev Author: mrpersonick Date: 2013-12-17 01:00:14 +0000 (Tue, 17 Dec 2013) Log Message: ----------- rolling back RDR changes in advance of the 1.3.0 release Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/QueryHints.java branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/rio/TestStatementBuffer.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java 2013-12-16 20:05:18 UTC (rev 7665) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/rio/StatementBuffer.java 2013-12-17 01:00:14 UTC (rev 7666) @@ -27,11 +27,9 @@ package com.bigdata.rdf.rio; -import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedList; import java.util.Map; import java.util.Set; @@ -41,13 +39,11 @@ import org.openrdf.model.Statement; import org.openrdf.model.URI; import org.openrdf.model.Value; -import org.semanticweb.yars.nx.namespace.RDF; import com.bigdata.rdf.changesets.ChangeAction; import com.bigdata.rdf.changesets.ChangeRecord; import com.bigdata.rdf.changesets.IChangeLog; import com.bigdata.rdf.internal.IV; -import com.bigdata.rdf.internal.impl.bnode.SidIV; import com.bigdata.rdf.model.BigdataBNode; import com.bigdata.rdf.model.BigdataBNodeImpl; import com.bigdata.rdf.model.BigdataResource; @@ -155,14 +151,6 @@ * the canonicalizing {@link #bnodes} mapping. */ private Set<BigdataStatement> deferredStmts; - - /** - * RDR statements. Map to a bnode used in other statements. Need to defer - * both the reified statement (since it comes in piecemeal) and the - * statements about it (since we need to make sure the ground version is - * present). - */ - private Map<BigdataBNodeImpl, ReifiedStmt> reifiedStmts; /** * <code>true</code> if statement identifiers are enabled. @@ -370,7 +358,7 @@ log.info("capacity=" + capacity + ", sids=" + statementIdentifiers + ", statementStore=" + statementStore + ", database=" - + database + ", arity=" + arity); + + database); } @@ -457,63 +445,13 @@ log.info("processing " + deferredStmts.size() + " deferred statements"); - /* - * Need to flush the terms out to the dictionary or the reification - * process will not work correctly. - */ - incrementalWrite(); +// incrementalWrite(); try { // Note: temporary override - clear by finally{}. statementIdentifiers = false; - // stage 0 - if (reifiedStmts != null) { - - for (Map.Entry<BigdataBNodeImpl, ReifiedStmt> e : reifiedStmts.entrySet()) { - - final BigdataBNodeImpl sid = e.getKey(); - - final ReifiedStmt reifiedStmt = e.getValue(); - - if (!reifiedStmt.isFullyBound(arity)) { - - log.warn("unfinished reified stmt: " + reifiedStmt); - - continue; - - } - - final BigdataStatement stmt = valueFactory.createStatement( - reifiedStmt.getSubject(), - reifiedStmt.getPredicate(), - reifiedStmt.getObject(), - reifiedStmt.getContext(), - StatementEnum.Explicit); - - sid.setStatement(stmt); - - sid.setIV(new SidIV(new SPO(stmt))); - - if (log.isInfoEnabled()) { - log.info("reified sid conversion: sid=" + sid + ", stmt=" + stmt); - } - - } - - if (log.isInfoEnabled()) { - - for (BigdataBNodeImpl sid : reifiedStmts.keySet()) { - - log.info("sid: " + sid + ", iv=" + sid.getIV()); - - } - - } - - } - // stage 1. { @@ -527,10 +465,6 @@ final BigdataStatement stmt = itr.next(); - if (log.isDebugEnabled()) { - log.debug(stmt.getSubject() + ", sid=" + ((BigdataBNode) stmt.getSubject()).isStatementIdentifier() + ", iv=" + stmt.s()); - } - if (stmt.getSubject() instanceof BNode && ((BigdataBNode) stmt.getSubject()).isStatementIdentifier()) continue; @@ -586,10 +520,6 @@ final BigdataStatement stmt = itr.next(); - if (log.isDebugEnabled()) { - log.debug(stmt.getSubject() + ", iv=" + stmt.s()); - } - if (stmt.getSubject() instanceof BNode && ((BigdataBNode) stmt.getSubject()).isStatementIdentifier() && stmt.s() == null) @@ -641,14 +571,6 @@ if (nremaining > 0) { - if (log.isDebugEnabled()) { - - for (BigdataStatement s : deferredStmts) { - log.debug("could not ground: " + s); - } - - } - throw new StatementCyclesException( "" + nremaining + " statements can not be grounded"); @@ -665,8 +587,6 @@ deferredStmts = null; - reifiedStmts = null; - } } @@ -691,8 +611,6 @@ deferredStmts = null; - reifiedStmts = null; - } /** @@ -824,10 +742,6 @@ if (log.isInfoEnabled()) { log.info("writing " + numTerms); - - for (int i = 0; i < numTerms; i++) { - log.info("term: " + terms[i]); - } } @@ -999,13 +913,13 @@ if (c == null) continue; -// if (c instanceof URI) { -// -// throw new UnificationException( -// "URI not permitted in context position when statement identifiers are enabled: " -// + stmt); -// -// } + if (c instanceof URI) { + + throw new UnificationException( + "URI not permitted in context position when statement identifiers are enabled: " + + stmt); + + } if( c instanceof BNode) { @@ -1102,10 +1016,6 @@ log.info("writing " + numStmts + " on " + (statementStore != null ? "statementStore" : "database")); - - for (int i = 0; i < numStmts; i++) { - log.info("spo: " + stmts[i]); - } } @@ -1255,8 +1165,6 @@ protected void handleStatement(Resource s, URI p, Value o, Resource c, StatementEnum type) { -// if (arity == 3) c = null; - s = (Resource) valueFactory.asValue(s); p = (URI) valueFactory.asValue(p); o = valueFactory.asValue(o); @@ -1321,56 +1229,16 @@ * that it is being used as a statement identifier). */ - log.info(stmt); - - if (s instanceof BNode && - (RDF.SUBJECT.toString().equals(p.toString()) || RDF.PREDICATE.toString().equals(p.toString()) || RDF.OBJECT.toString().equals(p.toString())) || - (RDF.STATEMENT.toString().equals(o.toString()) && RDF.TYPE.toString().equals(p.toString()))) { - - if (!(RDF.STATEMENT.toString().equals(o.toString()) && RDF.TYPE.toString().equals(p.toString()))) { - - final BigdataBNodeImpl sid = (BigdataBNodeImpl) s; - - if (reifiedStmts == null) { - - reifiedStmts = new HashMap<BigdataBNodeImpl, ReifiedStmt>(); - - } - - final ReifiedStmt reifiedStmt; - if (reifiedStmts.containsKey(sid)) { - - reifiedStmt = reifiedStmts.get(sid); - - } else { - - reifiedStmt = new ReifiedStmt(); - - reifiedStmts.put(sid, reifiedStmt); - - } - - reifiedStmt.set(p, (BigdataValue) o); - - if (log.isDebugEnabled()) - log.debug("reified piece: "+stmt); - - } + if (deferredStmts == null) { - } else { - - if (deferredStmts == null) { - - deferredStmts = new HashSet<BigdataStatement>(stmts.length); - - } - - deferredStmts.add(stmt); - - if (log.isDebugEnabled()) - log.debug("deferred: "+stmt); - - } + deferredStmts = new HashSet<BigdataStatement>(stmts.length); + + } + + deferredStmts.add(stmt); + + if (log.isDebugEnabled()) + log.debug("deferred: "+stmt); } else { @@ -1491,94 +1359,5 @@ } } - - private static class ReifiedStmt implements Statement { - /** - * - */ - private static final long serialVersionUID = -7706421769807306702L; - - private BigdataResource s; - private BigdataURI p; - private BigdataValue o; - private BigdataResource c; - - public ReifiedStmt() { - } - - public boolean isFullyBound(final int arity) { - return s != null && p != null && o != null && (arity > 3 ? c != null : true); - } - - @Override - public BigdataResource getContext() { - return c; - } - - @Override - public BigdataValue getObject() { - return o; - } - - @Override - public BigdataURI getPredicate() { - return p; - } - - @Override - public BigdataResource getSubject() { - return s; - } - - public void set(final URI p, final BigdataValue o) { - - if (p.toString().equals(RDF.SUBJECT.toString())) { - - setSubject((BigdataResource) o); - - } else if (p.toString().equals(RDF.PREDICATE.toString())) { - - setPredicate((BigdataURI) o); - - } else if (p.toString().equals(RDF.OBJECT.toString())) { - - setObject(o); - -// } else if (p.equals(RDF.CONTEXT)) { -// -// setPredicate((URI) c); -// - } else { - - throw new IllegalArgumentException(); - - } - - } - - public void setSubject(final BigdataResource s) { - this.s = s; - } - - public void setPredicate(final BigdataURI p) { - this.p = p; - } - - public void setObject(final BigdataValue o) { - this.o = o; - } - - public void setContext(final BigdataResource c) { - this.c = c; - } - - public String toString() { - - return "<" + s + ", " + p + ", " + o + ", " + c + ">"; - - } - - } - } Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/QueryHints.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/QueryHints.java 2013-12-16 20:05:18 UTC (rev 7665) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/QueryHints.java 2013-12-17 01:00:14 UTC (rev 7666) @@ -459,7 +459,7 @@ */ String REIFICATION_DONE_RIGHT = "reificationDoneRight"; - boolean DEFAULT_REIFICATION_DONE_RIGHT = true; + boolean DEFAULT_REIFICATION_DONE_RIGHT = false; /** * Used to mark a predicate as "range safe" - that is, we can safely Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/rio/TestStatementBuffer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/rio/TestStatementBuffer.java 2013-12-16 20:05:18 UTC (rev 7665) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-rdf/src/test/com/bigdata/rdf/rio/TestStatementBuffer.java 2013-12-17 01:00:14 UTC (rev 7666) @@ -280,9 +280,6 @@ */ public void test_reificationDoneRight_disabled() { - if (QueryHints.DEFAULT_REIFICATION_DONE_RIGHT) - return; - final int capacity = 20; final Properties properties = new Properties(getProperties()); @@ -450,19 +447,6 @@ */ return; } - - if (!store.isStatementIdentifiers()) { - /** - * Disabled. FIXME This should be ON for TRIPLES or QUADS. It - * only works in the SIDS mode right now. The root cause is - * - * <pre> - * Caused by: java.lang.IllegalArgumentException: context bound, but not quads or sids: < TermId(7B), TermId(5U), com.bigdata.rdf.internal.impl.literal.LiteralExtensionIV@25889b2f, TermId(8B) : Explicit > - * at com.bigdata.rdf.spo.SPOIndexWriter.call(SPOIndexWriter.java:275) - * </pre> - */ - return; - } // * @prefix : <http://example.com/> . // * @prefix news: <http://example.com/news/> . @@ -516,10 +500,10 @@ // metadata statements. final BigdataStatement mds1 = vf.createStatement(s1, dcSource, - newsSybase, vf.createBNode(), StatementEnum.Explicit); + newsSybase, null/* context */, StatementEnum.Explicit); final BigdataStatement mds2 = vf.createStatement(s1, dcCreated, - createdDate, vf.createBNode(), StatementEnum.Explicit); + createdDate, null/* context */, StatementEnum.Explicit); buffer.add(mds1); @@ -566,17 +550,13 @@ assertEquals(sidIV1.getInlineValue().s(), mds1.s()); assertEquals(sidIV1.getInlineValue().p(), mds1.p()); assertEquals(sidIV1.getInlineValue().o(), mds1.o()); + assertNull(sidIV1.getInlineValue().c()); assertEquals(sidIV2.getInlineValue().s(), mds2.s()); assertEquals(sidIV2.getInlineValue().p(), mds2.p()); assertEquals(sidIV2.getInlineValue().o(), mds2.o()); + assertNull(sidIV2.getInlineValue().c()); - /* - * FIXME Implement quads mode RDR - */ -// assertNull(sidIV1.getInlineValue().c()); -// assertNull(sidIV2.getInlineValue().c()); - } finally { store.__tearDownUnitTest(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |