[ https://issues.apache.org/jira/browse/JENA-1112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Håvard Ottestad updated JENA-1112: ---------------------------------- Description: This filter gets removed: FILTER ( ! EXISTS { ?a foaf:accountName ?username } ) The filter is used to stop duplicate usernames. Example java program below. ---------------------------------------------------------------- {code:title=Main.java|borderStyle=solid} import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.syntax.syntaxtransform.UpdateTransformOps; import org.apache.jena.update.UpdateFactory; import org.apache.jena.update.UpdateRequest; import java.util.HashMap; public class Main { public static void main(String[] args) { String original = "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n" + "INSERT { \n" + " [] foaf:accountName ?username . \n" + "} \n" + "WHERE{ \n" + " #### THIS FILTER GETS REMOVED WHEN I TRANSFORM \n" + " FILTER ( ! EXISTS { ?a foaf:accountName ?username } ) \n" + "} "; // The filter is used to stop duplicate usernames. UpdateRequest updates = UpdateFactory.create(original); System.out.println("--- ORIGINAL ---\n"+updates.toString()+"\n"); // set ?username to "test" HashMap<Var, Node> varNodeHashMap = new HashMap<Var, Node>(); varNodeHashMap.put(Var.alloc("username"), NodeFactory.createLiteral("test")); //Transform UpdateRequest transform = UpdateTransformOps.transform(updates, varNodeHashMap); System.out.println("--- TRANSFORMED ---\n"+transform.toString()); } } {code} was: This filter gets removed: FILTER ( ! EXISTS { ?a foaf:accountName ?username } ) The filter is used to stop duplicate usernames. Example java program below. ---------------------------------------------------------------- {code:title=Main.java|borderStyle=solid} import org.apache.jena.graph.Node; import org.apache.jena.graph.NodeFactory; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.syntax.syntaxtransform.UpdateTransformOps; import org.apache.jena.update.UpdateFactory; import org.apache.jena.update.UpdateRequest; import java.util.HashMap; public class Main { public static void main(String[] args) { String original = "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n" + "INSERT { \n" + " [] foaf:accountName ?username . \n" + "} \n" + "WHERE{ \n" + " #### THIS FILTER GETS REMOVED WHEN I TRANSFORM" + " FILTER ( ! EXISTS { ?a foaf:accountName ?username } ) \n" + "} "; // The filter is used to stop duplicate usernames. UpdateRequest updates = UpdateFactory.create(original); System.out.println("--- ORIGINAL ---\n"+updates.toString()+"\n"); // set ?username to "test" HashMap<Var, Node> varNodeHashMap = new HashMap<Var, Node>(); varNodeHashMap.put(Var.alloc("username"), NodeFactory.createLiteral("test")); //Transform UpdateRequest transform = UpdateTransformOps.transform(updates, varNodeHashMap); System.out.println("--- TRANSFORMED ---\n"+transform.toString()); } } {code} > UpdateTransformOps removes a filter expression > ---------------------------------------------- > > Key: JENA-1112 > URL: https://issues.apache.org/jira/browse/JENA-1112 > Project: Apache Jena > Issue Type: Bug > Components: ARQ > Affects Versions: Jena 3.0.1 > Reporter: Håvard Ottestad > Priority: Critical > > This filter gets removed: > FILTER ( ! EXISTS { ?a foaf:accountName ?username } ) > The filter is used to stop duplicate usernames. > Example java program below. > ---------------------------------------------------------------- > {code:title=Main.java|borderStyle=solid} > import org.apache.jena.graph.Node; > import org.apache.jena.graph.NodeFactory; > import org.apache.jena.sparql.core.Var; > import org.apache.jena.sparql.syntax.syntaxtransform.UpdateTransformOps; > import org.apache.jena.update.UpdateFactory; > import org.apache.jena.update.UpdateRequest; > import java.util.HashMap; > public class Main { > public static void main(String[] args) { > String original = "PREFIX foaf: <http://xmlns.com/foaf/0.1/> > \n" + > "INSERT { \n" + > " [] foaf:accountName ?username . > \n" + > "} \n" + > "WHERE{ \n" + > " #### THIS FILTER GETS REMOVED WHEN I > TRANSFORM \n" + > " FILTER ( ! EXISTS { ?a foaf:accountName > ?username } ) \n" + > "} "; > // The filter is used to stop duplicate usernames. > UpdateRequest updates = UpdateFactory.create(original); > System.out.println("--- ORIGINAL > ---\n"+updates.toString()+"\n"); > // set ?username to "test" > HashMap<Var, Node> varNodeHashMap = new HashMap<Var, Node>(); > varNodeHashMap.put(Var.alloc("username"), > NodeFactory.createLiteral("test")); > //Transform > UpdateRequest transform = UpdateTransformOps.transform(updates, > varNodeHashMap); > System.out.println("--- TRANSFORMED > ---\n"+transform.toString()); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)