|
From: <pm_...@us...> - 2012-03-12 06:39:31
|
Revision: 4533
http://mxquery.svn.sourceforge.net/mxquery/?rev=4533&view=rev
Author: pm_fischer
Date: 2012-03-12 06:39:25 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
- data flow analysis for node id requirements
- small performance improvements for child
- suppress logging output in parser
Modified Paths:
--------------
trunk/MXQuery/src/ch/ethz/mxquery/functions/fn/Put.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/DocOrderIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/ExceptIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/IntersectIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/iterators/UnionIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/model/CurrentBasedIterator.java
trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java
Modified: trunk/MXQuery/src/ch/ethz/mxquery/functions/fn/Put.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/functions/fn/Put.java 2012-03-02 10:01:31 UTC (rev 4532)
+++ trunk/MXQuery/src/ch/ethz/mxquery/functions/fn/Put.java 2012-03-12 06:39:25 UTC (rev 4533)
@@ -91,7 +91,7 @@
File fn = new File(uri);
UpdateableStore putStore = null;
- if (!(targetID.getStore() instanceof UpdateableStore))
+ if (targetID == null || !(targetID.getStore() instanceof UpdateableStore))
{
putStore = nodeParam.getContext().getStores().createUpdateableStore(uri.toString(),nodeParam,true, true);
putStore.materialize();
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/ChildIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/ChildIterator.java 2012-03-02 10:01:31 UTC (rev 4532)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/ChildIterator.java 2012-03-12 06:39:25 UTC (rev 4533)
@@ -122,25 +122,25 @@
this.called++;
TokenInterface tok = Token.START_SEQUENCE_TOKEN;
- int type = tok.getEventType();
- while (type != Type.END_SEQUENCE) {
+ //int type = tok.getEventType();
+ curEventType = Type.START_SEQUENCE;
+ while (curEventType != Type.END_SEQUENCE) {
// next on child iterator
tok = getNext();
- type = tok.getEventType();
- if (type == Type.END_SEQUENCE)
+ if (curEventType == Type.END_SEQUENCE)
return tok;
- if (!Type.isNode(type))
+ if (!Type.isNode(curEventType))
throw new TypeException(ErrorCodes.E0019_TYPE_STEP_RESULT_IS_ATOMIC, "Child axis applied on non-node",loc );
- if (depth == 1 && tok.getEventType() == Type.START_TAG || tok.getEventType() == Type.START_DOCUMENT)
+ if (depth == 1 && curEventType == Type.START_TAG || curEventType == Type.START_DOCUMENT)
newParent = true;
int targetDepth = 1;
if (match) { // if current node is already matching the child
// condition
- if (type == Type.END_TAG && depth == targetDepth
+ if (curEventType == Type.END_TAG && depth == targetDepth
&& (tok.getName().equals(lastStep))) { // child
// if the current depth is equal to initial depth, it's the
// end of the matching sequence
@@ -163,19 +163,18 @@
continue;
break;
case Type.TYPE_NK_ANY_NODE_TEST:
- if (boundNode == null && (type == Type.START_DOCUMENT || type == Type.START_TAG)) {
+ if (boundNode == null && (curEventType == Type.START_DOCUMENT || curEventType == Type.START_TAG)) {
boundNode = tok;
tok = getNext();
- type = tok.getEventType();
}
if (depth == 0)
boundNode = null;
- if ((depth != targetDepth && depth != targetDepth+1) || Type.isAttribute(tok.getEventType()) || !CheckNodeType.checkNode(tok))
+ if ((depth != targetDepth && depth != targetDepth+1) || Type.isAttribute(curEventType) || !CheckNodeType.checkNode(tok))
continue;
- else if (type == Type.START_TAG)
+ else if (curEventType == Type.START_TAG)
match = true; // set match flag to true if there is nested content
// skip over the bound node's END token
- if (depth == 1 && type == Type.END_TAG && boundNode != null && boundNode.getName() != null && boundNode.getName().equals(tok.getName()))
+ if (depth == 1 && curEventType == Type.END_TAG && boundNode != null && boundNode.getName() != null && boundNode.getName().equals(tok.getName()))
continue;
break;
@@ -184,9 +183,8 @@
while (depth == 1) {
tok = getNext();
}
- type = tok.getEventType();
- if (depth != targetDepth || type != Type.START_TAG
+ if (depth != targetDepth || curEventType != Type.START_TAG
|| (!CheckNodeType.step_comparison(tok,step_uri,step_local)))
continue;
else {
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/CompareIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/CompareIterator.java 2012-03-02 10:01:31 UTC (rev 4532)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/CompareIterator.java 2012-03-12 06:39:25 UTC (rev 4533)
@@ -31,6 +31,7 @@
import ch.ethz.mxquery.exceptions.StaticException;
import ch.ethz.mxquery.exceptions.TypeException;
import ch.ethz.mxquery.model.Constants;
+import ch.ethz.mxquery.model.DataflowAnalysis;
import ch.ethz.mxquery.model.TokenBasedIterator;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.KXmlSerializer;
@@ -334,5 +335,11 @@
return new ObjectObjectPair(returned, used);
}
+ public XDMIterator require(int requiredOptions) throws MXQueryException {
+ if (compareType == Constants.COMP_NODE)
+ requiredOptions = requiredOptions | DataflowAnalysis.NODEID_ORDER;
+ return super.require(requiredOptions);
+ }
+
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/DocOrderIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/DocOrderIterator.java 2012-03-02 10:01:31 UTC (rev 4532)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/DocOrderIterator.java 2012-03-12 06:39:25 UTC (rev 4533)
@@ -29,7 +29,9 @@
import ch.ethz.mxquery.exceptions.ErrorCodes;
import ch.ethz.mxquery.exceptions.MXQueryException;
import ch.ethz.mxquery.exceptions.QueryLocation;
+import ch.ethz.mxquery.model.Constants;
import ch.ethz.mxquery.model.CurrentBasedIterator;
+import ch.ethz.mxquery.model.DataflowAnalysis;
import ch.ethz.mxquery.model.Window;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.QuickSort;
@@ -174,5 +176,8 @@
return new MXQueryDouble(0);
}
+ public XDMIterator require(int requiredOptions) throws MXQueryException {
+ return super.require(requiredOptions | DataflowAnalysis.NODEID_ORDER);
+ }
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/ExceptIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/ExceptIterator.java 2012-03-02 10:01:31 UTC (rev 4532)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/ExceptIterator.java 2012-03-12 06:39:25 UTC (rev 4533)
@@ -27,6 +27,7 @@
import ch.ethz.mxquery.exceptions.QueryLocation;
import ch.ethz.mxquery.exceptions.TypeException;
import ch.ethz.mxquery.model.CurrentBasedIterator;
+import ch.ethz.mxquery.model.DataflowAnalysis;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.Set;
@@ -158,4 +159,10 @@
protected XDMIterator copy(Context context, XDMIterator[] subIters, Vector nestedPredCtxStack) throws MXQueryException {
return new ExceptIterator(context, subIters[0], subIters[1], loc);
}
+
+ public XDMIterator require(int requiredOptions) throws MXQueryException {
+ return super.require(requiredOptions | DataflowAnalysis.NODEID_ORDER);
+ }
+
+
}
\ No newline at end of file
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/IntersectIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/IntersectIterator.java 2012-03-02 10:01:31 UTC (rev 4532)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/IntersectIterator.java 2012-03-12 06:39:25 UTC (rev 4533)
@@ -26,6 +26,7 @@
import ch.ethz.mxquery.exceptions.QueryLocation;
import ch.ethz.mxquery.exceptions.TypeException;
import ch.ethz.mxquery.model.CurrentBasedIterator;
+import ch.ethz.mxquery.model.DataflowAnalysis;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.Set;
@@ -136,4 +137,9 @@
protected XDMIterator copy(Context context, XDMIterator[] subIters, Vector nestedPredCtxStack) throws MXQueryException {
return new IntersectIterator(context, subIters[0], subIters[1],loc);
}
+
+ public XDMIterator require(int requiredOptions) throws MXQueryException {
+ return super.require(requiredOptions | DataflowAnalysis.NODEID_ORDER);
+ }
+
}
\ No newline at end of file
Modified: trunk/MXQuery/src/ch/ethz/mxquery/iterators/UnionIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/iterators/UnionIterator.java 2012-03-02 10:01:31 UTC (rev 4532)
+++ trunk/MXQuery/src/ch/ethz/mxquery/iterators/UnionIterator.java 2012-03-12 06:39:25 UTC (rev 4533)
@@ -26,6 +26,7 @@
import ch.ethz.mxquery.exceptions.QueryLocation;
import ch.ethz.mxquery.exceptions.TypeException;
import ch.ethz.mxquery.model.CurrentBasedIterator;
+import ch.ethz.mxquery.model.DataflowAnalysis;
import ch.ethz.mxquery.model.XDMIterator;
import ch.ethz.mxquery.util.Set;
@@ -167,4 +168,9 @@
Vector nestedPredCtxStack) throws MXQueryException {
return new UnionIterator(context, subIters[0], subIters[1], loc);
}
+
+ public XDMIterator require(int requiredOptions) throws MXQueryException {
+ return super.require(requiredOptions | DataflowAnalysis.NODEID_ORDER);
+ }
+
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/model/CurrentBasedIterator.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/model/CurrentBasedIterator.java 2012-03-02 10:01:31 UTC (rev 4532)
+++ trunk/MXQuery/src/ch/ethz/mxquery/model/CurrentBasedIterator.java 2012-03-12 06:39:25 UTC (rev 4533)
@@ -25,7 +25,7 @@
public abstract class CurrentBasedIterator extends Iterator {
protected XDMIterator current = null;
-
+ protected int curEventType = Type.END_SEQUENCE;
public CurrentBasedIterator(){
this(null, null, null);
}
@@ -45,10 +45,10 @@
protected TokenInterface getNext() throws MXQueryException {
TokenInterface tok = current.next();
- int i = tok.getEventType();
- if (i == Type.START_TAG || i == Type.START_DOCUMENT) {
+ curEventType = tok.getEventType();
+ if (curEventType == Type.START_TAG || curEventType == Type.START_DOCUMENT) {
depth++;
- } else if (i == Type.END_TAG || i == Type.END_DOCUMENT) {
+ } else if (curEventType == Type.END_TAG || curEventType == Type.END_DOCUMENT) {
depth--;
}
Modified: trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java
===================================================================
--- trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java 2012-03-02 10:01:31 UTC (rev 4532)
+++ trunk/MXQuery/src/ch/ethz/mxquery/query/parser/Parser.java 2012-03-12 06:39:25 UTC (rev 4533)
@@ -371,8 +371,8 @@
CompilerOptions co, Hashtable options, String locationInfo,
Object queryVersion) throws MXQueryException {
long parseTime = 0;
- if (logger.isLoggable(LogLevel.INFO)) {
- logger.log(LogLevel.INFO,"Parsing started");
+ if (logger.isLoggable(LogLevel.FINE)) {
+ logger.log(LogLevel.FINE,"Parsing started");
parseTime = System.currentTimeMillis();
}
this.query = query;
@@ -392,9 +392,9 @@
}
Iterator result = Module();
- if (logger.isLoggable(LogLevel.INFO)) {
+ if (logger.isLoggable(LogLevel.FINE)) {
long parseDuration = System.currentTimeMillis() - parseTime;
- logger.log(LogLevel.INFO,"Parsing completed, took "+parseDuration+ " ms");
+ logger.log(LogLevel.FINE,"Parsing completed, took "+parseDuration+ " ms");
}
if (result != null) {
if (index < queryLen) {
@@ -1748,7 +1748,7 @@
}
getCurrentContext().addFunction(fn);
- logger.log(LogLevel.INFO, "Completed parsing function "+qname.toString()+ " took "+(System.currentTimeMillis()-startTime));
+ logger.log(LogLevel.FINE, "Completed parsing function "+qname.toString()+ " took "+(System.currentTimeMillis()-startTime));
return true;
} else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|