You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2019/02/26 21:51:26 UTC

[jena] branch master updated (d5545fe -> c7bafa4)

This is an automated email from the ASF dual-hosted git repository.

andy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/jena.git.


    from d5545fe  Merge pull request #535 from afs/tdb2-xsd_float
     new 5d0c85a  Exception on promote-READ: Implement according to the documentation.
     new c7bafa4  Make deleteAny algorithm publicly available.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/jena/sparql/core/DatasetGraphBase.java  | 13 ++++++++-----
 .../java/org/apache/jena/sparql/core/Transactional.java     |  4 ++--
 2 files changed, 10 insertions(+), 7 deletions(-)


[jena] 02/02: Make deleteAny algorithm publicly available.

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jena.git

commit c7bafa4556392699f212f36157da07615a1ff3c5
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Tue Feb 26 21:50:19 2019 +0000

    Make deleteAny algorithm publicly available.
---
 .../java/org/apache/jena/sparql/core/DatasetGraphBase.java  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphBase.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphBase.java
index ed120b9..9b4f4e5 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphBase.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphBase.java
@@ -101,16 +101,19 @@ abstract public class DatasetGraphBase implements DatasetGraph
     @Override
     public void delete(Node g, Node s, Node p, Node o)  { delete(new Quad(g,s,p,o)) ; }
     
-    private static final int DeleteBufferSize = 1000 ;
     @Override
     /** Simple implementation but done without assuming iterator.remove() */
     public void deleteAny(Node g, Node s, Node p, Node o) {
-        // Delete in slices rather than assume .remove() on the iterator is
-        // implemented.
+        deleteAny(this, g, s, p, o);
+    }
+    
+    private static final int DeleteBufferSize = 1000 ;
+    public static void deleteAny(DatasetGraph dsg, Node g, Node s, Node p, Node o) {
+        // Delete in slices rather than assume .remove() on the iterator is implemented.
         // We keep executing find(g, s, p, o) until we don't get a full slice.
         Quad[] buffer = new Quad[DeleteBufferSize];
         while (true) {
-            Iterator<Quad> iter = find(g, s, p, o);
+            Iterator<Quad> iter = dsg.find(g, s, p, o);
             // Get a slice
             int len = 0;
             for ( ; len < DeleteBufferSize ; len++ ) {
@@ -120,7 +123,7 @@ abstract public class DatasetGraphBase implements DatasetGraph
             }
             // Delete them.
             for ( int i = 0 ; i < len ; i++ ) {
-                delete(buffer[i]);
+                dsg.delete(buffer[i]);
                 buffer[i] = null;
             }
             // Finished?


[jena] 01/02: Exception on promote-READ: Implement according to the documentation.

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 5d0c85a5733596f8d17b1ce98861f2df032c9b9b
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Tue Feb 26 21:49:33 2019 +0000

    Exception on promote-READ: Implement according to the documentation.
---
 jena-arq/src/main/java/org/apache/jena/sparql/core/Transactional.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/Transactional.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/Transactional.java
index d87460a..f280aa7 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/Transactional.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/Transactional.java
@@ -127,7 +127,7 @@ public interface Transactional
      * transaction is still valid and in "read" mode. Any further calls to
      * {@code promote()} will also return false.
      * <p>
-     * This method throws an exception if there is an attempt to promote a "READ"
+     * This method throws a {@link JenaTransactionException} exception if there is an attempt to promote a "READ"
      * transaction.
      */
     public default boolean promote() {
@@ -138,7 +138,7 @@ public interface Transactional
             throw new JenaTransactionException("txnType");
         switch(txnType) {
             case WRITE :                  return true;
-            case READ :                   return false;
+            case READ :                   throw new JenaTransactionException("Attempt to promote a READ transaction");
             case READ_PROMOTE :           return promote(Promote.ISOLATED);
             case READ_COMMITTED_PROMOTE : return promote(Promote.READ_COMMITTED);
         }