Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version 6.3:

[ADD] XQuery: hierarchical path support for collection() function
[ADD] Storage/GUI: CatalogResolver added for caching DTDs
[ADD] Server: -c flag added to allow initial database commands
[ADD] Dutch translation of BaseX added; thanks to Huib Verweij!
[MOD] Storage: Speedup of parallel disk access (less synchronized flags)
[MOD] XQuery: iterative evaluation of more location paths
[MOD] XQuery Full Text: updated to reflect fix of W3 Bug #9448
[FIX] XQuery: numerous namespace issues resolved
[FIX] XQuery: allow dynamic evaluation of basex:index()
[FIX] GUI: PlotView and TreeView fixes
  • Loading branch information...
commit 38f956b33de54f651f60fb1f3d84ff266df6828e 1 parent 0938166
christian gruen authored
Showing with 61 additions and 60 deletions.
  1. +3 −3 src/main/java/org/basex/gui/GUI.java
  2. +0 −1  src/main/java/org/basex/gui/dialog/DialogCreate.java
  3. +2 −2 src/main/java/org/basex/gui/dialog/DialogPrefs.java
  4. +0 −1  src/main/java/org/basex/gui/view/tree/TreeNodeCache.java
  5. +2 −2 src/main/java/org/basex/gui/view/tree/TreeView.java
  6. +1 −1  src/main/java/org/basex/gui/view/tree/TreeViewOptions.java
  7. +5 −6 src/main/java/org/basex/query/QueryContext.java
  8. +2 −3 src/main/java/org/basex/query/expr/CAttr.java
  9. +0 −1  src/main/java/org/basex/query/expr/CElem.java
  10. +2 −3 src/main/java/org/basex/query/func/FNQName.java
  11. +14 −6 src/main/java/org/basex/query/item/Bln.java
  12. +2 −2 src/main/java/org/basex/query/item/Nod.java
  13. +0 −1  src/main/java/org/basex/query/up/primitives/NodeCopy.java
  14. +6 −1 src/main/java/org/basex/query/up/primitives/Put.java
  15. +0 −1  src/main/java/org/basex/query/up/primitives/ReplaceElemContent.java
  16. +8 −8 src/main/java/org/basex/query/up/primitives/UpdatePrimitive.java
  17. +0 −1  src/main/java/org/basex/server/Log.java
  18. +4 −4 src/main/java/org/basex/util/InputInfo.java
  19. +1 −1  src/main/java/org/basex/util/TokenMap.java
  20. +0 −1  src/main/java/org/basex/util/locale/Formatter.java
  21. +7 −8 src/test/java/org/basex/test/collections/PathTest.java
  22. +2 −3 src/test/java/org/basex/test/query/NamespaceTest.java
View
6 src/main/java/org/basex/gui/GUI.java
@@ -494,14 +494,14 @@ boolean exec(final Command c, final boolean main) {
final Data ndata = context.data;
Nodes marked = context.marked;
-
+
if(ndata != data) {
// database reference has changed - notify views
notify.init();
- // [LK] check if context really changed - an empty
+ // [LK] check if context really changed - an empty
// updating function i.e.
// sets up==true, but does not change the current context
- //
+ //
} else if(up) {
// update command
notify.update();
View
1  src/main/java/org/basex/gui/dialog/DialogCreate.java
@@ -4,7 +4,6 @@
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-
import org.basex.core.Prop;
import org.basex.core.cmd.List;
import org.basex.gui.GUI;
View
4 src/main/java/org/basex/gui/dialog/DialogPrefs.java
@@ -112,7 +112,7 @@ public void actionPerformed(final ActionEvent e) {
lang = new BaseXCombo(LANGS[0], this);
lang.setSelectedItem(prop.get(Prop.LANGUAGE));
-
+
p.add(lang);
creds = new BaseXLabel();
p.add(creds);
@@ -129,7 +129,7 @@ public void actionPerformed(final ActionEvent e) {
}
@Override
- public void action(final Object cmp) {
+ public void action(final Object cmp) {
creds.setText(TRANSLATION + creds(lang.getSelectedItem().toString()));
gui.notify.layout();
}
View
1  src/main/java/org/basex/gui/view/tree/TreeNodeCache.java
@@ -1,7 +1,6 @@
package org.basex.gui.view.tree;
import java.util.ArrayList;
-
import org.basex.data.Data;
import org.basex.util.IntList;
View
4 src/main/java/org/basex/gui/view/tree/TreeView.java
@@ -179,7 +179,7 @@ public void paintComponent(final Graphics g) {
return;
}
}
-
+
smooth(g);
g.setFont(font);
fontHeight = g.getFontMetrics().getHeight();
@@ -302,7 +302,7 @@ private void createNewMainImage() {
}
/**
- * Displays Message if there is not enough space to draw all roots or an
+ * Displays Message if there is not enough space to draw all roots or an
* attribute-context but no attributes in cache.
* @param g graphics reference
* @param t type
View
2  src/main/java/org/basex/gui/view/tree/TreeViewOptions.java
@@ -79,5 +79,5 @@
byte NOT_ENOUGH_SPACE = 0;
/** Show no attributes text. */
byte NO_ATTS = 1;
-
+
}
View
11 src/main/java/org/basex/query/QueryContext.java
@@ -9,7 +9,6 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
-
import org.basex.core.Context;
import org.basex.core.Progress;
import org.basex.core.Prop;
@@ -167,7 +166,7 @@
public Updates updates = new Updates(false);
/** Indicates if this query performs updates. */
public boolean updating;
- /** MemData references of copied nodes, resulting from
+ /** MemData references of copied nodes, resulting from
* transform expression. */
public final Set<Data> copiedNods = new HashSet<Data>();
@@ -315,7 +314,7 @@ protected Result eval() throws QueryException {
}
return ir;
}
-
+
/**
* Determines if the given node has been constructed via a transform
* expression.
@@ -326,7 +325,7 @@ public boolean isCopiedNod(final Nod nod) {
if(!(nod instanceof DBNode)) return false;
return copiedNods.contains(((DBNode) nod).data);
}
-
+
/**
* Returns a result iterator.
* @return result iterator
@@ -562,7 +561,7 @@ private void addDocs(final DBNode db, final byte[] input) {
final boolean rt = input.length == 0;
final byte[] path = endsWith(input, token("/")) ? concat(token("/"), input)
- : concat(token("/"), input, token("/"));
+ : concat(token("/"), input, token("/"));
for(int p = 0; p < data.meta.size; p += data.size(p, data.kind(p))) {
final DBNode dbn = new DBNode(data, p);
if(rt) {
@@ -572,7 +571,7 @@ private void addDocs(final DBNode db, final byte[] input) {
// add documents which match specified input path
final byte[] name = lc(Token.concat(Token.token("/"),
data.text(p, true)));
- if(eq(name, concat(token("/"), input)) || startsWith(name, path))
+ if(eq(name, concat(token("/"), input)) || startsWith(name, path))
col.add(dbn);
}
}
View
5 src/main/java/org/basex/query/expr/CAttr.java
@@ -62,13 +62,12 @@ public FAttr item(final QueryContext ctx, final InputInfo ii)
final byte[] uri = name.uri().atom();
if(eq(pre, XMLNS) || eq(ln, XMLNS) || eq(uri, XMLNSURI)
|| eq(pre, XML) ^ eq(uri, XMLURI)) CAINS.thrw(input, pre, uri);
-
+
if(eq(pre, EMPTY) && !eq(uri, EMPTY)) {
// create a prefix if none is given but a URI exists
-
}
}
-
+
final TokenBuilder tb = new TokenBuilder();
for(final Expr e : expr) add(tb, ctx.iter(e));
byte[] val = tb.finish();
View
1  src/main/java/org/basex/query/expr/CElem.java
@@ -13,7 +13,6 @@
import org.basex.query.item.QNm;
import org.basex.query.item.Type;
import static org.basex.query.util.Err.*;
-
import org.basex.query.util.NSGlobal;
import org.basex.query.util.Var;
import org.basex.util.Atts;
View
5 src/main/java/org/basex/query/func/FNQName.java
@@ -3,7 +3,6 @@
import static org.basex.query.QueryTokens.*;
import static org.basex.query.util.Err.*;
import static org.basex.util.Token.*;
-
import org.basex.query.QueryContext;
import org.basex.query.QueryException;
import org.basex.query.expr.Expr;
@@ -78,11 +77,11 @@ public Item item(final QueryContext ctx, final InputInfo ii)
return !nm.ns() ? null : new NCN(nm.pref(), input);
case NSURIPRE: // [LW][LK] broken...
final byte[] pre = checkEStr(it);
-
+
// [LK] find out if inherit flag has a persistent effect - if positive,
// we're screwed. test case added to unresolved namespace tests.
final Nod nod = (Nod) checkType(it2, Type.ELM);
- final Atts at = nod.nsScope(ctx.isCopiedNod(nod) ?
+ final Atts at = nod.nsScope(ctx.isCopiedNod(nod) ?
ctx.nsInherit : true);
final int i = at != null ? at.get(pre) : -1;
return i != -1 ? Uri.uri(at.val[i]) : null;
View
20 src/main/java/org/basex/query/item/Bln.java
@@ -14,21 +14,29 @@
* @author Christian Gruen
*/
public final class Bln extends Item {
- /** Static boolean item (use with care). */
- public static final Bln TRUE = new Bln(true, 0);
- /** Static boolean item (use with care). */
- public static final Bln FALSE = new Bln(false, 0);
+ /** Static boolean item without scoring. */
+ public static final Bln TRUE = new Bln(true);
+ /** Static boolean item without scoring. */
+ public static final Bln FALSE = new Bln(false);
/** Data. */
private final boolean val;
/**
* Constructor, adding a full-text score.
* @param b boolean value
- * @param s score value
*/
- private Bln(final boolean b, final double s) {
+ private Bln(final boolean b) {
super(Type.BLN);
val = b;
+ }
+
+ /**
+ * Constructor, adding a full-text score.
+ * @param b boolean value
+ * @param s score value
+ */
+ private Bln(final boolean b, final double s) {
+ this(b);
score = s;
}
View
4 src/main/java/org/basex/query/item/Nod.java
@@ -124,7 +124,7 @@ public Atts ns() {
public final Atts nsScope() {
return nsScope(true);
}
-
+
/**
* Returns the namespace hierarchy.
* @param nsInherit copy-namespaces inherit
@@ -147,7 +147,7 @@ public final Atts nsScope(final boolean nsInherit) {
} while(n != null && n.type == Type.ELM);
return ns;
}
-
+
/**
* Returns the uri for the specified prefix.
* @param pref prefix
View
1  src/main/java/org/basex/query/up/primitives/NodeCopy.java
@@ -1,7 +1,6 @@
package org.basex.query.up.primitives;
import java.util.LinkedList;
-
import org.basex.data.Data;
import org.basex.data.MemData;
import org.basex.query.QueryException;
View
7 src/main/java/org/basex/query/up/primitives/Put.java
@@ -2,6 +2,8 @@
import static org.basex.query.util.Err.*;
import java.io.IOException;
+import org.basex.data.DataText;
+import org.basex.data.SerializerProp;
import org.basex.data.XMLSerializer;
import org.basex.io.PrintOutput;
import org.basex.query.QueryException;
@@ -36,7 +38,10 @@ public void apply(final int add) throws QueryException {
PrintOutput out = null;
try {
out = new PrintOutput(Token.string(path()));
- node.serialize(new XMLSerializer(out));
+ final SerializerProp sp = new SerializerProp();
+ sp.set(SerializerProp.S_INDENT, DataText.NO);
+ XMLSerializer xml = new XMLSerializer(out, sp);
+ node.serialize(xml);
} catch(final IOException ex) {
UPPUTERR.thrw(input, path());
} finally {
View
1  src/main/java/org/basex/query/up/primitives/ReplaceElemContent.java
@@ -1,7 +1,6 @@
package org.basex.query.up.primitives;
import static org.basex.query.util.Err.*;
-
import org.basex.data.Data;
import org.basex.data.MemData;
import org.basex.query.QueryException;
View
16 src/main/java/org/basex/query/up/primitives/UpdatePrimitive.java
@@ -138,7 +138,7 @@ public static MemData buildDB(final NodIter ch, final MemData md,
int pre = 1;
Nod n;
- while((n = ch.next()) != null) pre = addNode(null, n, md, pre, 0,
+ while((n = ch.next()) != null) pre = addNode(null, n, md, pre, 0,
ctx == null ? true : ctx.nsPreserve,
ctx == null ? true : ctx.nsInherit);
return md;
@@ -159,9 +159,9 @@ public static MemData buildDB(final NodIter ch, final MemData md,
*/
private static int addNode(final Nod ndPar, final Nod nd, final MemData m,
final int pre, final int par, final boolean nsPreserve,
- final boolean nsInherit)
+ final boolean nsInherit)
throws QueryException {
-
+
final int k = Nod.kind(nd.type);
final int ms = m.meta.size;
switch(k) {
@@ -171,7 +171,7 @@ private static int addNode(final Nod ndPar, final Nod nd, final MemData m,
int p = pre + 1;
NodeIter ir = nd.child();
Nod i;
- while((i = ir.next()) != null) p = addNode(null, i, m, p, pre,
+ while((i = ir.next()) != null) p = addNode(null, i, m, p, pre,
nsPreserve, nsInherit);
return p;
// [LK] preserve/inherit - any effects here?
@@ -210,12 +210,12 @@ private static int addNode(final Nod ndPar, final Nod nd, final MemData m,
// remove them to avoid duplicates
final Atts ns2 = nd.nsScope();
int uid;
- if((uid = ns2.get(EMPTY)) != -1)
+ if((uid = ns2.get(EMPTY)) != -1)
ns.add(ns2.key[uid], ns2.val[uid]);
} else {
ns = par == 0 ? nd.nsScope() : nd.ns();
}
-
+
// remove duplicate namespace bindings
if(ns != null) {
if(ns.size > 0 && ndPar != null && nsPreserve) {
@@ -242,10 +242,10 @@ private static int addNode(final Nod ndPar, final Nod nd, final MemData m,
m.insert(ms);
ir = nd.attr();
p = pre + 1;
- while((i = ir.next()) != null) p = addNode(nd, i, m, p, pre,
+ while((i = ir.next()) != null) p = addNode(nd, i, m, p, pre,
nsPreserve, nsInherit);
ir = nd.child();
- while((i = ir.next()) != null) p = addNode(nd, i, m, p, pre,
+ while((i = ir.next()) != null) p = addNode(nd, i, m, p, pre,
nsPreserve, nsInherit);
m.ns.close(ms);
return p;
View
1  src/main/java/org/basex/server/Log.java
@@ -1,7 +1,6 @@
package org.basex.server;
import static org.basex.core.Text.*;
-
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
View
8 src/main/java/org/basex/util/InputInfo.java
@@ -27,16 +27,16 @@ public InputInfo(final InputParser p) {
pos = p.qp;
file = p.file;
}
-
+
/**
- * Getter for line and column number.
+ * Getter for line and column number.
* @return two element array of line and column number
*/
public int[] lineCol() {
if(lc == null) lc = lineCol(query, Math.min(pos - 1, query.length()));
return lc;
}
-
+
/**
* Calculates the column and line number of a given offset in the string.
* @param qu query string
@@ -51,7 +51,7 @@ public InputInfo(final InputParser p) {
}
return lc;
}
-
+
@Override
public String toString() {
final int[] p = lineCol();
View
2  src/main/java/org/basex/util/TokenMap.java
@@ -46,7 +46,7 @@ protected void rehash() {
super.rehash();
values = Array.copyOf(values, size << 1);
}
-
+
@Override
public String toString() {
final TokenBuilder tb = new TokenBuilder("TokenMap[");
View
1  src/main/java/org/basex/util/locale/Formatter.java
@@ -1,7 +1,6 @@
package org.basex.util.locale;
import java.util.HashMap;
-
import org.basex.util.Util;
/**
View
15 src/test/java/org/basex/test/collections/PathTest.java
@@ -1,7 +1,6 @@
package org.basex.test.collections;
import static org.junit.Assert.*;
-
import org.basex.core.BaseXException;
import org.basex.core.Context;
import org.basex.core.cmd.Add;
@@ -61,7 +60,7 @@ public static void after() throws BaseXException {
new DropDB(WEEK2).execute(CTX);
CTX.close();
}
-
+
/**
* Checks the number of documents under the specified path.
* @throws Exception exception
@@ -73,7 +72,7 @@ public void documentTestInput() throws Exception {
assertEquals(1, Integer.parseInt(qp.execute().toString()));
qp.close();
}
-
+
/**
* Checks the number of documents under the specified path.
* @throws Exception exception
@@ -95,7 +94,7 @@ public void withIndexTest() throws Exception {
weekTest();
weekTest2();
}
-
+
/**
* Checks the results of the query without index access.
* @throws Exception exception
@@ -109,9 +108,9 @@ public void withoutIndexTest() throws Exception {
weekTest();
weekTest2();
}
-
+
/** Checks the results of the queries with the db week.
- * @throws Exception exception
+ * @throws Exception exception
*/
public void weekTest() throws Exception {
final String count = "count(collection('" + WEEK1 +
@@ -126,9 +125,9 @@ public void weekTest() throws Exception {
assertEquals(4, Integer.parseInt(qp2.execute().toString()));
qp2.close();
}
-
+
/** Checks the results of the queries with the db week.
- * @throws Exception exception
+ * @throws Exception exception
*/
public void weekTest2() throws Exception {
final String count = "count(collection('" + WEEK1 +
View
5 src/test/java/org/basex/test/query/NamespaceTest.java
@@ -1,7 +1,6 @@
package org.basex.test.query;
import static org.junit.Assert.*;
-
import org.basex.core.BaseXException;
import org.basex.core.Context;
import org.basex.core.Prop;
@@ -109,7 +108,7 @@ public final void duplicateDefaultNamespace() {
"<ns:x xmlns:ns='X'><y/></ns:x>");
}
- /**
+ /**
* Test query.
* Detects malformed namespace hierarchy.
*/
@@ -131,7 +130,7 @@ public final void nsHierarchy() {
} catch(BaseXException e) { }
}
}
-
+
/**
* Test query.
* Detects malformed namespace hierarchy.
Please sign in to comment.
Something went wrong with that request. Please try again.