From 5b3ba0b13009221aaae7c35950936b6c967afa51 Mon Sep 17 00:00:00 2001 From: anquetil Date: Tue, 18 Nov 2025 19:02:50 +0100 Subject: [PATCH 1/2] Transformer: commented out 12 methods + useless imports --- .../core/compiler/parser/Transformer.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/inria/corese/core/compiler/parser/Transformer.java b/src/main/java/fr/inria/corese/core/compiler/parser/Transformer.java index 2c9dda760..12ebfff2d 100755 --- a/src/main/java/fr/inria/corese/core/compiler/parser/Transformer.java +++ b/src/main/java/fr/inria/corese/core/compiler/parser/Transformer.java @@ -10,7 +10,6 @@ import fr.inria.corese.core.kgram.core.Query; import fr.inria.corese.core.kgram.core.*; import fr.inria.corese.core.sparql.api.IDatatype; -import fr.inria.corese.core.sparql.compiler.java.JavaCompiler; import fr.inria.corese.core.sparql.exceptions.EngineException; import fr.inria.corese.core.sparql.exceptions.SafetyException; import fr.inria.corese.core.sparql.triple.cst.RDFS; @@ -21,7 +20,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -113,6 +111,7 @@ public class Transformer implements ExpType { functionCompiler = new FunctionCompiler(this); } +/* --- dead code removal --- Transformer(CompilerFactory f) { this(); fac = f; @@ -122,6 +121,7 @@ public class Transformer implements ExpType { public static Transformer create(CompilerFactory f) { return new Transformer(f); } + --- dead code removal --- */ public static Transformer create() { return new Transformer(); @@ -388,6 +388,7 @@ void metadata(ASTQuery ast, Query q) { } } +/* --- dead code removal --- @Deprecated void toJava(ASTQuery ast) throws EngineException { if (ast.hasMetadata(Metadata.Type.COMPILE)) { @@ -401,6 +402,7 @@ void toJava(ASTQuery ast) throws EngineException { } } } + --- dead code removal --- */ void visit(ASTQuery ast) { visitor(ast); @@ -582,9 +584,11 @@ void error(Query q, ASTQuery ast) throws EngineException { } +/* --- dead code removal --- public void imports(Query q, String path) throws EngineException { getFunctionCompiler().imports(q, q.getAST(), path); } + --- dead code removal --- */ public boolean getLinkedFunction(String label) throws EngineException { return getFunctionCompiler().getLinkedFunction(label); @@ -851,6 +855,7 @@ Exp compileService(Service service) throws EngineException { return exp; } +/* --- dead code removal --- Query create(Exp exp) { Query q = Query.create(exp); if (sort != null) { @@ -858,6 +863,7 @@ Query create(Exp exp) { } return q; } + --- dead code removal --- */ Exp compileValues(Values val, boolean opt, int level) { Exp exp = compileValues(val); @@ -968,9 +974,11 @@ Mapping create(Node[] lNode, List lVal) { return Mapping.safeCreate(lNode, nodes); } +/* --- dead code removal --- Exp construct(ASTQuery ast) throws EngineException { return compile(ast, ast.getInsert()); } + --- dead code removal --- */ Exp delete(ASTQuery ast) throws EngineException { return compile(ast, ast.getDelete()); @@ -984,9 +992,11 @@ public void setAST(ASTQuery ast) { this.ast = ast; } +/* --- dead code removal --- public Compiler getCompiler() { return compiler; } + --- dead code removal --- */ void complete(Query qCurrent, ASTQuery ast) throws EngineException { qCurrent.collect(); @@ -1199,9 +1209,11 @@ Node getNode(Query qCurrent, Variable variable) { return node; } +/* --- dead code removal --- ASTQuery getAST(Query q) { return q.getAST(); } + --- dead code removal --- */ Node getProperAndSubSelectNode(Query q, String name) { Node node; @@ -1834,6 +1846,7 @@ public FunctionCompiler getFunctionCompiler() { return functionCompiler; } +/* --- dead code removal --- public void setFunctionCompiler(FunctionCompiler functionCompiler) { this.functionCompiler = functionCompiler; } @@ -1846,6 +1859,7 @@ public int getNumber() { public void setNumber(int number) { this.number = number; } + --- dead code removal --- */ int incrNumber() { return number++; @@ -1899,9 +1913,11 @@ public void setVisitorList(List visit) { this.visit = visit; } +/* --- dead code removal --- public boolean isSPARQLCompliant() { return isSPARQLCompliant; } + --- dead code removal --- */ public void setSPARQLCompliant(boolean b) { isSPARQLCompliant = b; From fe62b70576790592e5c2da80d787df89937a2436 Mon Sep 17 00:00:00 2001 From: Pierre Maillot Date: Wed, 19 Nov 2025 14:58:50 +0100 Subject: [PATCH 2/2] Deleting commented dead code --- .../core/compiler/parser/Transformer.java | 84 ------------------- 1 file changed, 84 deletions(-) diff --git a/src/main/java/fr/inria/corese/core/compiler/parser/Transformer.java b/src/main/java/fr/inria/corese/core/compiler/parser/Transformer.java index 12ebfff2d..b4ee704b9 100755 --- a/src/main/java/fr/inria/corese/core/compiler/parser/Transformer.java +++ b/src/main/java/fr/inria/corese/core/compiler/parser/Transformer.java @@ -111,18 +111,6 @@ public class Transformer implements ExpType { functionCompiler = new FunctionCompiler(this); } -/* --- dead code removal --- - Transformer(CompilerFactory f) { - this(); - fac = f; - compiler = fac.newInstance(); - } - - public static Transformer create(CompilerFactory f) { - return new Transformer(f); - } - --- dead code removal --- */ - public static Transformer create() { return new Transformer(); } @@ -388,22 +376,6 @@ void metadata(ASTQuery ast, Query q) { } } -/* --- dead code removal --- - @Deprecated - void toJava(ASTQuery ast) throws EngineException { - if (ast.hasMetadata(Metadata.Type.COMPILE)) { - String name = ast.getMetadata().getValue(Metadata.Type.COMPILE); - JavaCompiler jc = new JavaCompiler(name); - try { - jc.compile(ast); - jc.write(); - } catch (IOException ex) { - logger.error(ex.getMessage()); - } - } - } - --- dead code removal --- */ - void visit(ASTQuery ast) { visitor(ast); if (getVisitorList() != null) { @@ -583,13 +555,6 @@ void error(Query q, ASTQuery ast) throws EngineException { getFunctionCompiler().undefinedFunction(q, ast, ast.getLevel()); } - -/* --- dead code removal --- - public void imports(Query q, String path) throws EngineException { - getFunctionCompiler().imports(q, q.getAST(), path); - } - --- dead code removal --- */ - public boolean getLinkedFunction(String label) throws EngineException { return getFunctionCompiler().getLinkedFunction(label); } @@ -855,16 +820,6 @@ Exp compileService(Service service) throws EngineException { return exp; } -/* --- dead code removal --- - Query create(Exp exp) { - Query q = Query.create(exp); - if (sort != null) { - q.set(sort); - } - return q; - } - --- dead code removal --- */ - Exp compileValues(Values val, boolean opt, int level) { Exp exp = compileValues(val); if (exp == null) { @@ -974,12 +929,6 @@ Mapping create(Node[] lNode, List lVal) { return Mapping.safeCreate(lNode, nodes); } -/* --- dead code removal --- - Exp construct(ASTQuery ast) throws EngineException { - return compile(ast, ast.getInsert()); - } - --- dead code removal --- */ - Exp delete(ASTQuery ast) throws EngineException { return compile(ast, ast.getDelete()); } @@ -992,12 +941,6 @@ public void setAST(ASTQuery ast) { this.ast = ast; } -/* --- dead code removal --- - public Compiler getCompiler() { - return compiler; - } - --- dead code removal --- */ - void complete(Query qCurrent, ASTQuery ast) throws EngineException { qCurrent.collect(); select(qCurrent, ast); @@ -1209,12 +1152,6 @@ Node getNode(Query qCurrent, Variable variable) { return node; } -/* --- dead code removal --- - ASTQuery getAST(Query q) { - return q.getAST(); - } - --- dead code removal --- */ - Node getProperAndSubSelectNode(Query q, String name) { Node node; if (Query.test) { @@ -1846,21 +1783,6 @@ public FunctionCompiler getFunctionCompiler() { return functionCompiler; } -/* --- dead code removal --- - public void setFunctionCompiler(FunctionCompiler functionCompiler) { - this.functionCompiler = functionCompiler; - } - - - public int getNumber() { - return number; - } - - public void setNumber(int number) { - this.number = number; - } - --- dead code removal --- */ - int incrNumber() { return number++; } @@ -1913,12 +1835,6 @@ public void setVisitorList(List visit) { this.visit = visit; } -/* --- dead code removal --- - public boolean isSPARQLCompliant() { - return isSPARQLCompliant; - } - --- dead code removal --- */ - public void setSPARQLCompliant(boolean b) { isSPARQLCompliant = b; }