Strabon
changeset 302:3a2cb2955296 noa
merge with default branch
author | George Garbis <ggarbis@di.uoa.gr> |
---|---|
date | Tue Jun 19 18:23:47 2012 +0300 (2012-06-19) |
parents | f20534cb72e9 36acd78a9455 |
children | |
files | runtime/log4j.properties |
line diff
1.1 --- a/endpoint/pom.xml Tue Jun 19 18:18:27 2012 +0300 1.2 +++ b/endpoint/pom.xml Tue Jun 19 18:23:47 2012 +0300 1.3 @@ -100,6 +100,12 @@ 1.4 <dependency> 1.5 <groupId>org.apache.cxf</groupId> 1.6 <artifactId>cxf-rt-transports-http-jetty</artifactId> 1.7 + <exclusions> 1.8 + <exclusion> 1.9 + <artifactId>slf4j-jdk14</artifactId> 1.10 + <groupId>org.slf4j</groupId> 1.11 + </exclusion> 1.12 + </exclusions> 1.13 </dependency> 1.14 1.15 <dependency>
2.1 --- a/evaluation/pom.xml Tue Jun 19 18:18:27 2012 +0300 2.2 +++ b/evaluation/pom.xml Tue Jun 19 18:23:47 2012 +0300 2.3 @@ -32,26 +32,10 @@ 2.4 2.5 <dependency> 2.6 <groupId>org.slf4j</groupId> 2.7 - <artifactId>slf4j-api</artifactId> 2.8 - </dependency> 2.9 - 2.10 - <!-- 2.11 - <dependency> 2.12 - <groupId>org.slf4j</groupId> 2.13 - <artifactId>slf4j-simple</artifactId> 2.14 - </dependency> 2.15 - --> 2.16 - <dependency> 2.17 - <groupId>org.slf4j</groupId> 2.18 <artifactId>slf4j-log4j12</artifactId> 2.19 </dependency> 2.20 2.21 <dependency> 2.22 - <groupId>log4j</groupId> 2.23 - <artifactId>log4j</artifactId> 2.24 - </dependency> 2.25 - 2.26 - <dependency> 2.27 <groupId>junit</groupId> 2.28 <artifactId>junit</artifactId> 2.29 </dependency>
3.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/SpatialJoinOptimizer.java Tue Jun 19 18:18:27 2012 +0300 3.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/SpatialJoinOptimizer.java Tue Jun 19 18:23:47 2012 +0300 3.3 @@ -52,7 +52,9 @@ 3.4 * @author James Leigh 3.5 */ 3.6 3.7 -public class SpatialJoinOptimizer implements QueryOptimizer { 3.8 +public class SpatialJoinOptimizer 3.9 +//implements QueryOptimizer //Removed it consciously 3.10 +{ 3.11 3.12 3.13 //private Set<String> existingVars = new TreeSet<String>(); 3.14 @@ -62,12 +64,21 @@ 3.15 * 3.16 * @param tupleExpr 3.17 */ 3.18 - public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) { 3.19 - tupleExpr.visit(new JoinVisitor()); 3.20 + public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, List<TupleExpr> spatialJoins) { 3.21 + tupleExpr.visit(new JoinVisitor(spatialJoins)); 3.22 } 3.23 3.24 protected class JoinVisitor extends QueryModelVisitorBase<RuntimeException> { 3.25 + 3.26 + 3.27 + 3.28 + public JoinVisitor(List<TupleExpr> spatialJoins) { 3.29 + super(); 3.30 + this.spatialJoins = spatialJoins; 3.31 + } 3.32 3.33 + 3.34 + private List<TupleExpr> spatialJoins; 3.35 //buffer with a var as a second argument 3.36 private boolean problematicBuffer = false; 3.37 3.38 @@ -275,6 +286,9 @@ 3.39 Map.Entry entry = (Map.Entry)it.next(); 3.40 if(count == position - varsMapSize) 3.41 { 3.42 + //If I keep record of this entry, I can use the info later to avoid duplicate filters 3.43 + spatialJoins.add((TupleExpr) entry.getKey()); 3.44 + // 3.45 orderedJoinArgs.add((TupleExpr) entry.getKey()); 3.46 it.remove(); 3.47 for(int fix = 0 ; fix < finalList.size(); fix++) 3.48 @@ -329,7 +343,11 @@ 3.49 } 3.50 } 3.51 3.52 - 3.53 + /** 3.54 + * General Comment: If more than one function exists in the query and can be used to perform the join, no preference is shown 3.55 + * on which function will actually be used for this purpose. This could cause an issue if ST_Disjoint is the one finally used, 3.56 + * as the index won't be used for the evaluation in this case. Perhaps I should include some 'priority' 3.57 + */ 3.58 @Override 3.59 public void meet(Filter node) { 3.60
4.1 --- a/generaldb/pom.xml Tue Jun 19 18:18:27 2012 +0300 4.2 +++ b/generaldb/pom.xml Tue Jun 19 18:23:47 2012 +0300 4.3 @@ -63,11 +63,6 @@ 4.4 </dependency> 4.5 4.6 <dependency> 4.7 - <groupId>org.slf4j</groupId> 4.8 - <artifactId>slf4j-api</artifactId> 4.9 - </dependency> 4.10 - 4.11 - <dependency> 4.12 <groupId>commons-dbcp</groupId> 4.13 <artifactId>commons-dbcp</artifactId> 4.14 </dependency>
5.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBQueryOptimizer.java Tue Jun 19 18:18:27 2012 +0300 5.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBQueryOptimizer.java Tue Jun 19 18:23:47 2012 +0300 5.3 @@ -5,6 +5,9 @@ 5.4 */ 5.5 package org.openrdf.sail.generaldb.optimizers; 5.6 5.7 +import java.util.ArrayList; 5.8 +import java.util.List; 5.9 + 5.10 import org.openrdf.query.BindingSet; 5.11 import org.openrdf.query.Dataset; 5.12 import org.openrdf.query.algebra.QueryRoot; 5.13 @@ -42,7 +45,11 @@ 5.14 private GeneralDBSelectQueryOptimizerFactory factory; 5.15 5.16 private HashTable hashTable; 5.17 - 5.18 + 5.19 + //Addition to locate duplicate filters caused by the SpatialJoinOptimizer 5.20 + List<TupleExpr> spatialJoins = new ArrayList<TupleExpr>(); 5.21 + // 5.22 + 5.23 public void setSelectQueryOptimizerFactory(GeneralDBSelectQueryOptimizerFactory factory) { 5.24 this.factory = factory; 5.25 } 5.26 @@ -100,12 +107,13 @@ 5.27 new SameTermFilterOptimizer().optimize(expr, dataset, bindings); 5.28 5.29 //XXX 5.30 - new SpatialJoinOptimizer().optimize(expr, dataset, bindings); 5.31 + new SpatialJoinOptimizer().optimize(expr, dataset, bindings,spatialJoins); 5.32 } 5.33 5.34 protected void rdbmsOptimizations(TupleExpr expr, Dataset dataset, BindingSet bindings) { 5.35 new GeneralDBValueIdLookupOptimizer(vf).optimize(expr, dataset, bindings); 5.36 - factory.createRdbmsFilterOptimizer().optimize(expr, dataset, bindings); 5.37 + factory.createRdbmsFilterOptimizer().optimize(expr, dataset, bindings,spatialJoins); 5.38 + this.spatialJoins.clear(); 5.39 new GeneralDBVarColumnLookupOptimizer().optimize(expr, dataset, bindings); 5.40 GeneralDBValueJoinOptimizer valueJoins = new GeneralDBValueJoinOptimizer(); 5.41 valueJoins.setBnodeTable(bnodes);
6.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Tue Jun 19 18:18:27 2012 +0300 6.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Tue Jun 19 18:23:47 2012 +0300 6.3 @@ -52,6 +52,7 @@ 6.4 import org.openrdf.query.algebra.Projection; 6.5 import org.openrdf.query.algebra.ProjectionElem; 6.6 import org.openrdf.query.algebra.ProjectionElemList; 6.7 +import org.openrdf.query.algebra.QueryModelNode; 6.8 import org.openrdf.query.algebra.Slice; 6.9 import org.openrdf.query.algebra.StatementPattern; 6.10 import org.openrdf.query.algebra.TupleExpr; 6.11 @@ -113,16 +114,17 @@ 6.12 * @author James Leigh 6.13 * 6.14 */ 6.15 -public class GeneralDBSelectQueryOptimizer extends GeneralDBQueryModelVisitorBase<RuntimeException> implements 6.16 -QueryOptimizer 6.17 +public class GeneralDBSelectQueryOptimizer extends GeneralDBQueryModelVisitorBase<RuntimeException> 6.18 +//implements QueryOptimizer //removed it consciously 6.19 { 6.20 6.21 /** 6.22 * XXX additions (manolee) 6.23 */ 6.24 + private List<TupleExpr> spatialJoins; 6.25 6.26 //assuming no more than 10 uniquely-named variables will be spatial in the average case 6.27 - private ArrayList<String> geoNames = new ArrayList<String>(10); 6.28 + private List<String> geoNames = new ArrayList<String>(10); 6.29 6.30 //private Map<String, GeneralDBSqlExpr> constructsForSelect = new HashMap<String, GeneralDBSqlExpr>(); 6.31 6.32 @@ -183,29 +185,29 @@ 6.33 this.ids = ids; 6.34 } 6.35 6.36 - public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings) { 6.37 + public void optimize(TupleExpr tupleExpr, Dataset dataset, BindingSet bindings, List<TupleExpr> spatialJoins) { 6.38 this.dataset = dataset; 6.39 this.bindings = bindings; 6.40 + this.spatialJoins = spatialJoins; 6.41 tupleExpr.visit(this); 6.42 - //System.out.println("placeholder"); 6.43 } 6.44 6.45 @Override 6.46 public void meet(Distinct node) 6.47 - throws RuntimeException 6.48 - { 6.49 + throws RuntimeException 6.50 + { 6.51 super.meet(node); 6.52 if (node.getArg() instanceof GeneralDBSelectQuery) { 6.53 GeneralDBSelectQuery query = (GeneralDBSelectQuery)node.getArg(); 6.54 query.setDistinct(true); 6.55 node.replaceWith(query); 6.56 } 6.57 - } 6.58 + } 6.59 6.60 @Override 6.61 public void meet(Union node) 6.62 - throws RuntimeException 6.63 - { 6.64 + throws RuntimeException 6.65 + { 6.66 super.meet(node); 6.67 TupleExpr l = node.getLeftArg(); 6.68 TupleExpr r = node.getRightArg(); 6.69 @@ -225,7 +227,7 @@ 6.70 mergeSelectClause(query, right); 6.71 addProjectionsFromUnion(query, union); 6.72 node.replaceWith(query); 6.73 - } 6.74 + } 6.75 6.76 /** 6.77 * This happens when both sides of the union have the same variable name with 6.78 @@ -248,8 +250,8 @@ 6.79 6.80 @Override 6.81 public void meet(Join node) 6.82 - throws RuntimeException 6.83 - { 6.84 + throws RuntimeException 6.85 + { 6.86 super.meet(node); 6.87 TupleExpr l = node.getLeftArg(); 6.88 TupleExpr r = node.getRightArg(); 6.89 @@ -270,12 +272,12 @@ 6.90 * This change was made before altering the spatial joins operation 6.91 */ 6.92 reference = left; 6.93 - } 6.94 + } 6.95 6.96 @Override 6.97 public void meet(LeftJoin node) 6.98 - throws RuntimeException 6.99 - { 6.100 + throws RuntimeException 6.101 + { 6.102 super.meet(node); 6.103 TupleExpr l = node.getLeftArg(); 6.104 TupleExpr r = node.getRightArg(); 6.105 @@ -306,7 +308,7 @@ 6.106 } 6.107 node.replaceWith(left); 6.108 reference = left; 6.109 - } 6.110 + } 6.111 6.112 @Override 6.113 public void meet(StatementPattern sp) { 6.114 @@ -497,8 +499,8 @@ 6.115 6.116 @Override 6.117 public void meet(Filter node) 6.118 - throws RuntimeException 6.119 - { 6.120 + throws RuntimeException 6.121 + { 6.122 6.123 /** 6.124 * XXX 21/09/2011 addition for spatial joins 6.125 @@ -752,40 +754,69 @@ 6.126 /** 6.127 * End of addition 6.128 */ 6.129 - else //DEFAULT BEHAVIOR 6.130 + else //DEFAULT BEHAVIOR (Enhanced with check for duplicates) 6.131 { 6.132 + 6.133 + boolean dup = false; 6.134 + ValueExpr dupFunctionCall = node.getCondition(); 6.135 + for(TupleExpr sfilter : this.spatialJoins) 6.136 + { 6.137 + ValueExpr tmpExpr = ((Filter)sfilter).getCondition(); 6.138 + if(tmpExpr.equals(dupFunctionCall)) 6.139 + { 6.140 + // QueryModelNode parent = node.getParentNode(); 6.141 + // TupleExpr replacement = ((Filter)node).getArg(); 6.142 + // parent.replaceChildNode(node, replacement); 6.143 + // //If I do reach this point, the former 'child' argument will be a traditional Join operator 6.144 + // super.meet((Join)replacement); 6.145 + // node.setCondition(null); 6.146 + // return; 6.147 + dup = true; 6.148 + break; 6.149 + } 6.150 + } 6.151 + 6.152 super.meet(node); 6.153 if (node.getArg() instanceof GeneralDBSelectQuery) { 6.154 GeneralDBSelectQuery query = (GeneralDBSelectQuery)node.getArg(); 6.155 6.156 ValueExpr condition = null; 6.157 - for (ValueExpr expr : flatten(node.getCondition())) { 6.158 - try { 6.159 - //07/09/2011 6.160 - //Attempt to move spatial selections and joins to FROM clause 6.161 - //XXX removed because I followed a different approach. May come in handy later on. 09/09/11 6.162 - // if(node.getCondition() instanceof FunctionCall) 6.163 - // { 6.164 - // GeneralDBSqlExpr sqlExpression = sql.createBooleanExpr(expr); 6.165 - // query.addSpatialFilter(sqlExpression); 6.166 - // //query.getFrom().addFilter(sql.createBooleanExpr(expr)); 6.167 - // query.addFilter(sqlExpression); 6.168 - // } 6.169 - // else //DEFAULT CASE 6.170 - // { 6.171 - query.addFilter(sql.createBooleanExpr(expr)); 6.172 - // } 6.173 +// dup=false; 6.174 + if(!dup) 6.175 + { 6.176 + for (ValueExpr expr : flatten(node.getCondition())) { 6.177 + try { 6.178 + //07/09/2011 6.179 + //Attempt to move spatial selections and joins to FROM clause 6.180 + //XXX removed because I followed a different approach. May come in handy later on. 09/09/11 6.181 + // if(node.getCondition() instanceof FunctionCall) 6.182 + // { 6.183 + // GeneralDBSqlExpr sqlExpression = sql.createBooleanExpr(expr); 6.184 + // query.addSpatialFilter(sqlExpression); 6.185 + // //query.getFrom().addFilter(sql.createBooleanExpr(expr)); 6.186 + // query.addFilter(sqlExpression); 6.187 + // } 6.188 + // else //DEFAULT CASE 6.189 + // { 6.190 + query.addFilter(sql.createBooleanExpr(expr)); 6.191 + // } 6.192 6.193 - } 6.194 - catch (UnsupportedRdbmsOperatorException e) { 6.195 - if (condition == null) { 6.196 - condition = expr; 6.197 } 6.198 - else { 6.199 - condition = new And(condition, expr); 6.200 + catch (UnsupportedRdbmsOperatorException e) { 6.201 + if (condition == null) { 6.202 + condition = expr; 6.203 + } 6.204 + else { 6.205 + condition = new And(condition, expr); 6.206 + } 6.207 } 6.208 } 6.209 } 6.210 + else 6.211 + { 6.212 + condition = null; 6.213 + } 6.214 + 6.215 if (condition == null) { 6.216 node.replaceWith(node.getArg()); 6.217 } 6.218 @@ -838,14 +869,14 @@ 6.219 6.220 6.221 } 6.222 - } 6.223 + } 6.224 6.225 6.226 6.227 @Override 6.228 public void meet(Projection node) 6.229 - throws RuntimeException 6.230 - { 6.231 + throws RuntimeException 6.232 + { 6.233 super.meet(node); 6.234 if (node.getArg() instanceof GeneralDBSelectQuery) { 6.235 GeneralDBSelectQuery query = (GeneralDBSelectQuery)node.getArg(); 6.236 @@ -866,15 +897,15 @@ 6.237 query.setSqlSelectVar(selection); 6.238 node.replaceWith(query); 6.239 } 6.240 - } 6.241 + } 6.242 6.243 /** 6.244 * XXX used to retrieve the geoNames from the TRADITIONAL filter clauses - not the ones in Joins 6.245 */ 6.246 @Override 6.247 public void meet(FunctionCall node) 6.248 - throws RuntimeException 6.249 - { 6.250 + throws RuntimeException 6.251 + { 6.252 Function function = FunctionRegistry.getInstance().get(node.getURI()); 6.253 6.254 super.meet(node); 6.255 @@ -936,7 +967,7 @@ 6.256 // } 6.257 } 6.258 6.259 - } 6.260 + } 6.261 6.262 // 6.263 @Override 6.264 @@ -1042,7 +1073,7 @@ 6.265 else if(expr instanceof BinaryValueOperator) 6.266 { 6.267 return thematicExpression(((BinaryValueOperator) expr).getLeftArg()) && 6.268 - thematicExpression(((BinaryValueOperator) expr).getRightArg()); 6.269 + thematicExpression(((BinaryValueOperator) expr).getRightArg()); 6.270 } 6.271 else 6.272 { 6.273 @@ -1195,8 +1226,8 @@ 6.274 6.275 @Override 6.276 public void meet(Slice node) 6.277 - throws RuntimeException 6.278 - { 6.279 + throws RuntimeException 6.280 + { 6.281 super.meet(node); 6.282 if (node.getArg() instanceof GeneralDBSelectQuery) { 6.283 GeneralDBSelectQuery query = (GeneralDBSelectQuery)node.getArg(); 6.284 @@ -1208,12 +1239,12 @@ 6.285 } 6.286 node.replaceWith(query); 6.287 } 6.288 - } 6.289 + } 6.290 6.291 @Override 6.292 public void meet(Order node) 6.293 - throws RuntimeException 6.294 - { 6.295 + throws RuntimeException 6.296 + { 6.297 int mbbCounter = 0; 6.298 // super.meet(node); 6.299 if (!(node.getArg() instanceof GeneralDBSelectQuery)) 6.300 @@ -1344,7 +1375,7 @@ 6.301 catch (UnsupportedRdbmsOperatorException e) { 6.302 // unsupported 6.303 } 6.304 - } 6.305 + } 6.306 6.307 /** 6.308 * FIXME uncomment if you need sorted results based on the group by's contents!!!
7.1 --- a/monetdb/pom.xml Tue Jun 19 18:18:27 2012 +0300 7.2 +++ b/monetdb/pom.xml Tue Jun 19 18:23:47 2012 +0300 7.3 @@ -67,11 +67,6 @@ 7.4 </dependency> 7.5 7.6 <dependency> 7.7 - <groupId>org.slf4j</groupId> 7.8 - <artifactId>slf4j-api</artifactId> 7.9 - </dependency> 7.10 - 7.11 - <dependency> 7.12 <groupId>commons-dbcp</groupId> 7.13 <artifactId>commons-dbcp</artifactId> 7.14 </dependency>
8.1 --- a/pom.xml Tue Jun 19 18:18:27 2012 +0300 8.2 +++ b/pom.xml Tue Jun 19 18:23:47 2012 +0300 8.3 @@ -33,7 +33,6 @@ 8.4 <sesame.version>2.6.3</sesame.version> 8.5 <aduna.appbase.version>3.5.0</aduna.appbase.version> 8.6 <slf4j.version>1.6.4</slf4j.version> 8.7 - <log4j.version>1.2.17</log4j.version> 8.8 <spring.version>2.5.6</spring.version> 8.9 <jts.version>1.11</jts.version> 8.10 <geotools.version>2.7.4</geotools.version> 8.11 @@ -318,21 +317,6 @@ 8.12 <version>5.1.15</version> 8.13 </dependency> 8.14 8.15 - <!-- SLF4J --> 8.16 - <dependency> 8.17 - <groupId>org.slf4j</groupId> 8.18 - <artifactId>slf4j-api</artifactId> 8.19 - <version>${slf4j.version}</version> 8.20 - </dependency> 8.21 - 8.22 - <!-- 8.23 - <dependency> 8.24 - <groupId>org.slf4j</groupId> 8.25 - <artifactId>slf4j-simple</artifactId> 8.26 - <version>${slf4j.version}</version> 8.27 - </dependency> 8.28 - --> 8.29 - 8.30 <dependency> 8.31 <groupId>net.sf</groupId> 8.32 <artifactId>log4jdbc4</artifactId> 8.33 @@ -346,13 +330,6 @@ 8.34 <version>${slf4j.version}</version> 8.35 </dependency> 8.36 8.37 - <dependency> 8.38 - <groupId>log4j</groupId> 8.39 - <artifactId>log4j</artifactId> 8.40 - <version>${log4j.version}</version> 8.41 - </dependency> 8.42 - 8.43 - 8.44 <!-- Apache Commons --> 8.45 <dependency> 8.46 <groupId>commons-cli</groupId>
9.1 --- a/postgis/pom.xml Tue Jun 19 18:18:27 2012 +0300 9.2 +++ b/postgis/pom.xml Tue Jun 19 18:23:47 2012 +0300 9.3 @@ -67,11 +67,6 @@ 9.4 </dependency> 9.5 9.6 <dependency> 9.7 - <groupId>org.slf4j</groupId> 9.8 - <artifactId>slf4j-api</artifactId> 9.9 - </dependency> 9.10 - 9.11 - <dependency> 9.12 <groupId>commons-dbcp</groupId> 9.13 <artifactId>commons-dbcp</artifactId> 9.14 </dependency>
10.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISEvaluation.java Tue Jun 19 18:18:27 2012 +0300 10.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISEvaluation.java Tue Jun 19 18:23:47 2012 +0300 10.3 @@ -64,6 +64,7 @@ 10.4 stmt.setObject(++p, o); 10.5 } 10.6 Collection<GeneralDBColumnVar> proj = qb.getProjections(); 10.7 +// System.out.println("In PostGIS Evaluation, query is: \n" + stmt); 10.8 GeneralDBBindingIteration result = new PostGISBindingIteration(stmt); 10.9 result.setProjections(proj); 10.10 result.setBindings(bindings); 10.11 @@ -72,8 +73,7 @@ 10.12 //XXX addition 10.13 result.setGeoNames(this.geoNames); 10.14 result.setConstructIndexesAndNames(this.constructIndexesAndNames); 10.15 - // 10.16 - 10.17 + 10.18 if (logger.isDebugEnabled()) { 10.19 logger.debug("In PostGIS Evaluation, query is: \n{}", stmt); 10.20 }
11.1 --- a/resultio/pom.xml Tue Jun 19 18:18:27 2012 +0300 11.2 +++ b/resultio/pom.xml Tue Jun 19 18:23:47 2012 +0300 11.3 @@ -49,24 +49,8 @@ 11.4 11.5 <dependency> 11.6 <groupId>org.slf4j</groupId> 11.7 - <artifactId>slf4j-api</artifactId> 11.8 - </dependency> 11.9 - 11.10 - <!-- 11.11 - <dependency> 11.12 - <groupId>org.slf4j</groupId> 11.13 - <artifactId>slf4j-simple</artifactId> 11.14 - </dependency> 11.15 - --> 11.16 - <dependency> 11.17 - <groupId>org.slf4j</groupId> 11.18 <artifactId>slf4j-log4j12</artifactId> 11.19 </dependency> 11.20 - 11.21 - <dependency> 11.22 - <groupId>log4j</groupId> 11.23 - <artifactId>log4j</artifactId> 11.24 - </dependency> 11.25 11.26 <dependency> 11.27 <groupId>junit</groupId>
12.1 --- a/runtime/log4j.properties Tue Jun 19 18:18:27 2012 +0300 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,22 +0,0 @@ 12.4 -# logger level values: OFF, ERROR, WARN, INFO, DEBUG, ALL 12.5 -log4j.rootLogger=OFF, CA 12.6 -#log4j.rootLogger=DEBUG, CA 12.7 -#log4j.rootLogger=INFO, CA, FA 12.8 - 12.9 -# Console Appender 12.10 -log4j.appender.CA=org.apache.log4j.ConsoleAppender 12.11 -log4j.appender.CA.layout=org.apache.log4j.PatternLayout 12.12 -log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 12.13 - 12.14 -# File Appender 12.15 -#log4j.appender.FA=org.apache.log4j.FileAppender 12.16 -#log4j.appender.FA.File=sample.log 12.17 -#log4j.appender.FA.layout=org.apache.log4j.PatternLayout 12.18 -#log4j.appender.FA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 12.19 -# Set the logger level of File Appender to WARN 12.20 -#log4j.appender.FA.Threshold = WARN 12.21 - 12.22 - 12.23 -# Sesame configuration (debug only Strabon) 12.24 -log4j.logger.org.openrdf.query.parser.QueryParserRegistry=INFO 12.25 -log4j.logger.org.openrdf.sail.generaldb.managers.TripleTableManager=INFO
13.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java Tue Jun 19 18:18:27 2012 +0300 13.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java Tue Jun 19 18:23:47 2012 +0300 13.3 @@ -90,14 +90,14 @@ 13.4 SailRepositoryConnection con1 = null; 13.5 13.6 public Strabon(String databaseName, String user, String password, int port, String serverName, boolean checkForLockTable) 13.7 - throws SQLException, ClassNotFoundException 13.8 - { 13.9 + throws SQLException, ClassNotFoundException 13.10 + { 13.11 if (checkForLockTable == true) { 13.12 checkAndDeleteLock(databaseName, user, password, port, serverName); 13.13 } 13.14 13.15 initiate(databaseName, user, password, port, serverName); 13.16 - } 13.17 + } 13.18 13.19 13.20 protected abstract void initiate(String databaseName, String user, String password, int port, String serverName) ; 13.21 @@ -128,7 +128,7 @@ 13.22 13.23 13.24 protected abstract void checkAndDeleteLock(String databaseName, String user, String password, int port, String serverName) 13.25 - throws SQLException, ClassNotFoundException ; 13.26 + throws SQLException, ClassNotFoundException ; 13.27 13.28 public SailRepositoryConnection getSailRepoConnection() { 13.29 return con1; 13.30 @@ -145,31 +145,31 @@ 13.31 con1.commit(); 13.32 con1.close(); 13.33 repo1.shutDown(); 13.34 - 13.35 + 13.36 } catch (RepositoryException e) { 13.37 logger.error("[Strabon.close]", e); 13.38 } 13.39 - 13.40 + 13.41 logger.info("[Strabon.close] Connection closed."); 13.42 } 13.43 13.44 public Object query(String queryString) 13.45 - throws MalformedQueryException, QueryEvaluationException, IOException, TupleQueryResultHandlerException 13.46 - { 13.47 + throws MalformedQueryException, QueryEvaluationException, IOException, TupleQueryResultHandlerException 13.48 + { 13.49 return query(queryString, "", this.getSailRepoConnection()); 13.50 - } 13.51 + } 13.52 13.53 public Object query(String queryString, String resultsFormat) 13.54 - throws MalformedQueryException , QueryEvaluationException, IOException, TupleQueryResultHandlerException 13.55 - { 13.56 + throws MalformedQueryException , QueryEvaluationException, IOException, TupleQueryResultHandlerException 13.57 + { 13.58 return query(queryString, resultsFormat, this.getSailRepoConnection()); 13.59 - } 13.60 + } 13.61 13.62 public Object query(String queryString, SailRepositoryConnection con) 13.63 - throws MalformedQueryException, QueryEvaluationException, IOException, TupleQueryResultHandlerException 13.64 - { 13.65 + throws MalformedQueryException, QueryEvaluationException, IOException, TupleQueryResultHandlerException 13.66 + { 13.67 return query(queryString, "", con); 13.68 - } 13.69 + } 13.70 13.71 public Object queryBindings(String queryString, SailRepositoryConnection con) throws QueryEvaluationException, MalformedQueryException 13.72 { 13.73 @@ -183,10 +183,10 @@ 13.74 TupleQueryResult result = tupleQuery.evaluate(); 13.75 return result; 13.76 } 13.77 - 13.78 + 13.79 public Object query(String queryString, String resultsFormat, SailRepositoryConnection con) 13.80 - throws MalformedQueryException, QueryEvaluationException, IOException, TupleQueryResultHandlerException 13.81 - { 13.82 + throws MalformedQueryException, QueryEvaluationException, IOException, TupleQueryResultHandlerException 13.83 + { 13.84 logger.info("[Strabon.query] Executing query: " + queryString); 13.85 TupleQuery tupleQuery = null; 13.86 try { 13.87 @@ -618,11 +618,11 @@ 13.88 try { 13.89 //String cstr = new String("aa", "UTF8"); 13.90 // ggarbis: For too large strings (e.g., 44MB) it returns empty string. 13.91 -// String newString = new String(sb.toString().getBytes(), Charset.availableCharsets().get("UTF-8")); 13.92 + // String newString = new String(sb.toString().getBytes(), Charset.availableCharsets().get("UTF-8")); 13.93 13.94 if(resultsFormat.equalsIgnoreCase("KML")) 13.95 { 13.96 -// writeOut.write(newString); 13.97 + // writeOut.write(newString); 13.98 writeOut.write(sb.toString()); 13.99 // System.out.println(newString); 13.100 } 13.101 @@ -638,7 +638,7 @@ 13.102 13.103 //kmzout.setLevel(6); 13.104 kmzout.putNextEntry(entry); 13.105 -// kmzout.write(newString.getBytes()); 13.106 + // kmzout.write(newString.getBytes()); 13.107 kmzout.write(sb.toString().getBytes()); 13.108 kmzout.closeEntry(); 13.109 kmzout.close(); 13.110 @@ -764,7 +764,7 @@ 13.111 13.112 //return ret; 13.113 return retStream.toString(); 13.114 - } 13.115 + } 13.116 13.117 public void update(String updateString, SailRepositoryConnection con) throws MalformedQueryException 13.118 { 13.119 @@ -786,9 +786,9 @@ 13.120 logger.error("[Strabon.update]", e); 13.121 } 13.122 13.123 -// System.out.println("-------------------------------------------"); 13.124 -// System.out.println("- UPDATE EXECUTED -"); 13.125 -// System.out.println("-------------------------------------------"); 13.126 + // System.out.println("-------------------------------------------"); 13.127 + // System.out.println("- UPDATE EXECUTED -"); 13.128 + // System.out.println("-------------------------------------------"); 13.129 } 13.130 13.131 public void storeInRepo(String src, String format) throws RDFParseException, RepositoryException, IOException,InvalidDatasetFormatFault, RDFHandlerException 13.132 @@ -833,21 +833,30 @@ 13.133 { 13.134 throw new InvalidDatasetFormatFault(); 13.135 } 13.136 - 13.137 - try{ 13.138 - URL source = new URL(src); 13.139 - storeURL(source, baseURI, uriContext, realFormat); 13.140 - 13.141 - } catch(MalformedURLException e) { 13.142 - File file = new File(src); 13.143 - if (file.exists()) { 13.144 - storeURL(new URL("file://" + src), baseURI, uriContext, realFormat); 13.145 - 13.146 - } else { 13.147 - logger.info("File \"" + src + "\" does not exist. Trying reading as String."); 13.148 - storeString((String)src, baseURI, uriContext, realFormat); 13.149 - } 13.150 - } 13.151 + 13.152 + try{ 13.153 + URL source = new URL(src); 13.154 + storeURL(source, baseURI, uriContext, realFormat); 13.155 + 13.156 + } catch(MalformedURLException e) { 13.157 + 13.158 + URL fromClasspath = getClass().getResource(src); 13.159 + if(fromClasspath!=null) 13.160 + { 13.161 + storeURL(fromClasspath, baseURI, uriContext, realFormat); 13.162 + } 13.163 + else 13.164 + { 13.165 + File file = new File(src); 13.166 + if (file.exists()) { 13.167 + storeURL(new URL("file://" + src), baseURI, uriContext, realFormat); 13.168 + 13.169 + } else { 13.170 + logger.info("File \"" + src + "\" does not exist. Trying reading as String."); 13.171 + storeString((String)src, baseURI, uriContext, realFormat); 13.172 + } 13.173 + } 13.174 + } 13.175 } 13.176 13.177 private void storeURL(URL url, String baseURI, URI context, RDFFormat format) throws RDFParseException, RepositoryException, IOException, RDFHandlerException 13.178 @@ -860,14 +869,14 @@ 13.179 13.180 InputStream in = (InputStream) url.openStream(); 13.181 InputStreamReader reader = new InputStreamReader(in); 13.182 - 13.183 + 13.184 RDFParser parser = Rio.createParser(format); 13.185 - 13.186 + 13.187 GeosparqlRDFHandlerBase handler = new GeosparqlRDFHandlerBase(); 13.188 - 13.189 + 13.190 parser.setRDFHandler(handler); 13.191 parser.parse(reader, ""); 13.192 - 13.193 + 13.194 logger.info("[Strabon.storeURL] Inferred " + handler.getNumberOfTriples() + " triples."); 13.195 if (handler.getNumberOfTriples() > 0) { 13.196 logger.info("[Strabon.storeURL] Triples inferred:"+ handler.getTriples().toString()); 13.197 @@ -897,14 +906,14 @@ 13.198 logger.info("[Strabon.storeString] Format : " + ((format == null) ? "null" : format.toString())); 13.199 13.200 StringReader reader = new StringReader(text); 13.201 - 13.202 + 13.203 RDFParser parser = Rio.createParser(format); 13.204 - 13.205 + 13.206 GeosparqlRDFHandlerBase handler = new GeosparqlRDFHandlerBase(); 13.207 - 13.208 + 13.209 parser.setRDFHandler(handler); 13.210 parser.parse(reader, ""); 13.211 - 13.212 + 13.213 logger.info("[Strabon.storeString] Inferred " + handler.getNumberOfTriples() + " triples."); 13.214 if (handler.getNumberOfTriples() > 0) { 13.215 logger.info("[Strabon.storeString] Triples inferred:"+ handler.getTriples().toString()); 13.216 @@ -934,16 +943,16 @@ 13.217 logger.error("[Strabon.describe]", e); 13.218 } 13.219 13.220 -// System.out.println("Placemark0"); 13.221 -// System.out.println("\n\n\nGot query: " + describeString + "\n\n\n"); 13.222 + // System.out.println("Placemark0"); 13.223 + // System.out.println("\n\n\nGot query: " + describeString + "\n\n\n"); 13.224 logger.info("[Strabon.describe] Executing describe query:" + describeString); 13.225 - 13.226 + 13.227 try { 13.228 OutputStream out = new FileOutputStream(outFile); 13.229 RDFHandler rdfHandler = new NTriplesWriter(out); 13.230 graphQuery.evaluate(rdfHandler); 13.231 out.close(); 13.232 - 13.233 + 13.234 } catch (FileNotFoundException e) { 13.235 logger.error("[Strabon.describe]", e); 13.236 } catch (QueryEvaluationException e) { 13.237 @@ -955,8 +964,8 @@ 13.238 } 13.239 13.240 logger.info("[Strabon.describe] Output: "+outFile); 13.241 -// System.out.println("---------------------------------------------"); 13.242 -// System.out.println("- DESCRIBE EXECUTED -"); 13.243 -// System.out.println("---------------------------------------------"); 13.244 + // System.out.println("---------------------------------------------"); 13.245 + // System.out.println("- DESCRIBE EXECUTED -"); 13.246 + // System.out.println("---------------------------------------------"); 13.247 } 13.248 }
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/runtime/src/main/resources/log4j.properties Tue Jun 19 18:23:47 2012 +0300 14.3 @@ -0,0 +1,22 @@ 14.4 +# logger level values: OFF, ERROR, WARN, INFO, DEBUG, ALL 14.5 +log4j.rootLogger=OFF, CA 14.6 +#log4j.rootLogger=DEBUG, CA 14.7 +#log4j.rootLogger=INFO, CA, FA 14.8 + 14.9 +# Console Appender 14.10 +log4j.appender.CA=org.apache.log4j.ConsoleAppender 14.11 +log4j.appender.CA.layout=org.apache.log4j.PatternLayout 14.12 +log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 14.13 + 14.14 +# File Appender 14.15 +#log4j.appender.FA=org.apache.log4j.FileAppender 14.16 +#log4j.appender.FA.File=sample.log 14.17 +#log4j.appender.FA.layout=org.apache.log4j.PatternLayout 14.18 +#log4j.appender.FA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 14.19 +# Set the logger level of File Appender to WARN 14.20 +#log4j.appender.FA.Threshold = WARN 14.21 + 14.22 + 14.23 +# Sesame configuration (debug only Strabon) 14.24 +log4j.logger.org.openrdf.query.parser.QueryParserRegistry=INFO 14.25 +log4j.logger.org.openrdf.sail.generaldb.managers.TripleTableManager=INFO