|
From: <mrp...@us...> - 2014-05-16 18:36:37
|
Revision: 8348
http://sourceforge.net/p/bigdata/code/8348
Author: mrpersonick
Date: 2014-05-16 18:36:34 +0000 (Fri, 16 May 2014)
Log Message:
-----------
fixed some Blueprints CI errors related to the 2.5.0 upgrade
Modified Paths:
--------------
branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java
branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphClient.java
branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataRDFFactory.java
branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/TestBigdataGraphEmbedded.java
branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/remote/BigdataSailRemoteRepositoryConnection.java
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java 2014-05-16 14:59:23 UTC (rev 8347)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraph.java 2014-05-16 18:36:34 UTC (rev 8348)
@@ -144,9 +144,11 @@
return null;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -192,9 +194,11 @@
return props;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -233,9 +237,11 @@
return properties;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -297,9 +303,11 @@
cxn().add(uri, prop, val);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -325,6 +333,8 @@
cxn().add(uri, prop, val);
+ } catch (RuntimeException e) {
+ throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -384,9 +394,11 @@
return new BigdataEdge(new StatementImpl(fromURI, edgeURI, toURI), this);
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -412,9 +424,11 @@
return new BigdataVertex(uri, this);
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -449,9 +463,11 @@
return null;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -539,8 +555,10 @@
return stmts;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
}
@@ -564,9 +582,11 @@
return new EdgeIterable(stmts);
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -621,9 +641,11 @@
return new VertexIterable(stmts, subject);
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -656,9 +678,11 @@
return getEdges(queryStr);
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -681,9 +705,11 @@
return null;
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -701,9 +727,11 @@
return new VertexIterable(result, true);
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -723,9 +751,11 @@
return new VertexIterable(result, true);
- } catch (Exception ex) {
- throw new RuntimeException(ex);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -761,9 +791,11 @@
// remove its properties
cxn().remove(uri, wild, wild);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
@@ -789,7 +821,9 @@
// remove incoming edges
cxn().remove(wild, wild, uri);
- } catch (Exception e) {
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
throw new RuntimeException(e);
}
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphClient.java
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphClient.java 2014-05-16 14:59:23 UTC (rev 8347)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataGraphClient.java 2014-05-16 18:36:34 UTC (rev 8348)
@@ -29,19 +29,19 @@
/**
* This is a thin-client implementation of a Blueprints wrapper around the
- * client library that interacts with the NanoSparqlServer. This is a functional
+ * client library that interacts with the NanoSparqlServer. This is a functional
* implementation suitable for writing POCs - it is not a high performance
- * implementation by any means (currently does not support caching, batched
- * update, or Blueprints query re-writes). Does have a single "bulk upload"
- * operation that wraps a method on RemoteRepository that will POST a graphml
- * file to the blueprints layer of the bigdata server.
+ * implementation by any means (currently does not support caching or batched
+ * update). Does have a single "bulk upload" operation that wraps a method on
+ * RemoteRepository that will POST a graphml file to the blueprints layer of the
+ * bigdata server.
*
* @see {@link BigdataSailRemoteRepository}
* @see {@link BigdataSailRemoteRepositoryConnection}
* @see {@link RemoteRepository}
*
* @author mikepersonick
- *
+ *
*/
public class BigdataGraphClient extends BigdataGraph {
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataRDFFactory.java
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataRDFFactory.java 2014-05-16 14:59:23 UTC (rev 8347)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/java/com/bigdata/blueprints/BigdataRDFFactory.java 2014-05-16 18:36:34 UTC (rev 8348)
@@ -30,6 +30,7 @@
import org.openrdf.model.URI;
import org.openrdf.model.ValueFactory;
import org.openrdf.model.impl.ValueFactoryImpl;
+import org.openrdf.model.vocabulary.RDFS;
import com.bigdata.rdf.internal.XSD;
import com.tinkerpop.blueprints.Edge;
@@ -138,7 +139,19 @@
try {
- return vf.createURI(GRAPH_NAMESPACE, URLEncoder.encode(property, "UTF-8"));
+ if (property.equals("label")) {
+
+ /*
+ * Label is a reserved property for edge labels, we use
+ * rdfs:label for that.
+ */
+ return RDFS.LABEL;
+
+ } else {
+
+ return vf.createURI(GRAPH_NAMESPACE, URLEncoder.encode(property, "UTF-8"));
+
+ }
} catch (UnsupportedEncodingException e) {
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/TestBigdataGraphEmbedded.java
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/TestBigdataGraphEmbedded.java 2014-05-16 14:59:23 UTC (rev 8347)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-blueprints/src/test/com/bigdata/blueprints/TestBigdataGraphEmbedded.java 2014-05-16 18:36:34 UTC (rev 8348)
@@ -68,7 +68,8 @@
test.doTestSuite(new TransactionalGraphTestSuite(test));
GraphTest.printTestPerformance("TransactionalGraphTestSuite",
test.stopWatch());
- }
+ }
+
// public void testGraphSuite() throws Exception {
// final GraphTest test = newBigdataGraphTest();
// test.stopWatch();
@@ -77,12 +78,12 @@
//}
-// public void testTransactionIsolationCommitCheck() throws Exception {
+// public void testGetEdgesByLabel() throws Exception {
// final BigdataGraphTest test = new BigdataGraphTest();
// test.stopWatch();
// final BigdataTestSuite testSuite = new BigdataTestSuite(test);
// try {
-// testSuite.testTransactionIsolationCommitCheck();
+// testSuite.testGetEdgesByLabel();
// } finally {
// test.shutdown();
// }
@@ -95,71 +96,25 @@
super(graphTest);
}
- public void testTransactionIsolationCommitCheck() throws Exception {
- // the purpose of this test is to simulate rexster access to a graph instance, where one thread modifies
- // the graph and a separate thread cannot affect the transaction of the first
- final TransactionalGraph graph = (TransactionalGraph) graphTest.generateGraph();
-
- final CountDownLatch latchCommittedInOtherThread = new CountDownLatch(1);
- final CountDownLatch latchCommitInOtherThread = new CountDownLatch(1);
-
- // this thread starts a transaction then waits while the second thread tries to commit it.
- final Thread threadTxStarter = new Thread() {
- public void run() {
- System.err.println(Thread.currentThread().getId() + ": 1");
- final Vertex v = graph.addVertex(null);
-
- // System.out.println("added vertex");
-
- System.err.println(Thread.currentThread().getId() + ": 2");
- latchCommitInOtherThread.countDown();
-
- System.err.println(Thread.currentThread().getId() + ": 3");
- try {
- latchCommittedInOtherThread.await();
- } catch (InterruptedException ie) {
- throw new RuntimeException(ie);
- }
-
- System.err.println(Thread.currentThread().getId() + ": 4");
- graph.rollback();
-
- System.err.println(Thread.currentThread().getId() + ": 5");
- // there should be no vertices here
- // System.out.println("reading vertex before tx");
- assertFalse(graph.getVertices().iterator().hasNext());
- // System.out.println("read vertex before tx");
- }
- };
-
- threadTxStarter.start();
-
- // this thread tries to commit the transaction started in the first thread above.
- final Thread threadTryCommitTx = new Thread() {
- public void run() {
- System.err.println(Thread.currentThread().getId() + ": 6");
- try {
- latchCommitInOtherThread.await();
- } catch (InterruptedException ie) {
- throw new RuntimeException(ie);
- }
-
- System.err.println(Thread.currentThread().getId() + ": 7");
- // try to commit the other transaction
- graph.commit();
-
- System.err.println(Thread.currentThread().getId() + ": 8");
- latchCommittedInOtherThread.countDown();
- System.err.println(Thread.currentThread().getId() + ": 9");
- }
- };
-
- threadTryCommitTx.start();
-
- threadTxStarter.join();
- threadTryCommitTx.join();
- graph.shutdown();
-
+ public void testGetEdgesByLabel() {
+ Graph graph = graphTest.generateGraph();
+ if (graph.getFeatures().supportsEdgeIteration) {
+ Vertex v1 = graph.addVertex(null);
+ Vertex v2 = graph.addVertex(null);
+ Vertex v3 = graph.addVertex(null);
+
+ Edge e1 = graph.addEdge(null, v1, v2, graphTest.convertLabel("test1"));
+ Edge e2 = graph.addEdge(null, v2, v3, graphTest.convertLabel("test2"));
+ Edge e3 = graph.addEdge(null, v3, v1, graphTest.convertLabel("test3"));
+
+ assertEquals(e1, getOnlyElement(graph.query().has("label", graphTest.convertLabel("test1")).edges()));
+ assertEquals(e2, getOnlyElement(graph.query().has("label", graphTest.convertLabel("test2")).edges()));
+ assertEquals(e3, getOnlyElement(graph.query().has("label", graphTest.convertLabel("test3")).edges()));
+
+ assertEquals(e1, getOnlyElement(graph.getEdges("label", graphTest.convertLabel("test1"))));
+ assertEquals(e2, getOnlyElement(graph.getEdges("label", graphTest.convertLabel("test2"))));
+ assertEquals(e3, getOnlyElement(graph.getEdges("label", graphTest.convertLabel("test3"))));
+ }
}
@@ -173,6 +128,7 @@
private class BigdataGraphTest extends GraphTest {
private List<String> exclude = Arrays.asList(new String[] {
+ // this one creates a deadlock, no way around it
"testTransactionIsolationCommitCheck"
});
Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/remote/BigdataSailRemoteRepositoryConnection.java
===================================================================
--- branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/remote/BigdataSailRemoteRepositoryConnection.java 2014-05-16 14:59:23 UTC (rev 8347)
+++ branches/BIGDATA_RELEASE_1_3_0/bigdata-sails/src/java/com/bigdata/rdf/sail/remote/BigdataSailRemoteRepositoryConnection.java 2014-05-16 18:36:34 UTC (rev 8348)
@@ -646,7 +646,7 @@
public void add(final Statement stmt, final Resource... c)
throws RepositoryException {
- log.warn("single statement updates not recommended");
+// log.warn("single statement updates not recommended");
final Graph g = new GraphImpl();
g.add(stmt);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|