Skip to content
Browse files

Merge branch 'develop' of github.com:eXist-db/exist into develop

  • Loading branch information...
2 parents a90ac8b + 8d6581b commit ceac4292b6a390655fc766b47103fbdc73b82f63 @dizzzz dizzzz committed Jan 15, 2014
View
2 extensions/modules/src/org/exist/xquery/modules/math/NoParamFunctions.java
@@ -55,7 +55,7 @@
"Returns the value of pi.",
null,
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the value of pi"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#pi"
+ org.exist.xquery.functions.math.NoParamFunctions.FNS_PI
),
new FunctionSignature(
new QName("random", MathModule.NAMESPACE_URI),
View
18 extensions/modules/src/org/exist/xquery/modules/math/OneParamFunctions.java
@@ -58,21 +58,21 @@
"Returns the arc cosine of an angle, in the range of 0.0 through pi.",
new SequenceType[] { new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the result"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#acos"
+ org.exist.xquery.functions.math.OneParamFunctions.FNS_ACOS
),
new FunctionSignature(
new QName("asin", MathModule.NAMESPACE_URI),
"Returns the arc sine of an angle, in the range of -pi/2 through pi/2.",
new SequenceType[] { new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "result"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#asin"
+ org.exist.xquery.functions.math.OneParamFunctions.FNS_ASIN
),
new FunctionSignature(
new QName("atan", MathModule.NAMESPACE_URI),
"Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.",
new SequenceType[] { new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the result"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#atan"
+ org.exist.xquery.functions.math.OneParamFunctions.FNS_ATAN
),
new FunctionSignature(
new QName("ceil", MathModule.NAMESPACE_URI),
@@ -85,14 +85,14 @@
"Returns the trigonometric cosine of an angle.",
new SequenceType[] { new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the cosine"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#cos"
+ org.exist.xquery.functions.math.OneParamFunctions.FNS_COS
),
new FunctionSignature(
new QName("exp", MathModule.NAMESPACE_URI),
"Calculates e (the Euler Constant) raised to the power of a value or expression",
new SequenceType[] { new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "e (the Euler Constant) raised to the power of a value or expression"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#exp"
+ org.exist.xquery.functions.math.OneParamFunctions.FNS_EXP
),
new FunctionSignature(
new QName("floor", MathModule.NAMESPACE_URI),
@@ -105,7 +105,7 @@
"Returns the natural logarithm (base e) of a number.",
new SequenceType[] { new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the log"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#log"
+ org.exist.xquery.functions.math.OneParamFunctions.FNS_LOG
),
new FunctionSignature(
new QName("round", MathModule.NAMESPACE_URI),
@@ -118,21 +118,21 @@
"Returns the trigonometric sine of an angle.",
new SequenceType[] { new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the sine"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#sin"
+ org.exist.xquery.functions.math.OneParamFunctions.FNS_SIN
),
new FunctionSignature(
new QName("sqrt", MathModule.NAMESPACE_URI),
"Returns the correctly rounded positive square root of a number.",
new SequenceType[] { new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the square root of $x"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#sqrt"
+ org.exist.xquery.functions.math.OneParamFunctions.FNS_SQRT
),
new FunctionSignature(
new QName("tan", MathModule.NAMESPACE_URI),
"Returns the tangent of the number passed as an argument in radians.",
new SequenceType[] { new FunctionParameterSequenceType("radians", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The radians") },
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the tangent"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#tan"
+ org.exist.xquery.functions.math.OneParamFunctions.FNS_TAN
),
new FunctionSignature(
new QName("degrees", MathModule.NAMESPACE_URI),
View
4 extensions/modules/src/org/exist/xquery/modules/math/TwoParamFunctions.java
@@ -56,7 +56,7 @@
},
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the theta component of the point (r, theta) in "
+ "polar coordinates that corresponds to the point (x, y) in Cartesian coordinates."),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#atan2"
+ org.exist.xquery.functions.math.TwoParamFunctions.FNS_ATAN2
),
new FunctionSignature(
new QName("power", MathModule.NAMESPACE_URI),
@@ -66,7 +66,7 @@
new FunctionParameterSequenceType("power", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The power to raise the value to")
},
new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the result"),
- "Replaced by http://www.w3.org/2005/xpath-functions/math/#pow"
+ org.exist.xquery.functions.math.TwoParamFunctions.FNS_POW
)
};
View
244 schema/collection.xconf.xsd
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:dcterms="http://purl.org/dc/terms/"
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dcterms="http://purl.org/dc/terms/"
xmlns="http://exist-db.org/collection-config/1.0"
- targetNamespace="http://exist-db.org/collection-config/1.0"
- elementFormDefault="qualified">
-
+ targetNamespace="http://exist-db.org/collection-config/1.0" elementFormDefault="qualified">
+
<xs:annotation>
<xs:documentation>Schema for eXist-db Collection Configuration files /db/system/config/db/**/collection.xconf</xs:documentation>
<xs:appinfo>
@@ -15,9 +12,9 @@
<dcterms:creator>Adam Retter</dcterms:creator>
</xs:appinfo>
</xs:annotation>
-
+
<xs:element name="collection" type="collectionType"/>
-
+
<xs:complexType name="collectionType">
<xs:choice>
<xs:annotation>
@@ -37,29 +34,40 @@
</xs:sequence>
</xs:choice>
</xs:complexType>
-
<xs:element name="index" type="indexType"/>
-
+ <xs:complexType name="rangeType">
+ <xs:sequence>
+ <xs:element name="range"/>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="indexType">
<xs:annotation>
<xs:documentation>Index Configuration</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:sequence>
<xs:element ref="fulltext"/>
- <xs:element ref="lucene" minOccurs="0" maxOccurs="unbounded"/>
- <xs:group ref="rangeIndex" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="lucene" minOccurs="0"/>
+ <xs:element ref="range" minOccurs="0"/>
+ <xs:element name="create" type="rangeIndexType" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="ngram" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="gml" minOccurs="0"/>
+ </xs:sequence>
+ <xs:sequence>
+ <xs:element ref="lucene"/>
+ <xs:element ref="range" minOccurs="0"/>
+ <xs:element name="create" type="rangeIndexType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ngram" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="gml" minOccurs="0"/>
</xs:sequence>
<xs:sequence>
- <xs:element ref="lucene" maxOccurs="unbounded"/>
- <xs:group ref="rangeIndex" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="range"/>
+ <xs:element name="create" type="rangeIndexType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ngram" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="gml" minOccurs="0"/>
</xs:sequence>
<xs:sequence>
- <xs:group ref="rangeIndex" maxOccurs="unbounded"/>
+ <xs:element name="create" type="rangeIndexType" maxOccurs="unbounded"/>
<xs:element ref="ngram" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="gml" minOccurs="0"/>
</xs:sequence>
@@ -71,53 +79,47 @@
<xs:element ref="gml"/>
</xs:sequence>
</xs:choice>
-
+
</xs:complexType>
-
+
<xs:element name="fulltext" type="fulltextType"/>
-
+
<xs:complexType name="fulltextType">
<xs:annotation>
<xs:documentation>Full Text Indexes</xs:documentation>
</xs:annotation>
- <xs:sequence minOccurs="0">
- <xs:group ref="fulltextDirectives"/>
- </xs:sequence>
- <xs:attribute name="default" default="all">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="all"/>
- <xs:enumeration value="none"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- <xs:attribute name="attributes" type="xs:boolean" default="true"/>
- <xs:attribute name="alphanum" type="xs:boolean" default="true"/>
+ <xs:sequence minOccurs="0">
+ <xs:group ref="fulltextDirectives"/>
+ </xs:sequence>
+ <xs:attribute name="default" default="all">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="all"/>
+ <xs:enumeration value="none"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="attributes" type="xs:boolean" default="true"/>
+ <xs:attribute name="alphanum" type="xs:boolean" default="true"/>
</xs:complexType>
-
+
<xs:group name="fulltextDirectives">
<xs:sequence>
<xs:element name="create" minOccurs="0" maxOccurs="unbounded" type="fulltextCreateType"/>
<xs:element name="include" minOccurs="0" maxOccurs="unbounded" type="pathType"/>
<xs:element name="exclude" minOccurs="0" maxOccurs="unbounded" type="pathType"/>
</xs:sequence>
</xs:group>
-
+
<xs:complexType name="pathType">
<xs:attributeGroup ref="pathReq"/>
</xs:complexType>
-
+
<xs:complexType name="fulltextCreateType">
<xs:attributeGroup ref="qnameReq"/>
<xs:attribute name="content" use="optional" type="xs:string" fixed="mixed"/>
</xs:complexType>
-
- <xs:group name="rangeIndex">
- <xs:choice>
- <xs:element name="create" type="rangeIndexType"/>
- </xs:choice>
- </xs:group>
-
+
<xs:complexType name="rangeIndexType">
<xs:annotation>
<xs:documentation>Either @qname or @path must be specified. Not both!</xs:documentation>
@@ -126,6 +128,57 @@
<xs:attributeGroup ref="qnameOpt"/>
<xs:attribute name="type" use="required" type="xs:QName"/>
</xs:complexType>
+
+ <xs:element name="range" type="newRangeIndexType"/>
+
+ <xs:complexType name="newRangeIndexType">
+ <xs:sequence>
+ <xs:element ref="create" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:element name="create" type="rangeIndexCreateType"/>
+
+ <xs:complexType name="rangeIndexCreateType">
+ <xs:sequence>
+ <xs:group ref="fieldDefinitions" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="qnameOpt"/>
+ <xs:attributeGroup ref="nestedOpt"/>
+ <xs:attributeGroup ref="whitespaceOpt"/>
+ <xs:attribute name="collation" use="optional" type="xs:string"/>
+ </xs:complexType>
+
+ <xs:group name="fieldDefinitions">
+ <xs:sequence>
+ <xs:element name="field" type="newRangeIndexFieldType" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:group>
+
+ <xs:complexType name="newRangeIndexFieldType">
+ <xs:attribute name="name" type="xs:NCName" use="required"/>
+ <xs:attributeGroup ref="qnameOpt"/>
+ <xs:attributeGroup ref="matchOpt"/>
+ <xs:attribute name="case" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="yes">
+ <xs:annotation>
+ <xs:documentation>Case sensitive</xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="no">
+ <xs:annotation>
+ <xs:documentation>Case insensitive</xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attributeGroup ref="nestedOpt"/>
+ <xs:attributeGroup ref="whitespaceOpt"/>
+ <xs:attribute name="type" type="xs:QName" use="required"/>
+ </xs:complexType>
<xs:element name="lucene" type="luceneType"/>
@@ -152,19 +205,19 @@
</xs:simpleType>
</xs:attribute>
</xs:complexType>
-
+
<xs:element name="analyzer" type="analyzerType"/>
-
+
<xs:complexType name="analyzerType">
<xs:sequence minOccurs="0">
<xs:element ref="param" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" use="optional" type="xs:ID"/>
<xs:attributeGroup ref="class"/>
</xs:complexType>
-
+
<xs:element name="param" type="paramType"/>
-
+
<xs:complexType name="paramType">
<xs:sequence minOccurs="0">
<xs:element name="value" minOccurs="1" maxOccurs="unbounded" type="xs:string"/>
@@ -173,19 +226,19 @@
<xs:attribute name="type" type="xs:string" use="optional" default="java.lang.String"/>
<xs:attributeGroup ref="valueOpt"/>
</xs:complexType>
-
+
<xs:element name="inline" type="singleQnameAttrType"/>
<xs:element name="ignore" type="singleQnameAttrType"/>
-
+
<xs:group name="textInstruction">
<xs:sequence>
<xs:element ref="inline" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ignore" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:group>
-
+
<xs:element name="text" type="textType"/>
-
+
<xs:complexType name="textType">
<xs:annotation>
<xs:documentation>Either @qname or @match must be specified. Not both!</xs:documentation>
@@ -199,21 +252,21 @@
<xs:attribute name="boost" use="optional" type="xs:double"/>
<xs:attribute name="field" use="optional" type="xs:string"/>
</xs:complexType>
-
+
<xs:complexType name="singleQnameAttrType">
<xs:attributeGroup ref="qnameReq"/>
</xs:complexType>
-
+
<xs:element name="ngram" type="singleQnameAttrType"/>
-
+
<xs:element name="gml" type="gmlIndexType"/>
-
+
<xs:complexType name="gmlIndexType">
<xs:attribute name="flushAfter" use="required" type="xs:positiveInteger"/>
</xs:complexType>
-
+
<xs:element name="triggers" type="triggersType"/>
-
+
<xs:complexType name="triggersType">
<xs:annotation>
<xs:documentation>Trigger Configuration</xs:documentation>
@@ -222,21 +275,21 @@
<xs:element ref="trigger" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
-
+
<xs:element name="trigger" type="triggerType"/>
-
+
<xs:complexType name="triggerType">
<xs:sequence minOccurs="0">
<xs:element ref="parameter" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="event" use="optional" type="eventType">
- <xs:annotation>
- <xs:documentation>This is deprecated, triggers should now code functions for each event</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attributeGroup ref="class"/>
+ <xs:annotation>
+ <xs:documentation>This is deprecated, triggers should now code functions for each event</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attributeGroup ref="class"/>
</xs:complexType>
-
+
<xs:simpleType name="eventType">
<xs:restriction base="xs:NCName">
<xs:enumeration value="create"/>
@@ -246,37 +299,46 @@
<xs:enumeration value="delete"/>
</xs:restriction>
</xs:simpleType>
-
+
<xs:element name="parameter" type="parameterType"/>
-
+
<xs:complexType name="parameterType">
<xs:attributeGroup ref="name"/>
<xs:attributeGroup ref="valueReq"/>
</xs:complexType>
-
+
<xs:element name="validation" type="validationType"/>
-
+
<xs:complexType name="validationType">
<xs:annotation>
<xs:documentation>Per collection validation-switch configuration</xs:documentation>
</xs:annotation>
<xs:attribute name="mode" use="required" type="modeType"/>
</xs:complexType>
-
+
<xs:simpleType name="modeType">
<xs:restriction base="xs:token">
<xs:enumeration value="auto"/>
<xs:enumeration value="no"/>
<xs:enumeration value="yes"/>
</xs:restriction>
</xs:simpleType>
+
+ <xs:simpleType name="yesNoType">
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="yes"/>
+ <xs:enumeration value="no"/>
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
<!-- we are hiding attributes in attributeGroup to manage their
namespaces as described here: http://docstore.mik.ua/orelly/xml/schema/ch10_04.htm -->
<xs:attributeGroup name="class">
- <xs:attribute name="class" type="xs:string" use="required" form="unqualified" />
+ <xs:attribute name="class" type="xs:string" use="required" form="unqualified"/>
</xs:attributeGroup>
-
+
<!-- ideally we would have just one of each attribute - but due do the form restrictions in XML Schema
we need both -->
<xs:attributeGroup name="name">
@@ -294,11 +356,49 @@
<xs:attributeGroup name="qnameOpt">
<xs:attribute name="qname" type="xs:string" use="optional" form="unqualified"/>
</xs:attributeGroup>
+ <xs:attributeGroup name="matchOpt">
+ <xs:attribute name="match" type="xs:string" use="optional" form="unqualified"/>
+ </xs:attributeGroup>
<xs:attributeGroup name="pathReq">
<xs:attribute name="path" type="xs:string" use="required" form="unqualified"/>
</xs:attributeGroup>
<xs:attributeGroup name="pathOpt">
<xs:attribute name="path" type="xs:string" use="optional" form="unqualified"/>
</xs:attributeGroup>
-
+ <xs:attributeGroup name="nestedOpt">
+ <xs:attribute name="nested" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="yes">
+ <xs:annotation>
+ <xs:documentation>Include descendant elements in index</xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="no">
+ <xs:annotation>
+ <xs:documentation>Do not include descendant elements in index</xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+ <xs:attributeGroup name="whitespaceOpt">
+ <xs:attribute name="whitespace" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="trim">
+ <xs:annotation>
+ <xs:documentation>Removing leading and trailing whitespace</xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ <xs:enumeration value="normalize">
+ <xs:annotation>
+ <xs:documentation>Normalize whitespace</xs:documentation>
+ </xs:annotation>
+ </xs:enumeration>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
</xs:schema>
View
7 src/org/exist/security/AbstractRealm.java
@@ -430,7 +430,12 @@ public boolean updateAccount(final Account account) throws PermissionDeniedExcep
}
}
- updatingAccount.setPassword(account.getPassword());
+ final String passwd = account.getPassword();
+ if (passwd != null) {
+ // if password is empty, ignore it to keep the old one
+ // assumes that empty passwords should never be allowed
+ updatingAccount.setPassword(account.getPassword());
+ }
updatingAccount.setUserMask(account.getUserMask());
//update the metadata
View
15 src/org/exist/xquery/functions/inspect/InspectModule.java
@@ -24,8 +24,8 @@
public class InspectModule extends BasicFunction {
- public final static FunctionSignature signatures[] = {
- new FunctionSignature(
+
+ public final static FunctionSignature FNS_INSPECT_MODULE = new FunctionSignature(
new QName("inspect-module", InspectionModule.NAMESPACE_URI, InspectionModule.PREFIX),
"Compiles a module from source (without importing it) and returns an XML fragment describing the " +
"module and the functions/variables contained in it.",
@@ -34,8 +34,10 @@
"The location URI of the module to inspect"),
},
new FunctionReturnSequenceType(Type.ELEMENT, Cardinality.ZERO_OR_ONE,
- "An XML fragment describing the module and all functions contained in it.")),
- new FunctionSignature(
+ "An XML fragment describing the module and all functions contained in it.")
+ );
+
+ public final static FunctionSignature FNS_INSPECT_MODULE_URI = new FunctionSignature(
new QName("inspect-module-uri", InspectionModule.NAMESPACE_URI, InspectionModule.PREFIX),
"Returns an XML fragment describing the " +
"module identified by the given URI and the functions/variables contained in it.",
@@ -44,8 +46,9 @@
"The location URI of the module to inspect"),
},
new FunctionReturnSequenceType(Type.ELEMENT, Cardinality.ZERO_OR_ONE,
- "An XML fragment describing the module and all functions contained in it.")),
- };
+ "An XML fragment describing the module and all functions contained in it.")
+ );
+
private static final QName MODULE_QNAME = new QName("module");
private static final QName VARIABLE_QNAME = new QName("variable");
View
10 src/org/exist/xquery/functions/inspect/InspectionModule.java
@@ -16,11 +16,11 @@
public final static FunctionDef[] functions = {
new FunctionDef(InspectFunction.SIGNATURE, InspectFunction.class),
- new FunctionDef(InspectModule.signatures[0], InspectModule.class),
- new FunctionDef(InspectModule.signatures[1], InspectModule.class),
- new FunctionDef(ModuleFunctions.signatures[0], ModuleFunctions.class),
- new FunctionDef(ModuleFunctions.signatures[1], ModuleFunctions.class),
- new FunctionDef(ModuleFunctions.signatures[2], ModuleFunctions.class)
+ new FunctionDef(InspectModule.FNS_INSPECT_MODULE, InspectModule.class),
+ new FunctionDef(InspectModule.FNS_INSPECT_MODULE_URI, InspectModule.class),
+ new FunctionDef(ModuleFunctions.FNS_MODULE_FUNCTIONS_CURRENT, ModuleFunctions.class),
+ new FunctionDef(ModuleFunctions.FNS_MODULE_FUNCTIONS_OTHER, ModuleFunctions.class),
+ new FunctionDef(ModuleFunctions.FNS_MODULE_FUNCTIONS_OTHER_URI, ModuleFunctions.class)
};
public InspectionModule(Map<String, List<? extends Object>> parameters) {
View
63 src/org/exist/xquery/functions/inspect/ModuleFunctions.java
@@ -12,36 +12,39 @@
import java.util.List;
public class ModuleFunctions extends BasicFunction {
-
- public static final FunctionSignature signatures[] = {
- new FunctionSignature(
- new QName("module-functions", InspectionModule.NAMESPACE_URI, InspectionModule.PREFIX),
- "Returns a sequence of function items pointing to each public function in the current module.",
- new SequenceType[] {},
- new FunctionReturnSequenceType(
- Type.FUNCTION_REFERENCE,
- Cardinality.ZERO_OR_MORE,
- "Sequence of function items containing all public functions in the current module or the empty sequence " +
- "if the module is not known in the current context.")),
- new FunctionSignature(
- new QName("module-functions", InspectionModule.NAMESPACE_URI, InspectionModule.PREFIX),
- "Returns a sequence of function items pointing to each public function in the specified module.",
- new SequenceType[] { new FunctionParameterSequenceType("location", Type.ANY_URI, Cardinality.EXACTLY_ONE, "The location URI of the module to be loaded.") },
- new FunctionReturnSequenceType(
- Type.FUNCTION_REFERENCE,
- Cardinality.ZERO_OR_MORE,
- "Sequence of function items containing all public functions in the module or the empty sequence " +
- "if the module is not known in the current context.")),
- new FunctionSignature(
- new QName("module-functions-by-uri", InspectionModule.NAMESPACE_URI, InspectionModule.PREFIX),
- "Returns a sequence of function items pointing to each public function in the specified module.",
- new SequenceType[] { new FunctionParameterSequenceType("uri", Type.ANY_URI, Cardinality.EXACTLY_ONE, "The URI of the module to be loaded.") },
- new FunctionReturnSequenceType(
- Type.FUNCTION_REFERENCE,
- Cardinality.ZERO_OR_MORE,
- "Sequence of function items containing all public functions in the module or the empty sequence " +
- "if the module is not known in the current context."))
- };
+
+ public final static FunctionSignature FNS_MODULE_FUNCTIONS_CURRENT = new FunctionSignature(
+ new QName("module-functions", InspectionModule.NAMESPACE_URI, InspectionModule.PREFIX),
+ "Returns a sequence of function items pointing to each public function in the current module.",
+ new SequenceType[] {},
+ new FunctionReturnSequenceType(
+ Type.FUNCTION_REFERENCE,
+ Cardinality.ZERO_OR_MORE,
+ "Sequence of function items containing all public functions in the current module or the empty sequence " +
+ "if the module is not known in the current context.")
+ );
+
+ public final static FunctionSignature FNS_MODULE_FUNCTIONS_OTHER = new FunctionSignature(
+ new QName("module-functions", InspectionModule.NAMESPACE_URI, InspectionModule.PREFIX),
+ "Returns a sequence of function items pointing to each public function in the specified module.",
+ new SequenceType[] { new FunctionParameterSequenceType("location", Type.ANY_URI, Cardinality.EXACTLY_ONE, "The location URI of the module to be loaded.") },
+ new FunctionReturnSequenceType(
+ Type.FUNCTION_REFERENCE,
+ Cardinality.ZERO_OR_MORE,
+ "Sequence of function items containing all public functions in the module or the empty sequence " +
+ "if the module is not known in the current context.")
+ );
+
+ public final static FunctionSignature FNS_MODULE_FUNCTIONS_OTHER_URI = new FunctionSignature(
+ new QName("module-functions-by-uri", InspectionModule.NAMESPACE_URI, InspectionModule.PREFIX),
+ "Returns a sequence of function items pointing to each public function in the specified module.",
+ new SequenceType[] { new FunctionParameterSequenceType("uri", Type.ANY_URI, Cardinality.EXACTLY_ONE, "The URI of the module to be loaded.") },
+ new FunctionReturnSequenceType(
+ Type.FUNCTION_REFERENCE,
+ Cardinality.ZERO_OR_MORE,
+ "Sequence of function items containing all public functions in the module or the empty sequence " +
+ "if the module is not known in the current context.")
+ );
public ModuleFunctions(XQueryContext context, FunctionSignature signature) {
super(context, signature);
View
28 src/org/exist/xquery/functions/math/MathModule.java
@@ -42,22 +42,22 @@
private final static FunctionDef functions[] = {
- new FunctionDef(OneParamFunctions.signature[0], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[1], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[2], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[3], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[4], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[5], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[6], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[7], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[8], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[9], OneParamFunctions.class),
- new FunctionDef(OneParamFunctions.signature[10], OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_ACOS, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_ASIN, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_ATAN, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_COS, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_EXP, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_EXP10, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_LOG, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_LOG10, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_SIN, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_SQRT, OneParamFunctions.class),
+ new FunctionDef(OneParamFunctions.FNS_TAN, OneParamFunctions.class),
- new FunctionDef(NoParamFunctions.signature[0], NoParamFunctions.class),
+ new FunctionDef(NoParamFunctions.FNS_PI, NoParamFunctions.class),
- new FunctionDef(TwoParamFunctions.signature[0], TwoParamFunctions.class),
- new FunctionDef(TwoParamFunctions.signature[1], TwoParamFunctions.class)
+ new FunctionDef(TwoParamFunctions.FNS_ATAN2, TwoParamFunctions.class),
+ new FunctionDef(TwoParamFunctions.FNS_POW, TwoParamFunctions.class)
};
public MathModule(Map<String, List<? extends Object>> parameters) {
View
16 src/org/exist/xquery/functions/math/NoParamFunctions.java
@@ -42,18 +42,16 @@
*/
public class NoParamFunctions extends BasicFunction {
- //private static final Logger logger = Logger.getLogger(NoParamFunctions.class);
+ //private static final Logger logger = Logger.getLogger(NoParamFunctions.class);
public static final String PI = "pi";
- public final static FunctionSignature signature[] = {
- new FunctionSignature(
- new QName(PI, MathModule.NAMESPACE_URI),
- "Returns the value of pi.",
- null,
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the value of pi")
- )
- };
+ public final static FunctionSignature FNS_PI = new FunctionSignature(
+ new QName(PI, MathModule.NAMESPACE_URI),
+ "Returns the value of pi.",
+ null,
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the value of pi")
+ );
/**
* @param context
View
144 src/org/exist/xquery/functions/math/OneParamFunctions.java
@@ -59,74 +59,82 @@
public static final String SQRT = "sqrt";
public static final String TAN = "tan";
- public final static FunctionSignature signature[] = {
- new FunctionSignature(
- new QName(ACOS, MathModule.NAMESPACE_URI),
- "Returns the arc cosine of the argument, the result being in the range zero to +π radians.",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the result")
- ),
- new FunctionSignature(
- new QName(ASIN, MathModule.NAMESPACE_URI),
- "Returns the arc sine of the argument, the result being in the range -π/2 to +π/2 radians.",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "result")
- ),
- new FunctionSignature(
- new QName(ATAN, MathModule.NAMESPACE_URI),
- "Returns the arc tangent of the argument, the result being in the range -π/2 to +π/2 radians.",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the result")
- ),
- new FunctionSignature(
- new QName(COS, MathModule.NAMESPACE_URI),
- "Returns the cosine of the argument, expressed in radians.",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the cosine")
- ),
- new FunctionSignature(
- new QName(EXP, MathModule.NAMESPACE_URI),
- "Calculates e (the Euler Constant) raised to the power of $arg",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "e (the Euler Constant) raised to the power of a value or expression")
- ),
- new FunctionSignature( // NEW
- new QName(EXP10, MathModule.NAMESPACE_URI),
- "Calculates 10 raised to the power of $arg",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "e (the Euler Constant) raised to the power of a value or expression")
- ),
- new FunctionSignature(
- new QName(LOG, MathModule.NAMESPACE_URI),
- "Returns the natural logarithm of the argument.",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the log")
- ),
- new FunctionSignature( // NEW
- new QName(LOG10, MathModule.NAMESPACE_URI),
- "Returns the base-ten logarithm of the argument.",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the log")
- ),
- new FunctionSignature(
- new QName(SIN, MathModule.NAMESPACE_URI),
- "Returns the sine of the argument, expressed in radians.",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the sine")
- ),
- new FunctionSignature(
- new QName(SQRT, MathModule.NAMESPACE_URI),
- "Returns the non-negative square root of the argument.",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the square root of $x")
- ),
- new FunctionSignature(
- new QName(TAN, MathModule.NAMESPACE_URI),
- "Returns the tangent of the argument, expressed in radians.",
- new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The radians") },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the tangent")
- ),
- };
+ public final static FunctionSignature FNS_ACOS = new FunctionSignature(
+ new QName(ACOS, MathModule.NAMESPACE_URI),
+ "Returns the arc cosine of the argument, the result being in the range zero to +π radians.",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the result")
+ );
+
+ public final static FunctionSignature FNS_ASIN = new FunctionSignature(
+ new QName(ASIN, MathModule.NAMESPACE_URI),
+ "Returns the arc sine of the argument, the result being in the range -π/2 to +π/2 radians.",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "result")
+ );
+
+ public final static FunctionSignature FNS_ATAN = new FunctionSignature(
+ new QName(ATAN, MathModule.NAMESPACE_URI),
+ "Returns the arc tangent of the argument, the result being in the range -π/2 to +π/2 radians.",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the result")
+ );
+
+ public final static FunctionSignature FNS_COS = new FunctionSignature(
+ new QName(COS, MathModule.NAMESPACE_URI),
+ "Returns the cosine of the argument, expressed in radians.",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the cosine")
+ );
+
+ public final static FunctionSignature FNS_EXP = new FunctionSignature(
+ new QName(EXP, MathModule.NAMESPACE_URI),
+ "Calculates e (the Euler Constant) raised to the power of $arg",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "e (the Euler Constant) raised to the power of a value or expression")
+ );
+
+ public final static FunctionSignature FNS_EXP10 = new FunctionSignature( // NEW
+ new QName(EXP10, MathModule.NAMESPACE_URI),
+ "Calculates 10 raised to the power of $arg",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "e (the Euler Constant) raised to the power of a value or expression")
+ );
+
+ public final static FunctionSignature FNS_LOG = new FunctionSignature(
+ new QName(LOG, MathModule.NAMESPACE_URI),
+ "Returns the natural logarithm of the argument.",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the log")
+ );
+
+ public final static FunctionSignature FNS_LOG10 = new FunctionSignature( // NEW
+ new QName(LOG10, MathModule.NAMESPACE_URI),
+ "Returns the base-ten logarithm of the argument.",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the log")
+ );
+
+ public final static FunctionSignature FNS_SIN = new FunctionSignature(
+ new QName(SIN, MathModule.NAMESPACE_URI),
+ "Returns the sine of the argument, expressed in radians.",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the sine")
+ );
+
+ public final static FunctionSignature FNS_SQRT = new FunctionSignature(
+ new QName(SQRT, MathModule.NAMESPACE_URI),
+ "Returns the non-negative square root of the argument.",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The input number") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the square root of $x")
+ );
+
+ public final static FunctionSignature FNS_TAN = new FunctionSignature(
+ new QName(TAN, MathModule.NAMESPACE_URI),
+ "Returns the tangent of the argument, expressed in radians.",
+ new SequenceType[] { new FunctionParameterSequenceType("arg", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The radians") },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the tangent")
+ );
/**
* @param context
View
46 src/org/exist/xquery/functions/math/TwoParamFunctions.java
@@ -45,33 +45,33 @@
*/
public class TwoParamFunctions extends BasicFunction {
- @SuppressWarnings("unused")
- private static final Logger logger = Logger.getLogger(TwoParamFunctions.class);
+ @SuppressWarnings("unused")
+ private static final Logger logger = Logger.getLogger(TwoParamFunctions.class);
public static final String ATAN2 = "atan2";
public static final String POW = "pow";
- public final static FunctionSignature signature[] = {
- new FunctionSignature(
- new QName(ATAN2, MathModule.NAMESPACE_URI),
- "Returns the angle in radians subtended at the origin by the point on a "
- + "plane with coordinates (x, y) and the positive x-axis, the result being in the range -π to +π.",
- new SequenceType[] {
- new FunctionParameterSequenceType("y", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The y coordinate"),
- new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The x coordinate")
- },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates.")
- ),
- new FunctionSignature(
- new QName(POW, MathModule.NAMESPACE_URI),
- "Returns the result of raising the first argument to the power of the second.",
- new SequenceType[] {
- new FunctionParameterSequenceType("value", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The value"),
- new FunctionParameterSequenceType("power", Type.NUMBER, Cardinality.EXACTLY_ONE, "The power to raise the value to")
- },
- new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the result")
- )
- };
+
+ public final static FunctionSignature FNS_ATAN2 = new FunctionSignature(
+ new QName(ATAN2, MathModule.NAMESPACE_URI),
+ "Returns the angle in radians subtended at the origin by the point on a "
+ + "plane with coordinates (x, y) and the positive x-axis, the result being in the range -π to +π.",
+ new SequenceType[] {
+ new FunctionParameterSequenceType("y", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The y coordinate"),
+ new FunctionParameterSequenceType("x", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The x coordinate")
+ },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates.")
+ );
+
+ public final static FunctionSignature FNS_POW = new FunctionSignature(
+ new QName(POW, MathModule.NAMESPACE_URI),
+ "Returns the result of raising the first argument to the power of the second.",
+ new SequenceType[] {
+ new FunctionParameterSequenceType("value", Type.DOUBLE, Cardinality.EXACTLY_ONE, "The value"),
+ new FunctionParameterSequenceType("power", Type.NUMBER, Cardinality.EXACTLY_ONE, "The power to raise the value to")
+ },
+ new FunctionReturnSequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE, "the result")
+ );
/**
* @param context
View
2 src/org/exist/xquery/functions/response/SetHeader.java
@@ -68,7 +68,7 @@
"Set's a HTTP Header on the HTTP Response.",
new SequenceType[] { NAME_PARAM, VALUE_PARAM },
new SequenceType(Type.ITEM, Cardinality.EMPTY),
- "Moved to response module and renamed to response:set-header.");
+ SetHeader.signature);
public SetHeader( XQueryContext context )
{
View
4 src/org/exist/xquery/functions/text/KWICDisplay.java
@@ -84,7 +84,7 @@
new SequenceType[]{ TEXT_ARG, WIDTH_ARG, CALLBACK_ARG, PARAMETERS_ARG },
new FunctionReturnSequenceType(Type.NODE, Cardinality.ZERO_OR_MORE, "the results"),
"Improved kwic functionality is now provided by a separate XQuery module, see " +
- "http://exist-db.org/kwic.html."),
+ "http://www.exist-db.org/exist/apps/doc/kwic.xml."),
new FunctionSignature(
new QName("kwic-display", TextModule.NAMESPACE_URI, TextModule.PREFIX),
"This function takes a sequence of text nodes in $a, containing matches from a fulltext search. " +
@@ -107,7 +107,7 @@
new SequenceType[]{ TEXT_ARG, WIDTH_ARG, CALLBACK_ARG, RESULT_CALLBACK_ARG, PARAMETERS_ARG },
new FunctionReturnSequenceType(Type.NODE, Cardinality.ZERO_OR_MORE, "the results"),
"Improved kwic functionality is now provided by a separate XQuery module, see " +
- "http://exist-db.org/kwic.html.")
+ "http://www.exist-db.org/exist/apps/doc/kwic.xml.")
};
public KWICDisplay(XQueryContext context, FunctionSignature signature) {
View
6 src/org/exist/xquery/functions/util/BuiltinFunctions.java
@@ -30,6 +30,8 @@
import org.exist.dom.QName;
import org.exist.xquery.*;
import org.exist.xquery.functions.fn.FunOnFunctions;
+import org.exist.xquery.functions.inspect.InspectFunction;
+import org.exist.xquery.functions.inspect.ModuleFunctions;
import org.exist.xquery.value.*;
/**
@@ -68,13 +70,13 @@
"Returns a sequence of function items for each function in the current module.",
null,
new FunctionReturnSequenceType(Type.FUNCTION_REFERENCE, Cardinality.ZERO_OR_MORE, "sequence of function references"),
- "Use inspect:module-functions instead."),
+ ModuleFunctions.FNS_MODULE_FUNCTIONS_CURRENT),
new FunctionSignature(
new QName("list-functions", UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
"Returns a sequence of function items for each function in the specified module.",
new SequenceType[] { new FunctionParameterSequenceType("namespace-uri", Type.STRING, Cardinality.EXACTLY_ONE, "The namespace URI of the function module") },
new FunctionReturnSequenceType(Type.FUNCTION_REFERENCE, Cardinality.ZERO_OR_MORE, "sequence of function references"),
- "Use inspect:module-functions instead.")
+ ModuleFunctions.FNS_MODULE_FUNCTIONS_OTHER)
};
public BuiltinFunctions(XQueryContext context, FunctionSignature signature) {
View
2 src/org/exist/xquery/functions/util/CatchFunction.java
@@ -64,7 +64,7 @@
new FunctionParameterSequenceType("catch-code-blocks", Type.ITEM, Cardinality.ZERO_OR_MORE, "The code blocks that will be will called if the catch matches one of the $java-classnames")
},
new FunctionReturnSequenceType(Type.ITEM, Cardinality.ZERO_OR_MORE, "the results from the try-catch"),
- "Use the XQuery 3.0 try/catch expression in stead."
+ "Use the XQuery 3.0 try/catch expression instead."
);
/**
View
3 src/org/exist/xquery/functions/util/DescribeFunction.java
@@ -36,6 +36,7 @@
import org.exist.xquery.Module;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
+import org.exist.xquery.functions.inspect.InspectFunction;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.FunctionReturnSequenceType;
import org.exist.xquery.value.Item;
@@ -62,7 +63,7 @@
new FunctionParameterSequenceType("function-name", Type.QNAME, Cardinality.EXACTLY_ONE, "The name of the function to get the signature of"),
},
new FunctionReturnSequenceType(Type.NODE, Cardinality.EXACTLY_ONE, "the signature of the function"),
- "Use inspect:inspect-function instead.");
+ InspectFunction.SIGNATURE);
private final static QName ANNOTATION_QNAME = new QName("annotation");
private final static QName ANNOTATION_VALUE_QNAME = new QName("value");
View
17 src/org/exist/xquery/functions/util/ModuleInfo.java
@@ -39,6 +39,7 @@
import org.exist.xquery.Module;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
+import org.exist.xquery.functions.inspect.InspectModule;
import org.exist.xquery.value.BooleanValue;
import org.exist.xquery.value.FunctionParameterSequenceType;
import org.exist.xquery.value.FunctionReturnSequenceType;
@@ -109,7 +110,7 @@
"Returns a short description of the module identified by the namespace URI.",
new SequenceType[] { NAMESPACE_URI_PARAMETER },
new FunctionReturnSequenceType(Type.STRING, Cardinality.EXACTLY_ONE, "the description of the active function module identified by the namespace URI"),
- "Use inspect:inspect-module-uri instead."
+ InspectModule.FNS_INSPECT_MODULE_URI
);
public final static FunctionSignature moduleInfoSig =
@@ -123,14 +124,14 @@
);
public final static FunctionSignature moduleInfoWithURISig =
- new FunctionSignature(
- new QName("get-module-info", UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
- "Returns an XML fragment providing additional information about the module identified by the " +
- "namespace URI.",
- new SequenceType[] { NAMESPACE_URI_PARAMETER },
- new FunctionReturnSequenceType(Type.ELEMENT, Cardinality.EXACTLY_ONE,
+ new FunctionSignature(
+ new QName("get-module-info", UtilModule.NAMESPACE_URI, UtilModule.PREFIX),
+ "Returns an XML fragment providing additional information about the module identified by the " +
+ "namespace URI.",
+ new SequenceType[] { NAMESPACE_URI_PARAMETER },
+ new FunctionReturnSequenceType(Type.ELEMENT, Cardinality.EXACTLY_ONE,
"the description of the active function module identified by the namespace URI"),
- "Use inspect:inspect-module-uri instead."
+ InspectModule.FNS_INSPECT_MODULE_URI
);
private static final QName MODULE_QNAME = new QName("module");
View
23 src/org/exist/xquery/lib/xqsuite/xqsuite.xql
@@ -594,12 +594,31 @@ declare %private function test:assertXPath($annotation as element(annotation), $
util:expand($output)
else
$output
+ let $prolog :=
+ if ($result instance of element()*) then
+ let $namespaces := fold-left(function ($namespaces as map(*), $xml as element()) {
+ map:new(($namespaces,
+ for $prefix in in-scope-prefixes($xml)
+ where $prefix != "" and $prefix != "xml"
+ return
+ map:entry($prefix, namespace-uri-for-prefix($prefix, $xml))
+ ))
+ }, map:new(), $result/descendant-or-self::*)
+ return
+ string-join(
+ for $prefix in map:keys($namespaces)
+ return
+ "declare namespace " || $prefix || "='" || $namespaces($prefix) || "';",
+ " "
+ )
+ else
+ ()
let $xr :=
test:checkXPathResult(
if (matches($expr, "^\s*/")) then
- util:eval(concat("$result", $expr))
+ util:eval($prolog || "$result" || $expr)
else
- util:eval($expr)
+ util:eval($prolog || $expr)
)
return
if ($xr) then
View
46 test/src/xquery/xqsuite/xqsuite-tests.xql
@@ -0,0 +1,46 @@
+xquery version "3.0";
+
+(:~
+ : Some tests on features of the test suite itself.
+ :)
+module namespace t="http://exist-db.org/xquery/test/xqsuite";
+
+declare namespace test="http://exist-db.org/xquery/xqsuite";
+
+declare
+ %test:assertXPath("/name[. = 'Item1']")
+function t:xpath() {
+ <item>
+ <name>Item1</name>
+ </item>
+};
+
+declare
+ %test:assertXPath("/t:name[. = 'Item1']")
+function t:xpath-with-namespace() {
+ <t:item>
+ <t:name>Item1</t:name>
+ </t:item>
+};
+
+declare
+ %test:assertXPath("/t:name/x:id[. = 'abc']")
+function t:xpath-with-different-namespaces() {
+ <t:item>
+ <t:name><x:id xmlns:x="http://test.com/x">abc</x:id></t:name>
+ </t:item>
+};
+
+declare
+ %test:assertXPath("declare namespace f='http://foo.com'; $result//f:name[. = 'Item1']")
+function t:xpath-with-default-namespace() {
+ <item xmlns="http://foo.com">
+ <name>Item1</name>
+ </item>
+};
+
+declare
+ %test:assertXPath("string-length($result) = 5")
+function t:xpath-atomic-value() {
+ "Hello"
+};

0 comments on commit ceac429

Please sign in to comment.
Something went wrong with that request. Please try again.