You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2020/03/11 13:01:14 UTC

[GitHub] [jena] afs opened a new pull request #707: JENA-1857: DatasetGraphInMemory.size.

afs opened a new pull request #707: JENA-1857: DatasetGraphInMemory.size.
URL: https://github.com/apache/jena/pull/707
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] afs commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.

Posted by GitBox <gi...@apache.org>.
afs commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.
URL: https://github.com/apache/jena/pull/707#discussion_r391733804
 
 

 ##########
 File path: jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java
 ##########
 @@ -400,7 +400,9 @@ public DatasetPrefixStorage prefixes() {
 
     @Override
     public long size() {
-        return quadsIndex().listGraphNodes().count() ;
+        return isInTransaction() 
+                ? quadsIndex().listGraphNodes().count()
+                : calculateRead(this, ()->quadsIndex().listGraphNodes().count());
 
 Review comment:
   `access` returns `Iterator<T>`.
   
   I had tried `quadsIndex().listGraphNodes()::count` -- it does not work.
   
   It is different because is `quadsIndex().listGraphNodes()` is called as a plain argument (i.e. early), the method pointer calculated with `::count` and that passed in so only `count()` is delayed to inside the R transaction.
   
   `()->quadsIndex().listGraphNodes().count()` delays calling `quadsIndex().listGraphNodes()` to inside the R transaction and `listGraphNodes()` is the critical step.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] ajs6f commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.

Posted by GitBox <gi...@apache.org>.
ajs6f commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.
URL: https://github.com/apache/jena/pull/707#discussion_r391773099
 
 

 ##########
 File path: jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java
 ##########
 @@ -400,7 +400,9 @@ public DatasetPrefixStorage prefixes() {
 
     @Override
     public long size() {
-        return quadsIndex().listGraphNodes().count() ;
+        return isInTransaction() 
+                ? quadsIndex().listGraphNodes().count()
+                : calculateRead(this, ()->quadsIndex().listGraphNodes().count());
 
 Review comment:
   Actually it turned out that there was no reason to restrict `access` to `Iterator<T>`, so I sent you a [PR](https://github.com/afs/jena/pull/5) to this branch to do that.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] afs commented on issue #707: JENA-1857: DatasetGraphInMemory.size.

Posted by GitBox <gi...@apache.org>.
afs commented on issue #707: JENA-1857: DatasetGraphInMemory.size.
URL: https://github.com/apache/jena/pull/707#issuecomment-597619538
 
 
   @ajs6f - Good news! 
   
   I think this is the only case of an "access" operation missing an in-transaction test.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] afs merged pull request #707: JENA-1857: DatasetGraphInMemory.size.

Posted by GitBox <gi...@apache.org>.
afs merged pull request #707: JENA-1857: DatasetGraphInMemory.size.
URL: https://github.com/apache/jena/pull/707
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] ajs6f commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.

Posted by GitBox <gi...@apache.org>.
ajs6f commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.
URL: https://github.com/apache/jena/pull/707#discussion_r391741650
 
 

 ##########
 File path: jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java
 ##########
 @@ -400,7 +400,9 @@ public DatasetPrefixStorage prefixes() {
 
     @Override
     public long size() {
-        return quadsIndex().listGraphNodes().count() ;
+        return isInTransaction() 
+                ? quadsIndex().listGraphNodes().count()
+                : calculateRead(this, ()->quadsIndex().listGraphNodes().count());
 
 Review comment:
   Ah, I see. Let's merge this and I will see if anything further is worth doing when I look at 1859.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] ajs6f commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.

Posted by GitBox <gi...@apache.org>.
ajs6f commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.
URL: https://github.com/apache/jena/pull/707#discussion_r391703097
 
 

 ##########
 File path: jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java
 ##########
 @@ -400,7 +400,9 @@ public DatasetPrefixStorage prefixes() {
 
     @Override
     public long size() {
-        return quadsIndex().listGraphNodes().count() ;
+        return isInTransaction() 
+                ? quadsIndex().listGraphNodes().count()
+                : calculateRead(this, ()->quadsIndex().listGraphNodes().count());
 
 Review comment:
   I just realized I have this code already in here, so you need only:
   ```
   return access(quadsIndex().listGraphNodes()::count);
   ```
   which should match the other usage.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org


[GitHub] [jena] ajs6f commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.

Posted by GitBox <gi...@apache.org>.
ajs6f commented on a change in pull request #707: JENA-1857: DatasetGraphInMemory.size.
URL: https://github.com/apache/jena/pull/707#discussion_r391703097
 
 

 ##########
 File path: jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java
 ##########
 @@ -400,7 +400,9 @@ public DatasetPrefixStorage prefixes() {
 
     @Override
     public long size() {
-        return quadsIndex().listGraphNodes().count() ;
+        return isInTransaction() 
+                ? quadsIndex().listGraphNodes().count()
+                : calculateRead(this, ()->quadsIndex().listGraphNodes().count());
 
 Review comment:
   ```suggestion
                   : calculateRead(this, quadsIndex().listGraphNodes()::count);
   ```
   
   I just have a thing for point-free! :man_shrugging: 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org