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/06/17 18:40:31 UTC

[GitHub] [jena] afs opened a new pull request, #1389: GH-1381: Default to property function transform being enabled

afs opened a new pull request, #1389:
URL: https://github.com/apache/jena/pull/1389

   GitHub issue resolved: #1381
   
   Pull request Description:
   
   Make the property function transformation on by default.
   
   
   ----
   
    - [ ] Tests are included.
    - [ ] Commits have been squashed to remove intermediate development commit messages.
    - [ ] Key commit messages start with the issue number (GH-xxxx or JENA-xxxx)
   
   By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the [Contributor's Agreement](https://www.apache.org/licenses/contributor-agreements.html).
   


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


[GitHub] [jena] afs merged pull request #1389: GH-1381: Default to property function transform being enabled

Posted by GitBox <gi...@apache.org>.
afs merged PR #1389:
URL: https://github.com/apache/jena/pull/1389


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


[GitHub] [jena] afs commented on a diff in pull request #1389: GH-1381: Default to property function transform being enabled

Posted by GitBox <gi...@apache.org>.
afs commented on code in PR #1389:
URL: https://github.com/apache/jena/pull/1389#discussion_r901108469


##########
jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformPropertyFunction.java:
##########
@@ -27,93 +27,75 @@
 import org.apache.jena.sparql.util.Context ;
 
 /** Rewrite to replace a property function property with the call to the property function implementation */
-public class TransformPropertyFunction extends TransformCopy
-{
-    private final Context context ;
-    private final boolean doingMagicProperties ;
-    private final PropertyFunctionRegistry registry ;
-    
-    /** Apply the property function transformation. 
-     *  <p>
-     *  The {@code context} provide the place to find the property function registry.
-     *  A custom one canbe supplied using 
-     *  {@link ARQConstants#registryPropertyFunctions}
-     *  <p>
-     *  See {@link PropertyFunctionRegistry#chooseRegistry} for the full decision process.
-     *  <p>
-     *  In addition, {@link ARQ#enablePropertyFunctions} must be true (this is the default). 
+public class TransformPropertyFunction extends TransformCopy {
+    private final Context context;
+    private final boolean doingPropertyFunctions;
+    private final PropertyFunctionRegistry registry;
+
+    /**
+     * Apply the property function transformation.
+     * <p>
+     * The {@code context} provides the place to find the property function registry.
+     * A custom one can be supplied using
+     * {@link ARQConstants#registryPropertyFunctions}
+     * <p>
+     * See {@link PropertyFunctionRegistry#chooseRegistry} for the full decision
+     * process.
+     * <p>
+     * If {@link ARQ#enablePropertyFunctions} is false, then property functions are
+     * not enabled and remain as plain triples. For example, this is set false by "strict mode"
      */
     public static Op transform(Op op, Context context) {
-        Transform t = new TransformPropertyFunction(context) ;
-        return Transformer.transform(t, op) ; 
+        Transform t = new TransformPropertyFunction(context);
+        return Transformer.transform(t, op);
     }
-    
-    public TransformPropertyFunction(Context context)
-    {
-        this.context = context ;  
-        doingMagicProperties = context.isTrue(ARQ.enablePropertyFunctions) ;
-        registry = PropertyFunctionRegistry.chooseRegistry(context) ;
+
+    public TransformPropertyFunction(Context context) {
+        this.context = context;
+        boolean enabled = context.isTrueOrUndef(ARQ.enablePropertyFunctions);
+        registry = PropertyFunctionRegistry.chooseRegistry(context);
+        if ( registry == null )
+            enabled = false;
+        doingPropertyFunctions = enabled;

Review Comment:
   Yes - and added tests to cover all the setup cases.



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


[GitHub] [jena] kinow commented on a diff in pull request #1389: GH-1381: Default to property function transform being enabled

Posted by GitBox <gi...@apache.org>.
kinow commented on code in PR #1389:
URL: https://github.com/apache/jena/pull/1389#discussion_r900808810


##########
jena-arq/src/main/java/org/apache/jena/sparql/algebra/optimize/TransformPropertyFunction.java:
##########
@@ -27,93 +27,75 @@
 import org.apache.jena.sparql.util.Context ;
 
 /** Rewrite to replace a property function property with the call to the property function implementation */
-public class TransformPropertyFunction extends TransformCopy
-{
-    private final Context context ;
-    private final boolean doingMagicProperties ;
-    private final PropertyFunctionRegistry registry ;
-    
-    /** Apply the property function transformation. 
-     *  <p>
-     *  The {@code context} provide the place to find the property function registry.
-     *  A custom one canbe supplied using 
-     *  {@link ARQConstants#registryPropertyFunctions}
-     *  <p>
-     *  See {@link PropertyFunctionRegistry#chooseRegistry} for the full decision process.
-     *  <p>
-     *  In addition, {@link ARQ#enablePropertyFunctions} must be true (this is the default). 
+public class TransformPropertyFunction extends TransformCopy {
+    private final Context context;
+    private final boolean doingPropertyFunctions;
+    private final PropertyFunctionRegistry registry;
+
+    /**
+     * Apply the property function transformation.
+     * <p>
+     * The {@code context} provides the place to find the property function registry.
+     * A custom one can be supplied using
+     * {@link ARQConstants#registryPropertyFunctions}
+     * <p>
+     * See {@link PropertyFunctionRegistry#chooseRegistry} for the full decision
+     * process.
+     * <p>
+     * If {@link ARQ#enablePropertyFunctions} is false, then property functions are
+     * not enabled and remain as plain triples. For example, this is set false by "strict mode"
      */
     public static Op transform(Op op, Context context) {
-        Transform t = new TransformPropertyFunction(context) ;
-        return Transformer.transform(t, op) ; 
+        Transform t = new TransformPropertyFunction(context);
+        return Transformer.transform(t, op);
     }
-    
-    public TransformPropertyFunction(Context context)
-    {
-        this.context = context ;  
-        doingMagicProperties = context.isTrue(ARQ.enablePropertyFunctions) ;
-        registry = PropertyFunctionRegistry.chooseRegistry(context) ;
+
+    public TransformPropertyFunction(Context context) {
+        this.context = context;
+        boolean enabled = context.isTrueOrUndef(ARQ.enablePropertyFunctions);
+        registry = PropertyFunctionRegistry.chooseRegistry(context);
+        if ( registry == null )
+            enabled = false;
+        doingPropertyFunctions = enabled;

Review Comment:
   ```suggestion
           registry = PropertyFunctionRegistry.chooseRegistry(context);
           doingPropertyFunctions = context.isTrueOrUndef(ARQ.enablePropertyFunctions) && registry != null;
   ```
   
   I think this should have the same behavior? And `doingMagicProperties` was a cool name :tophat: :hatching_chick: :magic_wand: , but +1 on renaming that too.



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