|
From: <pm_...@us...> - 2011-12-19 13:35:05
|
Revision: 4503
http://mxquery.svn.sourceforge.net/mxquery/?rev=4503&view=rev
Author: pm_fischer
Date: 2011-12-19 13:34:52 +0000 (Mon, 19 Dec 2011)
Log Message:
-----------
- Projection on XMark
- Add changes to other platforms
Modified Paths:
--------------
trunk/MXQuery/midp_src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/AttributeIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/ChildIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/CompareIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/DescendantOrSelfIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/ForIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/GOrderByIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/IfThenElseIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/LetIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/UserdefFuncCall.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/XMLContent.java
trunk/MXQuery/src/ch/ethz/mxquery/model/Iterator.java
trunk/MXQuery/src/ch/ethz/mxquery/model/XDMIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/query/PreparedStatement.java
trunk/MXQuery/src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java
trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java
trunk/MXQuery/xqib_src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java
trunk/MXQuery_Android_App/.classpath
trunk/MXQuery_Testing/ProjectionTests/queries/Cond1.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark01.xq
trunk/MXQuery_Testing/src/ch/ethz/mxquery/test/ProjectionTests.java
Added Paths:
-----------
trunk/MXQuery_Testing/ProjectionTests/queries/Comp1.xq
trunk/MXQuery_Testing/ProjectionTests/queries/Cond2.xq
trunk/MXQuery_Testing/ProjectionTests/queries/Cond3.xq
trunk/MXQuery_Testing/ProjectionTests/queries/Cond4.xq
trunk/MXQuery_Testing/ProjectionTests/queries/ElemConstr1.xq
trunk/MXQuery_Testing/ProjectionTests/queries/FLWOR2.xq
trunk/MXQuery_Testing/ProjectionTests/queries/Path3.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark02.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark03.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark04.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark05.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark06.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark07.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark08.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark09.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark10.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark11.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark12.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark13.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark14.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark15.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark16.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark17.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark18.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark19.xq
trunk/MXQuery_Testing/ProjectionTests/queries/XMark20.xq
trunk/MXQuery_Testing/src/ch/ethz/mxquery/test/ProjectionXMarkTests.java
Modified: trunk/MXQuery/midp_src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java
===================================================================
--- trunk/MXQuery/midp_src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/midp_src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -18,11 +18,14 @@
import java.io.OutputStreamWriter;
import java.util.Enumeration;
import ch.ethz.mxquery.util.Hashtable;
+import ch.ethz.mxquery.util.ObjectObjectPair;
+
import java.util.Vector;
import ch.ethz.mxquery.exceptions.ErrorCodes;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.iterators.TokenIterator;
import ch.ethz.mxquery.datamodel.QName;
import ch.ethz.mxquery.model.XDMIterator;
@@ -170,4 +173,12 @@
public XDMSerializerSettings getOutputSettings() {
return ser;
}
+
+ public Hashtable getProjectionPaths() throws StaticException {
+ //Preliminary implementation, producing just a single doc
+ ObjectObjectPair paths = iter.getProjectionPaths();
+ Hashtable ht = new Hashtable();
+ ht.put("DOC", paths);
+ return ht;
+ }
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/AttributeIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/AttributeIterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/AttributeIterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -28,6 +28,7 @@
import ch.ethz.mxquery.exceptions.ErrorCodes;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.exceptions.TypeException;
import ch.ethz.mxquery.model.CheckNodeType;
import ch.ethz.mxquery.model.CurrentBasedIterator;
@@ -171,7 +172,7 @@
return AXIS_ATTRIBUTE;
}
- public ObjectObjectPair getProjectionPaths() {
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
XDMIterator curSub; // TODO: deal with context item
curSub = subIters[0];
ObjectObjectPair paths = curSub.getProjectionPaths();
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/ChildIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/ChildIterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/ChildIterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -29,6 +29,7 @@
import ch.ethz.mxquery.exceptions.ErrorCodes;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.exceptions.TypeException;
import ch.ethz.mxquery.model.CheckNodeType;
import ch.ethz.mxquery.model.CurrentBasedIterator;
@@ -265,7 +266,7 @@
}
}
- public ObjectObjectPair getProjectionPaths() {
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
XDMIterator curSub; // TODO: deal with context item
curSub = subIters[0];
ObjectObjectPair paths = curSub.getProjectionPaths();
@@ -286,8 +287,5 @@
returned.add(res);
}
return new ObjectObjectPair(returned, paths.getSecond());
- }
-
-
-
+ }
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/CompareIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/CompareIterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/CompareIterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -28,6 +28,7 @@
import ch.ethz.mxquery.exceptions.ErrorCodes;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.exceptions.TypeException;
import ch.ethz.mxquery.model.Constants;
import ch.ethz.mxquery.model.TokenBasedIterator;
@@ -322,7 +323,7 @@
return new TypeInfo(Type.BOOLEAN,Type.OCCURRENCE_IND_ZERO_OR_ONE);
}
- public ObjectObjectPair getProjectionPaths() {
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
Set returned = new Set();
Set used = new Set();
for (int i=0;i<subIters.length;i++){
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/DescendantOrSelfIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/DescendantOrSelfIterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/DescendantOrSelfIterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -16,6 +16,7 @@
package ch.ethz.mxquery.iterators;
+import java.util.Enumeration;
import java.util.Vector;
import ch.ethz.mxquery.contextConfig.Context;
@@ -30,6 +31,7 @@
import ch.ethz.mxquery.exceptions.ErrorCodes;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.exceptions.TypeException;
import ch.ethz.mxquery.model.CheckNodeType;
import ch.ethz.mxquery.model.CurrentBasedIterator;
@@ -39,6 +41,8 @@
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.IntegerList;
import ch.ethz.mxquery.util.KXmlSerializer;
+import ch.ethz.mxquery.util.ObjectObjectPair;
+import ch.ethz.mxquery.util.Set;
/**
*
@@ -447,5 +451,29 @@
}
return super.staticInit();
}
+
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
+ XDMIterator curSub; // TODO: deal with context item
+ curSub = subIters[0];
+ ObjectObjectPair paths = curSub.getProjectionPaths();
+ Set returnedBelow = (Set)paths.getFirst();
+ Set returned = new Set();
+ Enumeration pathEnum = returnedBelow.elements();
+ while (pathEnum.hasMoreElements()) {
+ String res = (String) pathEnum.nextElement();
+ if (res.endsWith("/"))
+ res = res.substring(0, res.length()-1);
+ if (step_uri != null)
+ res = res+"//{"+step_uri+"}:";
+ if (step_local != null) {
+ if (step_uri == null)
+ res = res+"//";
+ res = res+step_local;
+ }
+ returned.add(res);
+ }
+ return new ObjectObjectPair(returned, paths.getSecond());
+ }
+
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/ForIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/ForIterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/ForIterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -27,6 +27,7 @@
import ch.ethz.mxquery.datamodel.xdm.TokenInterface;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.model.CurrentBasedIterator;
import ch.ethz.mxquery.model.EmptySequenceIterator;
import ch.ethz.mxquery.model.VariableHolder;
@@ -34,6 +35,8 @@
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.ContextPair;
import ch.ethz.mxquery.util.KXmlSerializer;
+import ch.ethz.mxquery.util.ObjectObjectPair;
+import ch.ethz.mxquery.util.Set;
public class ForIterator extends CurrentBasedIterator {
// private static String vi =
@@ -267,5 +270,14 @@
return this;
}
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
+ ObjectObjectPair curPath = subIters[0].getProjectionPaths();
+ varHolder.setProjectionPaths(new ObjectObjectPair(curPath.getFirst(), new Set()));
+ Set usedAll = new Set();
+ usedAll.addAll((Set) curPath.getFirst());
+ usedAll.addAll((Set) curPath.getSecond());
+ return new ObjectObjectPair(new Set(), usedAll);
+ }
+
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/GOrderByIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/GOrderByIterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/GOrderByIterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -13,6 +13,7 @@
import ch.ethz.mxquery.exceptions.ErrorCodes;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.exceptions.TypeException;
import ch.ethz.mxquery.model.Iterator;
import ch.ethz.mxquery.model.VariableHolder;
@@ -20,8 +21,10 @@
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.Comparator;
import ch.ethz.mxquery.util.MergeSort;
+import ch.ethz.mxquery.util.ObjectObjectPair;
import ch.ethz.mxquery.util.OrderOptions;
import ch.ethz.mxquery.util.QuickSort;
+import ch.ethz.mxquery.util.Set;
/**
* Mad props to David Alexander Graf, who did the original order by iterator. I
@@ -311,5 +314,20 @@
}
return this;
}
+
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
+ Set returned = new Set();
+ Set used = new Set();
+ if (subIters != null)
+ for (int i=0;i<subIters.length;i++){
+ ObjectObjectPair cur = subIters[i].getProjectionPaths();
+ used.addAll((Set)cur.getFirst());
+ used.addAll((Set)cur.getSecond());
+ }
+ return new ObjectObjectPair(returned, used);
+
+ }
+
+
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/IfThenElseIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/IfThenElseIterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/IfThenElseIterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -22,6 +22,7 @@
import ch.ethz.mxquery.datamodel.xdm.TokenInterface;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.model.CurrentBasedIterator;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.model.updatePrimitives.PendingUpdateList;
@@ -125,7 +126,7 @@
}
}
- public ObjectObjectPair getProjectionPaths() {
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
Set returned = new Set();
Set used = new Set();
ObjectObjectPair cur = subIters[0].getProjectionPaths();
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/LetIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/LetIterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/LetIterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -26,12 +26,15 @@
import ch.ethz.mxquery.datamodel.xdm.TokenInterface;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.model.CurrentBasedIterator;
import ch.ethz.mxquery.model.VariableHolder;
import ch.ethz.mxquery.model.Window;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.ContextPair;
import ch.ethz.mxquery.util.KXmlSerializer;
+import ch.ethz.mxquery.util.ObjectObjectPair;
+import ch.ethz.mxquery.util.Set;
public class LetIterator extends CurrentBasedIterator {
@@ -172,5 +175,14 @@
return this;
}
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
+ ObjectObjectPair curPath = subIters[0].getProjectionPaths();
+ varHolder.setProjectionPaths(new ObjectObjectPair(curPath.getFirst(), new Set()));
+ Set usedAll = new Set();
+ //usedAll.addAll((Set) curPath.getFirst());
+ usedAll.addAll((Set) curPath.getSecond());
+ return new ObjectObjectPair(new Set(), usedAll);
+ }
+
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/UserdefFuncCall.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/UserdefFuncCall.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/UserdefFuncCall.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -36,6 +36,8 @@
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.model.updatePrimitives.PendingUpdateList;
import ch.ethz.mxquery.util.KXmlSerializer;
+import ch.ethz.mxquery.util.ObjectObjectPair;
+import ch.ethz.mxquery.util.Set;
public class UserdefFuncCall extends CurrentBasedIterator {
protected QName[] paramNames;
@@ -376,5 +378,18 @@
public QName [] getClosure() {
return closure;
}
+
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
+ Set used = new Set();
+ for (int i = 0; i < this.subIters.length; i++) {
+ ObjectObjectPair paths = subIters[i].getProjectionPaths();
+ used.addAll((Set) paths.getSecond());
+ VariableHolder vh = this.context.getVariable(this.paramNames[i]);
+ vh.setProjectionPaths(new ObjectObjectPair(paths.getFirst(), new Set()));
+ }
+ ObjectObjectPair functPaths = function.getProjectionPaths();
+ used.addAll((Set) functPaths.getSecond());
+ return new ObjectObjectPair(functPaths.getFirst(), used);
+ }
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/XMLContent.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/XMLContent.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/XMLContent.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -15,6 +15,7 @@
package ch.ethz.mxquery.iterators;
+import java.util.Enumeration;
import java.util.Vector;
import ch.ethz.mxquery.bindings.WindowFactory;
@@ -44,6 +45,7 @@
import ch.ethz.mxquery.model.Iterator;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.KXmlSerializer;
+import ch.ethz.mxquery.util.ObjectObjectPair;
import ch.ethz.mxquery.util.Set;
import ch.ethz.mxquery.util.URIUtils;
@@ -607,6 +609,25 @@
this.pendingUpdateList.merge(constElemIterator.getPendingUpdateList());
}
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
+ Set returned = new Set();
+ Set used = new Set();
+
+ if (subIters != null)
+ for (int i=0;i<subIters.length;i++){
+ ObjectObjectPair cur = subIters[i].getProjectionPaths();
+ Enumeration returnedPaths = ((Set)cur.getFirst()).elements();
+ while (returnedPaths.hasMoreElements()) {
+ String curRetPath = (String)returnedPaths.nextElement();
+ used.add(curRetPath+" #");
+ }
+ used.addAll((Set)cur.getSecond());
+ }
+ return new ObjectObjectPair(returned, used);
+
+ }
+
+
// public void setContext(Context context, boolean recursive)
// throws MXQueryException {
// this.context.setParent(context);
Modified: trunk/MXQuery/src/ch/ethz/mxquery/model/Iterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/model/Iterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/model/Iterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -879,7 +879,7 @@
return arg.getText();
}
- public ObjectObjectPair getProjectionPaths() {
+ public ObjectObjectPair getProjectionPaths() throws StaticException {
XDMIterator [] subs = getAllSubIters();
if (subs != null && subs.length == 1)
return subs[0].getProjectionPaths();
Modified: trunk/MXQuery/src/ch/ethz/mxquery/model/XDMIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/model/XDMIterator.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/model/XDMIterator.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -24,6 +24,7 @@
import ch.ethz.mxquery.datamodel.xdm.TokenInterface;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.model.updatePrimitives.PendingUpdateList;
import ch.ethz.mxquery.util.KXmlSerializer;
import ch.ethz.mxquery.util.ObjectObjectPair;
@@ -212,7 +213,8 @@
* - returned
* - used
* @return Pair of Path Sets, first is returned, second is used
+ * @throws StaticException
*/
- public abstract ObjectObjectPair getProjectionPaths();
+ public abstract ObjectObjectPair getProjectionPaths() throws StaticException;
}
\ No newline at end of file
Modified: trunk/MXQuery/src/ch/ethz/mxquery/query/PreparedStatement.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/query/PreparedStatement.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/query/PreparedStatement.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -22,6 +22,7 @@
import ch.ethz.mxquery.datamodel.QName;
import ch.ethz.mxquery.datamodel.types.TypeInfo;
import ch.ethz.mxquery.exceptions.MXQueryException;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.Hashtable;
import ch.ethz.mxquery.xdmio.StoreSet;
@@ -147,7 +148,8 @@
/**
* Get the projection paths for all accessed resources
* @return a mapping from resourcename (URI, variable QName) -> Pair (returned, used) Paths
+ * @throws StaticException
*/
- public Hashtable getProjectionPaths();
+ public Hashtable getProjectionPaths() throws StaticException;
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -31,6 +31,7 @@
import ch.ethz.mxquery.exceptions.ErrorCodes;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.model.VariableHolder;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.query.PreparedStatement;
@@ -182,7 +183,7 @@
return ser;
}
- public Hashtable getProjectionPaths() {
+ public Hashtable getProjectionPaths() throws StaticException {
//Preliminary implementation, producing just a single doc
ObjectObjectPair paths = iter.getProjectionPaths();
Hashtable ht = new Hashtable();
Modified: trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -3915,13 +3915,16 @@
inscopevars[i], true, getCurrentLoc());
// orderedVars[i].setResettable(true);
}
- extendCurrentContextScope();
+ createNewContextScope();
for (int i = 0; i < inscopevars.length; i++) {
getCurrentContext().registerVariable(inscopevars[i], true);
}
- return new GOrderByIterator(getCurrentContext(), getCurrentLoc(),
+ GOrderByIterator ret = new GOrderByIterator(getCurrentContext(), getCurrentLoc(),
arrOptions, stable, orderedVars, arrExprs);
+ removeContextScope();
+
+ return ret;
}
private void collationSpecification() throws MXQueryException,
Modified: trunk/MXQuery/xqib_src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java
===================================================================
--- trunk/MXQuery/xqib_src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery/xqib_src/ch/ethz/mxquery/query/impl/PreparedStatementImpl.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -15,6 +15,8 @@
package ch.ethz.mxquery.query.impl;
import ch.ethz.mxquery.util.Hashtable;
+import ch.ethz.mxquery.util.ObjectObjectPair;
+
import java.util.Vector;
import com.google.gwt.dom.client.Document;
@@ -30,6 +32,7 @@
import ch.ethz.mxquery.exceptions.ErrorCodes;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.model.VariableHolder;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.query.PreparedStatement;
@@ -175,4 +178,11 @@
this.addExternalResource(new QName(varname), resource);
}
+ public Hashtable getProjectionPaths() throws StaticException {
+ //Preliminary implementation, producing just a single doc
+ ObjectObjectPair paths = iter.getProjectionPaths();
+ Hashtable ht = new Hashtable();
+ ht.put("DOC", paths);
+ return ht;
+ }
}
Modified: trunk/MXQuery_Android_App/.classpath
===================================================================
--- trunk/MXQuery_Android_App/.classpath 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery_Android_App/.classpath 2011-12-19 13:34:52 UTC (rev 4503)
@@ -4,5 +4,5 @@
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="/MXQuery/dist/mxquery-android.jar" sourcepath="/MXQuery/dist/mxquery-android-source.jar"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="bin/classes"/>
</classpath>
Added: trunk/MXQuery_Testing/ProjectionTests/queries/Comp1.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/Comp1.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/Comp1.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1 @@
+doc("xmark.xml")/site/regions/* = 3
Modified: trunk/MXQuery_Testing/ProjectionTests/queries/Cond1.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/Cond1.xq 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/Cond1.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -1,3 +1,3 @@
-if(true)
+if(true())
then doc("xmark.xml")/site/people/person
-else doc("xmark.xml")/site/open_auctions/open_auctions
\ No newline at end of file
+else doc("xmark.xml")/site/open_auctions/open_auction
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/Cond2.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/Cond2.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/Cond2.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,3 @@
+(if(true())
+then doc("xmark.xml")/site/people/person
+else doc("xmark.xml")/site/open_auctions/open_auction)/@id
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/Cond3.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/Cond3.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/Cond3.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,3 @@
+(if(doc("xmark.xml")/site/regions)
+then doc("xmark.xml")/site/people/person
+else doc("xmark.xml")/site/open_auctions/open_auction)/@id
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/Cond4.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/Cond4.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/Cond4.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,3 @@
+(if(count(doc("xmark.xml")/site/regions/*) = 3)
+then doc("xmark.xml")/site/people/person
+else doc("xmark.xml")/site/open_auctions/open_auction)/@id
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/ElemConstr1.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/ElemConstr1.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/ElemConstr1.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,3 @@
+<elem>{if(true())
+then doc("xmark.xml")/site/people/person
+else doc("xmark.xml")/site/open_auctions/open_auction}</elem>/@id
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/FLWOR2.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/FLWOR2.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/FLWOR2.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,3 @@
+for $a in doc("xmark.xml")/site/people/person
+order by $a/emailaddress
+return $a/name
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/Path3.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/Path3.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/Path3.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1 @@
+doc("xmark.xml")/site/people/person/@id
\ No newline at end of file
Modified: trunk/MXQuery_Testing/ProjectionTests/queries/XMark01.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark01.xq 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark01.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -1,3 +1,4 @@
-let $auction := doc()
-return for $b in $auction/site/people/person[@id = 'person0']
+let $auction := doc("xmark.xml")
+return for $b in $auction/site/people/person
+where $b/@id = 'person0'
return $b/name/text()
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark02.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark02.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark02.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,3 @@
+let $auction := doc("auction.xml") return
+for $b in $auction/site/open_auctions/open_auction
+return <increase>{$b/bidder[1]/increase/text()}</increase>
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark03.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark03.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark03.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,7 @@
+let $auction := doc("auction.xml") return
+for $b in $auction/site/open_auctions/open_auction
+where $b/bidder[1]/increase * 2 <= $b/bidder[last()]/increase
+return
+ <increase
+ first="{$b/bidder[1]/increase}"
+ last="{$b/bidder[last()]/increase}"/>
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark04.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark04.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark04.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,7 @@
+let $auction := doc("auction.xml") return
+for $b in $auction/site/open_auctions/open_auction
+where
+ some $pr1 in $b/bidder/personref[person = "person20"],
+ $pr2 in $b/bidder/personref[person = "person51"]
+ satisfies $pr1 << $pr2
+return <history>{$b/reserve/text()}</history>
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark05.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark05.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark05.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,5 @@
+let $auction := doc("auction.xml") return
+count(
+ for $i in $auction/site/closed_auctions/closed_auction
+ where $i/price >= 40
+ return $i/price)
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark06.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark06.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark06.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,2 @@
+let $auction := doc("auction.xml") return
+for $b in $auction//site/regions return count($b//item)
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark07.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark07.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark07.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,4 @@
+let $auction := doc("auction.xml") return
+for $p in $auction/site
+return
+ count($p//description) + count($p//annotation) + count($p//emailaddress)
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark08.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark08.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark08.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,7 @@
+let $auction := doc("auction.xml") return
+for $p in $auction/site/people/person
+let $a :=
+ for $t in $auction/site/closed_auctions/closed_auction
+ where $t/buyer/person = $p/id
+ return $t
+return <item person="{$p/name}">{count($a)}</item>
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark09.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark09.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark09.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,12 @@
+let $auction := doc("auction.xml") return
+let $ca := $auction/site/closed_auctions/closed_auction return
+let
+ $ei := $auction/site/regions/europe/item
+for $p in $auction/site/people/person
+let $a :=
+ for $t in $ca
+ where $p/id = $t/buyer/person
+ return
+ let $n := for $t2 in $ei where $t/itemref/item = $t2/id return $t2
+ return <item>{$n/name}</item>
+return <person name="{$p/name}">{$a}</person>
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark10.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark10.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark10.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,27 @@
+let $auction := doc("auction.xml") return
+for $i in
+ distinct-values($auction/site/people/person/profile/interest/category)
+let $p :=
+ for $t in $auction/site/people/person
+ where $t/profile/interest/category = $i
+ return
+ <personne>
+ <statistiques>
+ <sexe>{$t/profile/gender}</sexe>
+ <age>{$t/profile/age}</age>
+ <education>{$t/profile/education}</education>
+ <revenu>{fn:data($t/profile/income)}</revenu>
+ </statistiques>
+ <coordonnees>
+ <nom>{$t/name}</nom>
+ <rue>{$t/address/street}</rue>
+ <ville>{$t/address/city}</ville>
+ <pays>{$t/address/country}</pays>
+ <reseau>
+ <courrier>{$t/emailaddress}</courrier>
+ <pagePerso>{$t/homepage}</pagePerso>
+ </reseau>
+ </coordonnees>
+ <cartePaiement>{$t/creditcard}</cartePaiement>
+ </personne>
+return <categorie>{<id>{$i}</id>, $p}</categorie>
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark11.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark11.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark11.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,7 @@
+let $auction := doc("auction.xml") return
+for $p in $auction/site/people/person
+let $l :=
+ for $i in $auction/site/open_auctions/open_auction/initial
+ where $p/profile/income > 5000 * $i
+ return $i
+return <items name="{$p/name}">{count($l)}</items>
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark12.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark12.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark12.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,8 @@
+let $auction := doc("auction.xml") return
+for $p in $auction/site/people/person
+let $l :=
+ for $i in $auction/site/open_auctions/open_auction/initial
+ where $p/profile/income > 5000 * $i
+ return $i
+where $p/profile/income > 50000
+return <items person="{$p/profile/income}">{count($l)}</items>
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark13.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark13.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark13.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,3 @@
+let $auction := doc("auction.xml") return
+for $i in $auction/site/regions/australia/item
+return <item name="{$i/name}">{$i/description}</item>
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark14.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark14.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark14.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,4 @@
+let $auction := doc("auction.xml") return
+for $i in $auction/site//item
+where contains($i/description, "gold")
+return $i/name
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark15.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark15.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark15.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,11 @@
+let $auction := doc("auction.xml") return
+for $a in
+ $auction/site/closed_auctions/closed_auction/annotation/description/parlist/
+ listitem/
+ parlist/
+ listitem/
+ text/
+ emph/
+ keyword/
+ text()
+return <text>{$a}</text>
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark16.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark16.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark16.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,10 @@
+let $auction := doc("auction.xml") return
+for $a in $auction/site/closed_auctions/closed_auction
+where
+ not(
+ empty(
+ $a/annotation/description/parlist/listitem/parlist/listitem/text/emph/
+ keyword
+ )
+ )
+return <person id="{$a/seller/person}"/>
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark17.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark17.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark17.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,4 @@
+let $auction := doc("auction.xml") return
+for $p in $auction/site/people/person
+where empty($p/homepage)
+return <person name="{$p/name}"/>
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark18.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark18.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark18.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,9 @@
+declare namespace local = "http://www.foobar.org";
+declare function local:convert($v as xs:decimal?) as xs:decimal?
+{
+ 2.20371 * $v (: convert Dfl to Euro :)
+};
+
+let $auction := doc("auction.xml") return
+for $i in $auction/site/open_auctions/open_auction
+return local:convert($i/reserve)
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark19.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark19.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark19.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,5 @@
+let $auction := doc("auction.xml") return
+for $b in $auction/site/regions//item
+let $k := $b/name
+order by $b/location ascending empty greatest
+return <item name="{$k}">{$b/location}</item>
\ No newline at end of file
Added: trunk/MXQuery_Testing/ProjectionTests/queries/XMark20.xq
===================================================================
--- trunk/MXQuery_Testing/ProjectionTests/queries/XMark20.xq (rev 0)
+++ trunk/MXQuery_Testing/ProjectionTests/queries/XMark20.xq 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,26 @@
+let $auction := doc("auction.xml") return
+<result>
+ <preferred>
+ {count($auction/site/people/person/profile[income >= 100000])}
+ </preferred>
+ <standard>
+ {
+ count(
+ $auction/site/people/person/
+ profile[income < 100000 and income >= 30000]
+ )
+ }
+ </standard>
+ <challenge>
+ {count($auction/site/people/person/profile[income < 30000])}
+ </challenge>
+ <na>
+ {
+ count(
+ for $p in $auction/site/people/person
+ where empty($p/profile/income)
+ return $p
+ )
+ }
+ </na>
+</result>
Modified: trunk/MXQuery_Testing/src/ch/ethz/mxquery/test/ProjectionTests.java
===================================================================
--- trunk/MXQuery_Testing/src/ch/ethz/mxquery/test/ProjectionTests.java 2011-12-19 13:28:47 UTC (rev 4502)
+++ trunk/MXQuery_Testing/src/ch/ethz/mxquery/test/ProjectionTests.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -87,6 +87,15 @@
//assertEquals(resultBuffer.toString().trim(), "false");
}
+ public void test_Comp1() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"Comp1.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ }
+
public void test_FLWOR1() throws Exception{
String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"FLWOR1.xq");
@@ -97,16 +106,24 @@
//assertEquals(resultBuffer.toString().trim(), "false");
}
-
- public void test_XMark01() throws Exception{
- String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark01.xq");
+ public void test_FLWOR2() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"FLWOR2.xq");
PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
Hashtable ht = pi.getProjectionPaths();
handleProjectionPaths(ht);
//assertEquals(resultBuffer.toString().trim(), "false");
- };
+ }
+ public void test_ElemConstr1() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"ElemConstr1.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ }
+
private void handleProjectionPaths(Hashtable projPaths) {
ObjectObjectPair paths = (ObjectObjectPair) projPaths.get("DOC");
Set returned = (Set) paths.getFirst();
Added: trunk/MXQuery_Testing/src/ch/ethz/mxquery/test/ProjectionXMarkTests.java
===================================================================
--- trunk/MXQuery_Testing/src/ch/ethz/mxquery/test/ProjectionXMarkTests.java (rev 0)
+++ trunk/MXQuery_Testing/src/ch/ethz/mxquery/test/ProjectionXMarkTests.java 2011-12-19 13:34:52 UTC (rev 4503)
@@ -0,0 +1,231 @@
+/**
+ *
+ */
+package ch.ethz.mxquery.test;
+
+import java.util.Enumeration;
+
+
+import ch.ethz.mxquery.query.PreparedStatement;
+import ch.ethz.mxquery.testsuite.XQueryTestBase;
+import ch.ethz.mxquery.util.Hashtable;
+import ch.ethz.mxquery.util.ObjectObjectPair;
+import ch.ethz.mxquery.util.Set;
+
+
+/**
+ * @author petfisch
+ *
+ */
+public class ProjectionXMarkTests extends XQueryTestBase{
+
+ private static final String TEST_PROJECTION_PREFIX = "ProjectionTests";
+ private static final String TEST_PROJECTION_QUERY_PREFIX = TEST_PROJECTION_PREFIX+"/queries/";
+
+ public void test_XMark01() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark01.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ public void test_XMark02() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark02.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ public void test_XMark03() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark03.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark04() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark04.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ public void test_XMark05() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark05.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark06() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark06.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark07() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark07.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ public void test_XMark08() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark08.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark09() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark09.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark10() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark10.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark11() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark11.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ public void test_XMark12() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark12.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ public void test_XMark13() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark13.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark14() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark14.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark15() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark15.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark16() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark16.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+
+ public void test_XMark17() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark17.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ public void test_XMark18() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark18.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ public void test_XMark19() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark19.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ public void test_XMark20() throws Exception{
+ String query = UriToString(TEST_PROJECTION_QUERY_PREFIX+"XMark20.xq");
+ PreparedStatement pi = prepareQuery(query, false,false, false, false, false);
+ Hashtable ht = pi.getProjectionPaths();
+ handleProjectionPaths(ht);
+
+ //assertEquals(resultBuffer.toString().trim(), "false");
+ };
+
+ private void handleProjectionPaths(Hashtable projPaths) {
+ ObjectObjectPair paths = (ObjectObjectPair) projPaths.get("DOC");
+ Set returned = (Set) paths.getFirst();
+ Set used = (Set) paths.getSecond();
+ Enumeration en = returned.elements();
+ while (en.hasMoreElements()) {
+ String curPath = (String) en.nextElement();
+ System.out.println(curPath+" #");
+ }
+ en = used.elements();
+ while (en.hasMoreElements()) {
+ String curPath = (String) en.nextElement();
+ System.out.println(curPath);
+ }
+ };
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|