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 2022/10/06 09:36:37 UTC

[GitHub] [jena] Aklakan commented on a diff in pull request #1558: GH-1557: Allow access to additional information from DynamicDataset

Aklakan commented on code in PR #1558:
URL: https://github.com/apache/jena/pull/1558#discussion_r988814930


##########
jena-arq/src/main/java/org/apache/jena/sparql/core/DynamicDatasets.java:
##########
@@ -116,7 +117,30 @@ public static class DynamicDatasetGraph extends DatasetGraphReadOnly implements
 
         public DynamicDatasetGraph(DatasetGraph viewDSG, DatasetGraph baseDSG) {
             super(viewDSG, baseDSG.getContext().copy());
-            this.projected = baseDSG;
+            this.projected = Objects.requireNonNull(baseDSG);
+        }
+
+        /** Returns the original dataset graph this DynamicDatasetGraph is based on. Never null. */
+        public DatasetGraph getProjected() {
+            return projected;
+        }
+
+        /** Returns the collection of default graphs this DynamicDatasetGraph is based on. Null if unknown.
+         * @implNote This method returns the context's value for {@link ARQConstants#symDatasetDefaultGraphs}. */
+        public Collection<Node> getDefaultGraphs() {
+            return getContext().get(ARQConstants.symDatasetDefaultGraphs);
+        }
+
+        /** Returns the collection of named graphs this DynamicDatasetGraph is based on. Null if unknown.
+         * @implNote This method returns the context's value for {@link ARQConstants#symDatasetNamedGraphs}. */
+        public Collection<Node> getNamedGraphs() {
+            return getContext().get(ARQConstants.symDatasetNamedGraphs);
+        }
+
+        /** True iff {@link #getDefaultGraphs()} and {@link #getNamedGraphs()} both
+         * return non-null results. */
+        public boolean hasDatasetDescription() {

Review Comment:
   The rationale is that this is the test for whether the DynamicDataset in unwrappable. 
   Because the getters depend on the context attributes (they could also be stored as fields) it is possible to unset them from the outside - in this case the DynamicDataset getters return null which means that it is not un-wrappable.



-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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