You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
(57) |
Apr
(103) |
May
(164) |
Jun
(139) |
Jul
(173) |
Aug
(196) |
Sep
(221) |
Oct
(333) |
Nov
(214) |
Dec
(88) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(163) |
Feb
(165) |
Mar
(98) |
Apr
(93) |
May
(199) |
Jun
(118) |
Jul
(200) |
Aug
(212) |
Sep
(185) |
Oct
(297) |
Nov
(437) |
Dec
(272) |
| 2006 |
Jan
(542) |
Feb
(329) |
Mar
(267) |
Apr
(332) |
May
(267) |
Jun
(130) |
Jul
(161) |
Aug
(348) |
Sep
(166) |
Oct
(305) |
Nov
(173) |
Dec
(173) |
| 2007 |
Jan
(199) |
Feb
(118) |
Mar
(133) |
Apr
(200) |
May
(208) |
Jun
(146) |
Jul
(198) |
Aug
(146) |
Sep
(187) |
Oct
(182) |
Nov
(181) |
Dec
(83) |
| 2008 |
Jan
(252) |
Feb
(124) |
Mar
(124) |
Apr
(101) |
May
(143) |
Jun
(122) |
Jul
(129) |
Aug
(60) |
Sep
(80) |
Oct
(89) |
Nov
(54) |
Dec
(112) |
| 2009 |
Jan
(88) |
Feb
(145) |
Mar
(105) |
Apr
(164) |
May
(123) |
Jun
(154) |
Jul
(374) |
Aug
(341) |
Sep
(219) |
Oct
(137) |
Nov
(373) |
Dec
(240) |
| 2010 |
Jan
(197) |
Feb
(270) |
Mar
(253) |
Apr
(150) |
May
(102) |
Jun
(51) |
Jul
(300) |
Aug
(512) |
Sep
(254) |
Oct
(258) |
Nov
(288) |
Dec
(143) |
| 2011 |
Jan
(238) |
Feb
(179) |
Mar
(253) |
Apr
(332) |
May
(248) |
Jun
(255) |
Jul
(216) |
Aug
(282) |
Sep
(146) |
Oct
(77) |
Nov
(86) |
Dec
(69) |
| 2012 |
Jan
(172) |
Feb
(234) |
Mar
(229) |
Apr
(101) |
May
(212) |
Jun
(267) |
Jul
(129) |
Aug
(210) |
Sep
(239) |
Oct
(271) |
Nov
(368) |
Dec
(220) |
| 2013 |
Jan
(179) |
Feb
(155) |
Mar
(59) |
Apr
(47) |
May
(99) |
Jun
(158) |
Jul
(185) |
Aug
(16) |
Sep
(16) |
Oct
(7) |
Nov
(20) |
Dec
(12) |
| 2014 |
Jan
(21) |
Feb
(17) |
Mar
(18) |
Apr
(13) |
May
(27) |
Jun
(15) |
Jul
(19) |
Aug
(22) |
Sep
(30) |
Oct
(16) |
Nov
(19) |
Dec
(16) |
| 2015 |
Jan
(14) |
Feb
(24) |
Mar
(33) |
Apr
(41) |
May
(14) |
Jun
(80) |
Jul
(53) |
Aug
(8) |
Sep
(7) |
Oct
(15) |
Nov
(13) |
Dec
(2) |
| 2016 |
Jan
(22) |
Feb
(12) |
Mar
(30) |
Apr
(6) |
May
(33) |
Jun
(16) |
Jul
(8) |
Aug
(20) |
Sep
(12) |
Oct
(18) |
Nov
(12) |
Dec
(11) |
| 2017 |
Jan
(24) |
Feb
(26) |
Mar
(47) |
Apr
(23) |
May
(19) |
Jun
(14) |
Jul
(28) |
Aug
(30) |
Sep
(17) |
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
(73) |
Mar
(90) |
Apr
(42) |
May
(116) |
Jun
(90) |
Jul
(127) |
Aug
(103) |
Sep
(56) |
Oct
(42) |
Nov
(95) |
Dec
(58) |
| 2020 |
Jan
(102) |
Feb
(31) |
Mar
(93) |
Apr
(60) |
May
(57) |
Jun
(45) |
Jul
(29) |
Aug
(32) |
Sep
(44) |
Oct
(86) |
Nov
(51) |
Dec
(71) |
| 2021 |
Jan
(44) |
Feb
(25) |
Mar
(78) |
Apr
(130) |
May
(64) |
Jun
(74) |
Jul
(21) |
Aug
(64) |
Sep
(40) |
Oct
(43) |
Nov
(21) |
Dec
(99) |
| 2022 |
Jan
(154) |
Feb
(64) |
Mar
(45) |
Apr
(95) |
May
(62) |
Jun
(48) |
Jul
(73) |
Aug
(37) |
Sep
(71) |
Oct
(27) |
Nov
(40) |
Dec
(65) |
| 2023 |
Jan
(89) |
Feb
(130) |
Mar
(124) |
Apr
(50) |
May
(93) |
Jun
(46) |
Jul
(45) |
Aug
(68) |
Sep
(62) |
Oct
(71) |
Nov
(108) |
Dec
(82) |
| 2024 |
Jan
(53) |
Feb
(76) |
Mar
(64) |
Apr
(75) |
May
(36) |
Jun
(54) |
Jul
(98) |
Aug
(137) |
Sep
(58) |
Oct
(177) |
Nov
(84) |
Dec
(52) |
| 2025 |
Jan
(70) |
Feb
(53) |
Mar
(72) |
Apr
(47) |
May
(88) |
Jun
(49) |
Jul
(86) |
Aug
(51) |
Sep
(65) |
Oct
(91) |
Nov
(18) |
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
(7) |
2
(2) |
3
(3) |
4
(1) |
5
(3) |
|
6
(8) |
7
|
8
(4) |
9
(3) |
10
(13) |
11
(4) |
12
(2) |
|
13
(2) |
14
(5) |
15
(4) |
16
(2) |
17
(9) |
18
(8) |
19
(18) |
|
20
(15) |
21
(9) |
22
(7) |
23
(4) |
24
(1) |
25
(11) |
26
|
|
27
(1) |
28
(9) |
29
(21) |
30
(14) |
31
(18) |
|
|
|
From: <br...@us...> - 2007-05-31 22:40:33
|
Revision: 5975
http://svn.sourceforge.net/exist/?rev=5975&view=rev
Author: brihaye
Date: 2007-05-31 15:40:32 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Ignore libraries downloaded from Geotools Maven repository.
Property Changed:
----------------
trunk/eXist/extensions/indexes/spatial/lib/
Property changes on: trunk/eXist/extensions/indexes/spatial/lib
___________________________________________________________________
Name: svn:ignore
- gt2-api-2.4-M1.jar
gt2-epsg-wkt-2.4-M1.jar
gt2-main-2.4-M1.jar
gt2-metadata-2.4-M1.jar
gt2-referencing-2.4-M1.jar
gt2-xml-2.4-M1.jar
jsr108-0.01.jar
jts-1.8.jar
vecmath-1.3.1.jar
gt2-epsg-extension-2.4-M2.jar
+ gt2-api-2.4-M1.jar
gt2-epsg-wkt-2.4-M1.jar
gt2-main-2.4-M1.jar
gt2-metadata-2.4-M1.jar
gt2-referencing-2.4-M1.jar
gt2-xml-2.4-M1.jar
jsr108-0.01.jar
jts-1.8.jar
vecmath-1.3.1.jar
gt2-epsg-extension-2.4-M2.jar
geoapi-nogenerics-2.1-M3.jar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 22:30:54
|
Revision: 5974
http://svn.sourceforge.net/exist/?rev=5974&view=rev
Author: brihaye
Date: 2007-05-31 15:30:51 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Libraries are currently being regeneratd. Found another one.
Modified Paths:
--------------
trunk/eXist/extensions/indexes/spatial/build.xml
Removed Paths:
-------------
trunk/eXist/extensions/indexes/spatial/lib/geoapi-nogenerics-2.1-M3.jar
Modified: trunk/eXist/extensions/indexes/spatial/build.xml
===================================================================
--- trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 22:21:02 UTC (rev 5973)
+++ trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 22:30:51 UTC (rev 5974)
@@ -23,7 +23,8 @@
dest="${lib.dir}/gt2-referencing-2.4-M1.jar" verbose="true" usetimestamp="true" />
<get src="http://lists.refractions.net/m2/org/geotools/gt2-xml/2.4-M1/gt2-xml-2.4-M1.jar"
dest="${lib.dir}/gt2-xml-2.4-M1.jar" verbose="true" usetimestamp="true" />
- <!-- geoapi-nogenerics-2.1-M3.jar -->
+ <get src="http://lists.refractions.net/m2/org/opengis/geoapi-nogenerics/2.1-M3/geoapi-nogenerics-2.1-M3.jar"
+ dest="${lib.dir}/geoapi-nogenerics-2.1-M3.jar" verbose="true" usetimestamp="true" />
<!-- hsqldb-1.8.0.7.jar -->
<get src="http://maven.geotools.fr/repository/javax/units/jsr108/0.01/jsr108-0.01.jar"
dest="${lib.dir}/jsr108-0.01.jar" verbose="true" usetimestamp="true" />
Deleted: trunk/eXist/extensions/indexes/spatial/lib/geoapi-nogenerics-2.1-M3.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 22:21:04
|
Revision: 5973
http://svn.sourceforge.net/exist/?rev=5973&view=rev
Author: brihaye
Date: 2007-05-31 15:21:02 -0700 (Thu, 31 May 2007)
Log Message:
-----------
adjusted Eclipse's .classpath to the new hierarchy
Modified Paths:
--------------
trunk/eXist/.classpath
Modified: trunk/eXist/.classpath
===================================================================
--- trunk/eXist/.classpath 2007-05-31 22:19:13 UTC (rev 5972)
+++ trunk/eXist/.classpath 2007-05-31 22:21:02 UTC (rev 5973)
@@ -12,9 +12,7 @@
<classpathentry kind="src" path="extensions/indexes/spatial/src"/>
<classpathentry kind="src" path="extensions/indexes/spatial/test/src"/>
<classpathentry kind="lib" path="lib/core/jEdit-syntax.jar" sourcepath="/jEdit-syntax"/>
- <classpathentry kind="lib" path="extensions/indexes/spatial/lib/geoapi-nogenerics-2.1-M3.jar"/>
<classpathentry kind="lib" path="extensions/indexes/spatial/lib/gt2-api-2.4-M1.jar"/>
- <classpathentry kind="lib" path="extensions/indexes/spatial/lib/gt2-epsg-extension-2.4-M1.jar"/>
<classpathentry kind="lib" path="extensions/indexes/spatial/lib/gt2-epsg-wkt-2.4-M1.jar"/>
<classpathentry kind="lib" path="extensions/indexes/spatial/lib/gt2-main-2.4-M1.jar"/>
<classpathentry kind="lib" path="extensions/indexes/spatial/lib/gt2-metadata-2.4-M1.jar"/>
@@ -24,6 +22,8 @@
<classpathentry kind="lib" path="extensions/indexes/spatial/lib/jsr108-0.01.jar"/>
<classpathentry kind="lib" path="extensions/indexes/spatial/lib/jts-1.8.jar"/>
<classpathentry kind="lib" path="extensions/indexes/spatial/lib/vecmath-1.3.1.jar"/>
+ <classpathentry kind="lib" path="extensions/indexes/spatial/lib/geoapi-nogenerics-2.1-M3.jar"/>
+ <classpathentry kind="lib" path="extensions/indexes/spatial/lib/gt2-epsg-extension-2.4-M2.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/cocoon/avalon-framework-impl-4.1.5.jar"/>
<classpathentry kind="lib" path="lib/cocoon/cocoon-2.1.7-deprecated.jar"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 22:19:14
|
Revision: 5972
http://svn.sourceforge.net/exist/?rev=5972&view=rev
Author: brihaye
Date: 2007-05-31 15:19:13 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Ignore libraries downloaded from Geotools Maven repository.
Property Changed:
----------------
trunk/eXist/extensions/indexes/spatial/lib/
Property changes on: trunk/eXist/extensions/indexes/spatial/lib
___________________________________________________________________
Name: svn:ignore
- gt2-api-2.4-M1.jar
gt2-epsg-wkt-2.4-M1.jar
gt2-main-2.4-M1.jar
gt2-metadata-2.4-M1.jar
gt2-referencing-2.4-M1.jar
gt2-xml-2.4-M1.jar
jsr108-0.01.jar
jts-1.8.jar
vecmath-1.3.1.jar
+ gt2-api-2.4-M1.jar
gt2-epsg-wkt-2.4-M1.jar
gt2-main-2.4-M1.jar
gt2-metadata-2.4-M1.jar
gt2-referencing-2.4-M1.jar
gt2-xml-2.4-M1.jar
jsr108-0.01.jar
jts-1.8.jar
vecmath-1.3.1.jar
gt2-epsg-extension-2.4-M2.jar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 22:11:04
|
Revision: 5971
http://svn.sourceforge.net/exist/?rev=5971&view=rev
Author: brihaye
Date: 2007-05-31 15:10:58 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Upgraded a Geotools library
Modified Paths:
--------------
trunk/eXist/extensions/indexes/spatial/build.xml
Removed Paths:
-------------
trunk/eXist/extensions/indexes/spatial/lib/gt2-epsg-extension-2.4-M1.jar
Modified: trunk/eXist/extensions/indexes/spatial/build.xml
===================================================================
--- trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 21:16:18 UTC (rev 5970)
+++ trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 22:10:58 UTC (rev 5971)
@@ -7,14 +7,10 @@
<target name="prepare-libs">
<mkdir dir="${lib.dir}"/>
- <!-- geoapi-nogenerics-2.1-M3.jar -->
<get src="http://lists.refractions.net/m2/org/geotools/gt2-api/2.4-M1/gt2-api-2.4-M1.jar"
dest="${lib.dir}/gt2-api-2.4-M1.jar" verbose="true" usetimestamp="true" />
- <!--
- Doesn't work and... 2.4-M1 isn't available any more !
<get src="http://lists.refractions.net/m2/org/geotools/gt2-epsg-extension/2.4-M2/gt2-epsg-extension-2.4-M2.jar"
- dest="${lib.dir}/gt2-epsg-extension-2.4-M2.jar" verbose="true" usetimestamp="true" />
- -->
+ dest="${lib.dir}/gt2-epsg-extension-2.4-M2.jar" verbose="true" usetimestamp="true" />
<get src="http://lists.refractions.net/m2/org/geotools/gt2-epsg-wkt/2.4-M1/gt2-epsg-wkt-2.4-M1.jar"
dest="${lib.dir}/gt2-epsg-wkt-2.4-M1.jar" verbose="true" usetimestamp="true" />
<get src="http://lists.refractions.net/m2/org/geotools/gt2-api/2.4-M1/gt2-api-2.4-M1.jar"
@@ -27,6 +23,7 @@
dest="${lib.dir}/gt2-referencing-2.4-M1.jar" verbose="true" usetimestamp="true" />
<get src="http://lists.refractions.net/m2/org/geotools/gt2-xml/2.4-M1/gt2-xml-2.4-M1.jar"
dest="${lib.dir}/gt2-xml-2.4-M1.jar" verbose="true" usetimestamp="true" />
+ <!-- geoapi-nogenerics-2.1-M3.jar -->
<!-- hsqldb-1.8.0.7.jar -->
<get src="http://maven.geotools.fr/repository/javax/units/jsr108/0.01/jsr108-0.01.jar"
dest="${lib.dir}/jsr108-0.01.jar" verbose="true" usetimestamp="true" />
Deleted: trunk/eXist/extensions/indexes/spatial/lib/gt2-epsg-extension-2.4-M1.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 21:16:19
|
Revision: 5970
http://svn.sourceforge.net/exist/?rev=5970&view=rev
Author: brihaye
Date: 2007-05-31 14:16:18 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Ignore libraries downloaded from Geotools Maven repository.
Property Changed:
----------------
trunk/eXist/extensions/indexes/spatial/lib/
Property changes on: trunk/eXist/extensions/indexes/spatial/lib
___________________________________________________________________
Name: svn:ignore
- gt2-api-2.4-M1.jar
gt2-epsg-wkt-2.4-M1.jar
gt2-main-2.4-M1.jar
gt2-metadata-2.4-M1.jar
gt2-referencing-2.4-M1.jar
gt2-xml-2.4-M1.jar
+ gt2-api-2.4-M1.jar
gt2-epsg-wkt-2.4-M1.jar
gt2-main-2.4-M1.jar
gt2-metadata-2.4-M1.jar
gt2-referencing-2.4-M1.jar
gt2-xml-2.4-M1.jar
jsr108-0.01.jar
jts-1.8.jar
vecmath-1.3.1.jar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 21:10:43
|
Revision: 5969
http://svn.sourceforge.net/exist/?rev=5969&view=rev
Author: brihaye
Date: 2007-05-31 14:10:39 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Found another Maven repository for Geotools libraries
Modified Paths:
--------------
trunk/eXist/extensions/indexes/spatial/build.xml
Removed Paths:
-------------
trunk/eXist/extensions/indexes/spatial/lib/jsr108-0.01.jar
trunk/eXist/extensions/indexes/spatial/lib/jts-1.8.jar
trunk/eXist/extensions/indexes/spatial/lib/vecmath-1.3.1.jar
Modified: trunk/eXist/extensions/indexes/spatial/build.xml
===================================================================
--- trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 20:27:28 UTC (rev 5968)
+++ trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 21:10:39 UTC (rev 5969)
@@ -28,9 +28,12 @@
<get src="http://lists.refractions.net/m2/org/geotools/gt2-xml/2.4-M1/gt2-xml-2.4-M1.jar"
dest="${lib.dir}/gt2-xml-2.4-M1.jar" verbose="true" usetimestamp="true" />
<!-- hsqldb-1.8.0.7.jar -->
- <!-- jsr108-0.01.jar -->
- <!-- jts-1.8.jar -->
- <!-- vecmath-1.3.1.jar -->
+ <get src="http://maven.geotools.fr/repository/javax/units/jsr108/0.01/jsr108-0.01.jar"
+ dest="${lib.dir}/jsr108-0.01.jar" verbose="true" usetimestamp="true" />
+ <get src="http://maven.geotools.fr/repository/com/vividsolutions/jts/1.8/jts-1.8.jar"
+ dest="${lib.dir}/jts-1.8.jar" verbose="true" usetimestamp="true" />
+ <get src="http://maven.geotools.fr/repository/java3d/vecmath/1.3.1/vecmath-1.3.1.jar"
+ dest="${lib.dir}/vecmath-1.3.1.jar" verbose="true" usetimestamp="true" />
</target>
<target name="jar" depends="prepare-libs, compile">
Deleted: trunk/eXist/extensions/indexes/spatial/lib/jsr108-0.01.jar
===================================================================
(Binary files differ)
Deleted: trunk/eXist/extensions/indexes/spatial/lib/jts-1.8.jar
===================================================================
(Binary files differ)
Deleted: trunk/eXist/extensions/indexes/spatial/lib/vecmath-1.3.1.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 20:27:30
|
Revision: 5968
http://svn.sourceforge.net/exist/?rev=5968&view=rev
Author: brihaye
Date: 2007-05-31 13:27:28 -0700 (Thu, 31 May 2007)
Log Message:
-----------
defining a "prepare" target wasn't a good idea
Modified Paths:
--------------
trunk/eXist/extensions/indexes/ngram/build.xml
trunk/eXist/extensions/indexes/spatial/build.xml
Modified: trunk/eXist/extensions/indexes/ngram/build.xml
===================================================================
--- trunk/eXist/extensions/indexes/ngram/build.xml 2007-05-31 20:02:20 UTC (rev 5967)
+++ trunk/eXist/extensions/indexes/ngram/build.xml 2007-05-31 20:27:28 UTC (rev 5968)
@@ -2,10 +2,6 @@
<import file="../common.xml"/>
- <target name="prepare">
- <!-- nothing to do -->
- </target>
-
<target name="jar" depends="compile">
<jar destfile="${top.dir}/exist-modules.jar" basedir="${classes}"
keepcompression="true" update="true"/>
Modified: trunk/eXist/extensions/indexes/spatial/build.xml
===================================================================
--- trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 20:02:20 UTC (rev 5967)
+++ trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 20:27:28 UTC (rev 5968)
@@ -5,7 +5,7 @@
<property name="resources.dir" value="./test/resources"/>
<property name="lib.dir" value="./lib"/>
- <target name="prepare">
+ <target name="prepare-libs">
<mkdir dir="${lib.dir}"/>
<!-- geoapi-nogenerics-2.1-M3.jar -->
<get src="http://lists.refractions.net/m2/org/geotools/gt2-api/2.4-M1/gt2-api-2.4-M1.jar"
@@ -33,7 +33,7 @@
<!-- vecmath-1.3.1.jar -->
</target>
- <target name="jar" depends="compile">
+ <target name="jar" depends="prepare-libs, compile">
<jar destfile="${top.dir}/exist-modules.jar" basedir="${classes}"
keepcompression="true" update="true"/>
</target>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2007-05-31 20:02:21
|
Revision: 5967
http://svn.sourceforge.net/exist/?rev=5967&view=rev
Author: wolfgang_m
Date: 2007-05-31 13:02:20 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Don't clear external variable bindings If a query needs to be re-analyzed after optimizations were applied. This fixes some of the remaining test failures which occur in the test suite if you run it with enable-query-rewriting="yes".
Modified Paths:
--------------
trunk/eXist/src/org/exist/xquery/XQuery.java
trunk/eXist/src/org/exist/xquery/XQueryContext.java
Modified: trunk/eXist/src/org/exist/xquery/XQuery.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/XQuery.java 2007-05-31 19:51:41 UTC (rev 5966)
+++ trunk/eXist/src/org/exist/xquery/XQuery.java 2007-05-31 20:02:20 UTC (rev 5967)
@@ -150,7 +150,7 @@
Optimizer optimizer = new Optimizer(context);
expr.accept(optimizer);
if (optimizer.hasOptimized()) {
- context.reset();
+ context.reset(true);
expr.analyze(new AnalyzeContextInfo());
}
}
Modified: trunk/eXist/src/org/exist/xquery/XQueryContext.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/XQueryContext.java 2007-05-31 19:51:41 UTC (rev 5966)
+++ trunk/eXist/src/org/exist/xquery/XQueryContext.java 2007-05-31 20:02:20 UTC (rev 5967)
@@ -746,12 +746,16 @@
lockedDocuments = null;
return remaining;
}
-
- /**
+
+ public void reset() {
+ reset(false);
+ }
+
+ /**
* Prepare this XQueryContext to be reused. This should be
* called when adding an XQuery to the cache.
*/
- public void reset() {
+ public void reset(boolean keepGlobals) {
builder = new MemTreeBuilder(this);
builder.startDocument();
staticDocumentPaths = null;
@@ -759,7 +763,9 @@
lastVar = null;
fragmentStack = new Stack();
callStack.clear();
- globalVariables.clear();
+
+ if (!keepGlobals)
+ globalVariables.clear();
//remove the context-vars, subsequent execution of the query
//may generate different values for the vars based on the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 19:51:42
|
Revision: 5966
http://svn.sourceforge.net/exist/?rev=5966&view=rev
Author: brihaye
Date: 2007-05-31 12:51:41 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Fixed http://sourceforge.net/tracker/index.php?func=detail&aid=1719076&group_id=17691&atid=117691
Modified Paths:
--------------
trunk/eXist/src/org/exist/xquery/Predicate.java
trunk/eXist/test/src/org/exist/xquery/XPathQueryTest.java
Modified: trunk/eXist/src/org/exist/xquery/Predicate.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/Predicate.java 2007-05-31 19:37:33 UTC (rev 5965)
+++ trunk/eXist/src/org/exist/xquery/Predicate.java 2007-05-31 19:51:41 UTC (rev 5966)
@@ -256,13 +256,26 @@
result.add(contextSequence.itemAt(position - 1));
}
} else {
+ Set positions = new TreeSet();
for (SequenceIterator i = contextSequence.iterate(); i.hasNext(); p++) {
context.setContextPosition(p);
Item item = i.nextItem();
Sequence innerSeq = inner.eval(contextSequence, item);
- if (innerSeq.effectiveBooleanValue())
+ if (innerSeq.hasOne() && Type.subTypeOf(innerSeq.getItemType(), Type.NUMBER)) {
+ //TODO : introduce a check in innerSeq.hasOne() ?
+ NumericValue nv = (NumericValue)innerSeq;
+ //Non integers return... nothing, not even an error !
+ if (!nv.hasFractionalPart() && !nv.isZero())
+ positions.add(nv);
+ } else if (innerSeq.effectiveBooleanValue())
result.add(item);
}
+ for (Iterator i = positions.iterator() ; i.hasNext() ;) {
+ int position = ((NumericValue)i.next()).getInt();
+ //TODO : move this test above ?
+ if (position <= contextSequence.getItemCount())
+ result.add(contextSequence.itemAt(position - 1));
+ }
}
}
return result;
Modified: trunk/eXist/test/src/org/exist/xquery/XPathQueryTest.java
===================================================================
--- trunk/eXist/test/src/org/exist/xquery/XPathQueryTest.java 2007-05-31 19:37:33 UTC (rev 5965)
+++ trunk/eXist/test/src/org/exist/xquery/XPathQueryTest.java 2007-05-31 19:51:41 UTC (rev 5966)
@@ -992,6 +992,36 @@
query = "(1,2,3)[position() = last()]";
result = queryResource(service, "numbers.xml", query, 1);
assertEquals("3", result.getResource(0).getContent().toString());
+
+ query = "declare function local:f ($n) { " +
+ "$n " +
+ "}; " +
+ " " +
+ "declare function local:g( $n ) { " +
+ "('OK','Fine','Wrong') [local:f($n) + 1 ] " +
+ "} ; " +
+ " " +
+ "declare function local:h( $n ) { " +
+ "('OK','Fine','Wrong') [local:f($n) ] " +
+ "} ; " +
+ " " +
+ "declare function local:j( $n ) { " +
+ "let $m := local:f($n) " +
+ "return " +
+ "('OK','Fine','Wrong') [$m + 1 ] " +
+ "} ; " +
+ " " +
+ "declare function local:k ( $n ) { " +
+ "('OK','Fine','Wrong') [ $n + 1 ] " +
+ "} ; " +
+ " " +
+ "local:f(1),local:g(1), local:h(1), local:j(1), local:k(1) ";
+ result = queryResource(service, "numbers.xml", query, 5);
+ assertEquals("1", result.getResource(0).getContent().toString());
+ assertEquals("Fine", result.getResource(1).getContent().toString());
+ assertEquals("OK", result.getResource(2).getContent().toString());
+ assertEquals("Fine", result.getResource(3).getContent().toString());
+ assertEquals("Fine", result.getResource(4).getContent().toString());
//The collection doesn't exist : let's see how the query behaves with empty sequences
query = "let $checkDate := xs:date(adjust-date-to-timezone(current-date(), ()))" +
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 19:37:34
|
Revision: 5965
http://svn.sourceforge.net/exist/?rev=5965&view=rev
Author: brihaye
Date: 2007-05-31 12:37:33 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Ignore libraries downloaded from Geotools Maven repository.
Property Changed:
----------------
trunk/eXist/extensions/indexes/spatial/lib/
Property changes on: trunk/eXist/extensions/indexes/spatial/lib
___________________________________________________________________
Name: svn:ignore
+ gt2-api-2.4-M1.jar
gt2-epsg-wkt-2.4-M1.jar
gt2-main-2.4-M1.jar
gt2-metadata-2.4-M1.jar
gt2-referencing-2.4-M1.jar
gt2-xml-2.4-M1.jar
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 19:31:12
|
Revision: 5964
http://svn.sourceforge.net/exist/?rev=5964&view=rev
Author: brihaye
Date: 2007-05-31 12:31:10 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Spatial index : download (some of) Geotools librairies from their Maven repository. Added a "prepare" target for this purpose.
Modified Paths:
--------------
trunk/eXist/extensions/indexes/ngram/build.xml
trunk/eXist/extensions/indexes/spatial/build.xml
Removed Paths:
-------------
trunk/eXist/extensions/indexes/spatial/lib/gt2-api-2.4-M1.jar
trunk/eXist/extensions/indexes/spatial/lib/gt2-epsg-wkt-2.4-M1.jar
trunk/eXist/extensions/indexes/spatial/lib/gt2-main-2.4-M1.jar
trunk/eXist/extensions/indexes/spatial/lib/gt2-metadata-2.4-M1.jar
trunk/eXist/extensions/indexes/spatial/lib/gt2-referencing-2.4-M1.jar
trunk/eXist/extensions/indexes/spatial/lib/gt2-xml-2.4-M1.jar
Modified: trunk/eXist/extensions/indexes/ngram/build.xml
===================================================================
--- trunk/eXist/extensions/indexes/ngram/build.xml 2007-05-31 15:23:19 UTC (rev 5963)
+++ trunk/eXist/extensions/indexes/ngram/build.xml 2007-05-31 19:31:10 UTC (rev 5964)
@@ -2,7 +2,11 @@
<import file="../common.xml"/>
- <target name="jar" depends="compile">
+ <target name="prepare">
+ <!-- nothing to do -->
+ </target>
+
+ <target name="jar" depends="compile">
<jar destfile="${top.dir}/exist-modules.jar" basedir="${classes}"
keepcompression="true" update="true"/>
</target>
Modified: trunk/eXist/extensions/indexes/spatial/build.xml
===================================================================
--- trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 15:23:19 UTC (rev 5963)
+++ trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 19:31:10 UTC (rev 5964)
@@ -3,8 +3,37 @@
<import file="../common.xml"/>
<property name="resources.dir" value="./test/resources"/>
+ <property name="lib.dir" value="./lib"/>
- <target name="jar" depends="compile">
+ <target name="prepare">
+ <mkdir dir="${lib.dir}"/>
+ <!-- geoapi-nogenerics-2.1-M3.jar -->
+ <get src="http://lists.refractions.net/m2/org/geotools/gt2-api/2.4-M1/gt2-api-2.4-M1.jar"
+ dest="${lib.dir}/gt2-api-2.4-M1.jar" verbose="true" usetimestamp="true" />
+ <!--
+ Doesn't work and... 2.4-M1 isn't available any more !
+ <get src="http://lists.refractions.net/m2/org/geotools/gt2-epsg-extension/2.4-M2/gt2-epsg-extension-2.4-M2.jar"
+ dest="${lib.dir}/gt2-epsg-extension-2.4-M2.jar" verbose="true" usetimestamp="true" />
+ -->
+ <get src="http://lists.refractions.net/m2/org/geotools/gt2-epsg-wkt/2.4-M1/gt2-epsg-wkt-2.4-M1.jar"
+ dest="${lib.dir}/gt2-epsg-wkt-2.4-M1.jar" verbose="true" usetimestamp="true" />
+ <get src="http://lists.refractions.net/m2/org/geotools/gt2-api/2.4-M1/gt2-api-2.4-M1.jar"
+ dest="${lib.dir}/gt2-api-2.4-M1.jar" verbose="true" usetimestamp="true" />
+ <get src="http://lists.refractions.net/m2/org/geotools/gt2-main/2.4-M1/gt2-main-2.4-M1.jar"
+ dest="${lib.dir}/gt2-main-2.4-M1.jar" verbose="true" usetimestamp="true" />
+ <get src="http://lists.refractions.net/m2/org/geotools/gt2-metadata/2.4-M1/gt2-metadata-2.4-M1.jar"
+ dest="${lib.dir}/gt2-metadata-2.4-M1.jar" verbose="true" usetimestamp="true" />
+ <get src="http://lists.refractions.net/m2/org/geotools/gt2-referencing/2.4-M1/gt2-referencing-2.4-M1.jar"
+ dest="${lib.dir}/gt2-referencing-2.4-M1.jar" verbose="true" usetimestamp="true" />
+ <get src="http://lists.refractions.net/m2/org/geotools/gt2-xml/2.4-M1/gt2-xml-2.4-M1.jar"
+ dest="${lib.dir}/gt2-xml-2.4-M1.jar" verbose="true" usetimestamp="true" />
+ <!-- hsqldb-1.8.0.7.jar -->
+ <!-- jsr108-0.01.jar -->
+ <!-- jts-1.8.jar -->
+ <!-- vecmath-1.3.1.jar -->
+ </target>
+
+ <target name="jar" depends="compile">
<jar destfile="${top.dir}/exist-modules.jar" basedir="${classes}"
keepcompression="true" update="true"/>
</target>
Deleted: trunk/eXist/extensions/indexes/spatial/lib/gt2-api-2.4-M1.jar
===================================================================
(Binary files differ)
Deleted: trunk/eXist/extensions/indexes/spatial/lib/gt2-epsg-wkt-2.4-M1.jar
===================================================================
(Binary files differ)
Deleted: trunk/eXist/extensions/indexes/spatial/lib/gt2-main-2.4-M1.jar
===================================================================
(Binary files differ)
Deleted: trunk/eXist/extensions/indexes/spatial/lib/gt2-metadata-2.4-M1.jar
===================================================================
(Binary files differ)
Deleted: trunk/eXist/extensions/indexes/spatial/lib/gt2-referencing-2.4-M1.jar
===================================================================
(Binary files differ)
Deleted: trunk/eXist/extensions/indexes/spatial/lib/gt2-xml-2.4-M1.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 15:23:24
|
Revision: 5963
http://svn.sourceforge.net/exist/?rev=5963&view=rev
Author: brihaye
Date: 2007-05-31 08:23:19 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Added 2 convenience functions to the spatial module.
Modified Paths:
--------------
trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/GMLHSQLIndexWorker.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/SpatialModule.java
trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java 2007-05-31 12:52:14 UTC (rev 5962)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java 2007-05-31 15:23:19 UTC (rev 5963)
@@ -63,6 +63,7 @@
import org.exist.util.DatabaseConfigurationException;
import org.exist.util.Occurrences;
import org.exist.util.serializer.Receiver;
+import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
import org.exist.xquery.value.AtomicValue;
import org.exist.xquery.value.NodeValue;
@@ -389,6 +390,8 @@
return getGeometricPropertyForNode(broker, p, conn, propertyName);
} catch (SQLException e) {
throw new SpatialIndexException(e);
+ } catch (XPathException e) {
+ throw new SpatialIndexException(e);
} finally {
releaseConnection(conn);
}
@@ -526,7 +529,7 @@
protected abstract Map getGeometriesForDocument(DocumentImpl doc, Connection conn) throws SQLException;
- protected abstract AtomicValue getGeometricPropertyForNode(DBBroker broker, NodeProxy p, Connection conn, String propertyName) throws SQLException;
+ protected abstract AtomicValue getGeometricPropertyForNode(DBBroker broker, NodeProxy p, Connection conn, String propertyName) throws SQLException, XPathException;
protected abstract Geometry getGeometryForNode(DBBroker broker, NodeProxy p, Connection conn) throws SQLException;
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/GMLHSQLIndexWorker.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/GMLHSQLIndexWorker.java 2007-05-31 12:52:14 UTC (rev 5962)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/GMLHSQLIndexWorker.java 2007-05-31 15:23:19 UTC (rev 5963)
@@ -43,7 +43,9 @@
import org.exist.security.PermissionDeniedException;
import org.exist.storage.DBBroker;
import org.exist.xmldb.XmldbURI;
+import org.exist.xquery.XPathException;
import org.exist.xquery.value.AtomicValue;
+import org.exist.xquery.value.Base64Binary;
import org.exist.xquery.value.BooleanValue;
import org.exist.xquery.value.DoubleValue;
import org.exist.xquery.value.StringValue;
@@ -587,7 +589,7 @@
}
}
- protected AtomicValue getGeometricPropertyForNode(DBBroker broker, NodeProxy p, Connection conn, String propertyName) throws SQLException {
+ protected AtomicValue getGeometricPropertyForNode(DBBroker broker, NodeProxy p, Connection conn, String propertyName) throws SQLException, XPathException {
PreparedStatement ps = conn.prepareStatement(
"SELECT " + propertyName +
" FROM " + GMLHSQLIndex.TABLE_NAME +
@@ -607,9 +609,12 @@
} else if (rs.getMetaData().getColumnClassName(1).equals(Double.class.getName())) {
result = new DoubleValue(rs.getDouble(1));
} else if (rs.getMetaData().getColumnClassName(1).equals(String.class.getName())) {
- result = new StringValue(rs.getString(1));
+ if ("WKB".equals(propertyName) || "EPSG4326_WKB".equals(propertyName))
+ result = new Base64Binary(rs.getString(1));
+ else
+ result = new StringValue(rs.getString(1));
} else
- throw new SQLException("Uniable to make an atomic value from '" + rs.getMetaData().getColumnClassName(1) + "'");
+ throw new SQLException("Unable to make an atomic value from '" + rs.getMetaData().getColumnClassName(1) + "'");
if (rs.next()) {
//Should be impossible
throw new SQLException("More than one geometry for node " + p);
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java 2007-05-31 12:52:14 UTC (rev 5962)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java 2007-05-31 15:23:19 UTC (rev 5963)
@@ -105,6 +105,14 @@
new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
+ new QName("getBbox", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the GML representation of the bounding box of geometry $a.",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ ),
+ new FunctionSignature(
new QName("convexHull", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
"Returns the GML representation of the convex hull of geometry $a.",
new SequenceType[]{
@@ -243,6 +251,26 @@
geometry = geometry.buffer(distance, quadrantSegments, endCapStyle);
}
+ } else if (isCalledAs("getBbox")) {
+ if (args[0].isEmpty())
+ result = Sequence.EMPTY_SEQUENCE;
+ else {
+ NodeValue geometryNode = (NodeValue) args[0].itemAt(0);
+ //Try to get the geometry from the index
+ if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
+ geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
+ srsName = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
+ hasUsedIndex = true;
+ //Otherwise, build it
+ } else {
+ geometry = indexWorker.streamGeometryForNode(context, geometryNode);
+ //Argl ! No SRS !
+ //srsName = ((Element)geometryNode).getAttribute("srsName").trim();
+ //Erroneous workaround
+ srsName = "osgb:BNG";
+ }
+ geometry = geometry.getEnvelope();
+ }
} else if (isCalledAs("convexHull")) {
if (args[0].isEmpty())
result = Sequence.EMPTY_SEQUENCE;
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java 2007-05-31 12:52:14 UTC (rev 5962)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java 2007-05-31 15:23:19 UTC (rev 5963)
@@ -35,6 +35,7 @@
import org.exist.xquery.IndexUseReporter;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
+import org.exist.xquery.value.Base64Binary;
import org.exist.xquery.value.BooleanValue;
import org.exist.xquery.value.DoubleValue;
import org.exist.xquery.value.NodeValue;
@@ -45,12 +46,16 @@
import org.w3c.dom.Element;
import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.io.WKBWriter;
import com.vividsolutions.jts.io.WKTWriter;
public class FunGeometricProperties extends BasicFunction implements IndexUseReporter {
boolean hasUsedIndex = false;
+ protected WKTWriter wktWriter = new WKTWriter();
+ protected WKBWriter wkbWriter = new WKBWriter();
+
public final static FunctionSignature[] signatures = {
new FunctionSignature(
new QName("GMLtoWKT", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
@@ -61,6 +66,14 @@
new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
+ new QName("getWKB", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the WKB representation of geometry $a",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.BASE64_BINARY, Cardinality.ZERO_OR_ONE)
+ ),
+ new FunctionSignature(
new QName("getMinX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
"Returns the minimal X of geometry $a",
new SequenceType[]{
@@ -117,8 +130,16 @@
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
+ new QName("getEPSG4326WKB", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the WKB representation of geometry $a in the EPSG:4326 SRS",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.BASE64_BINARY, Cardinality.ZERO_OR_ONE)
+ ),
+ new FunctionSignature(
new QName("getEPSG4326MinX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the minimal X of geometry $a",
+ "Returns the minimal X of geometry $a in the EPSG:4326 SRS",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
@@ -126,7 +147,7 @@
),
new FunctionSignature(
new QName("getEPSG4326MaxX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the maximal X of geometry $a",
+ "Returns the maximal X of geometry $a in the EPSG:4326 SRS",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
@@ -134,7 +155,7 @@
),
new FunctionSignature(
new QName("getEPSG4326MinY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the minimal Y of geometry $a",
+ "Returns the minimal Y of geometry $a in the EPSG:4326 SRS",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
@@ -142,7 +163,7 @@
),
new FunctionSignature(
new QName("getEPSG4326MaxY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the maximal Y of geometry $a",
+ "Returns the maximal Y of geometry $a in the EPSG:4326 SRS",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
@@ -150,7 +171,7 @@
),
new FunctionSignature(
new QName("getEPSG4326CentroidX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the X of centroid of geometry $a",
+ "Returns the X of centroid of geometry $a in the EPSG:4326 SRS",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
@@ -158,7 +179,7 @@
),
new FunctionSignature(
new QName("getEPSG4326CentroidY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the Y of centroid of geometry $a",
+ "Returns the Y of centroid of geometry $a in the EPSG:4326 SRS",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
@@ -166,7 +187,7 @@
),
new FunctionSignature(
new QName("getEPSG4326Area", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the area of geometry $a",
+ "Returns the area of geometry $a in the EPSG:4326 SRS",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
@@ -236,6 +257,8 @@
String propertyName = null;
if (isCalledAs("GMLtoWKT")) {
propertyName = "WKT";
+ } else if (isCalledAs("getWKB")) {
+ propertyName = "BASE64_WKB";
} else if (isCalledAs("getMinX")) {
propertyName = "MINX";
} else if (isCalledAs("getMaxX")) {
@@ -250,6 +273,8 @@
propertyName = "CENTROID_Y";
} else if (isCalledAs("getArea")) {
propertyName = "AREA";
+ } else if (isCalledAs("getEPSG4326WKB")) {
+ propertyName = "EPSG4326_BASE64_WKB";
} else if (isCalledAs("getEPSG4326MinX")) {
propertyName = "EPSG4326_MINX";
} else if (isCalledAs("getEPSG4326MaxX")) {
@@ -299,7 +324,9 @@
//Transform the geometry to EPSG:4326 if relevant
if (mySignature.getName().getLocalName().indexOf("EPSG4326") != Constants.STRING_NOT_FOUND) {
geometry = indexWorker.transformGeometry(geometry, sourceCRS, "EPSG:4326");
- if (isCalledAs("getEPSG4326MinX")) {
+ if (isCalledAs("getEPSG4326WKB")) {
+ result = new Base64Binary(wkbWriter.write(geometry));
+ } else if (isCalledAs("getEPSG4326MinX")) {
result = new DoubleValue(geometry.getEnvelopeInternal().getMinX());
} else if (isCalledAs("getEPSG4326MaxX")) {
result = new DoubleValue(geometry.getEnvelopeInternal().getMaxX());
@@ -315,8 +342,10 @@
result = new DoubleValue(geometry.getArea());
}
} else if (isCalledAs("GMLtoWKT")) {
- WKTWriter wktWriter = new WKTWriter();
+
result = new StringValue(wktWriter.write(geometry));
+ } else if (isCalledAs("getWKB")) {
+ result = new Base64Binary(wkbWriter.write(geometry));
} else if (isCalledAs("getMinX")) {
result = new DoubleValue(geometry.getEnvelopeInternal().getMinX());
} else if (isCalledAs("getMaxX")) {
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/SpatialModule.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/SpatialModule.java 2007-05-31 12:52:14 UTC (rev 5962)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/SpatialModule.java 2007-05-31 15:23:19 UTC (rev 5963)
@@ -62,6 +62,8 @@
new FunctionDef(FunGeometricProperties.signatures[18], FunGeometricProperties.class),
new FunctionDef(FunGeometricProperties.signatures[18], FunGeometricProperties.class),
new FunctionDef(FunGeometricProperties.signatures[19], FunGeometricProperties.class),
+ new FunctionDef(FunGeometricProperties.signatures[20], FunGeometricProperties.class),
+ new FunctionDef(FunGeometricProperties.signatures[21], FunGeometricProperties.class),
new FunctionDef(FunGMLProducers.signatures[0], FunGMLProducers.class),
new FunctionDef(FunGMLProducers.signatures[1], FunGMLProducers.class),
new FunctionDef(FunGMLProducers.signatures[2], FunGMLProducers.class),
@@ -72,7 +74,8 @@
new FunctionDef(FunGMLProducers.signatures[7], FunGMLProducers.class),
new FunctionDef(FunGMLProducers.signatures[8], FunGMLProducers.class),
new FunctionDef(FunGMLProducers.signatures[9], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[10], FunGMLProducers.class)
+ new FunctionDef(FunGMLProducers.signatures[10], FunGMLProducers.class),
+ new FunctionDef(FunGMLProducers.signatures[11], FunGMLProducers.class)
};
public SpatialModule() {
Modified: trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java 2007-05-31 12:52:14 UTC (rev 5962)
+++ trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java 2007-05-31 15:23:19 UTC (rev 5963)
@@ -386,6 +386,13 @@
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getWKB(//gml:Polygon[1])";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() > 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
"spatial:getMinX(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
@@ -435,6 +442,13 @@
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getEPSG4326WKB(//gml:Polygon[1])";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() > 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
"spatial:getEPSG4326MinX(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
@@ -543,6 +557,13 @@
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getWKB(" + IN_MEMORY_GML + ")";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() > 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
"spatial:getMinX(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
@@ -589,6 +610,13 @@
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getEPSG4326WKB(" + IN_MEMORY_GML + ")";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
@@ -638,10 +666,6 @@
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
-
-
-
-
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
@@ -725,6 +749,13 @@
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getBbox(//gml:Polygon[1])";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() > 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
"spatial:convexHull(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
@@ -793,6 +824,13 @@
"spatial:buffer((), 100, 1)";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
+ assertTrue(seq.getItemCount() == 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getBbox(())";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
assertTrue(seq.getItemCount() == 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
@@ -855,6 +893,13 @@
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getBbox(" + IN_MEMORY_GML + ")";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() > 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
"spatial:convexHull(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 12:52:17
|
Revision: 5962
http://svn.sourceforge.net/exist/?rev=5962&view=rev
Author: brihaye
Date: 2007-05-31 05:52:14 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Fixed a bug in spatial index updates which was apparently caused by the exceptions thrown by Geotools's SAX handler.
Not sure though... Looks to work well.
Modified Paths:
--------------
trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunSpatialSearch.java
trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java 2007-05-31 12:49:56 UTC (rev 5961)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java 2007-05-31 12:52:14 UTC (rev 5962)
@@ -214,9 +214,6 @@
//TODO : retain only geometries
topMost = currentNode;
}
- //PROVISIONAL
- if (!srsNamesStack.isEmpty())
- srsNamesStack.clear();
return topMost;
}
@@ -606,13 +603,13 @@
}
deferredElement = null;
}
- try {
+ String currentSrsName = null;
+ if (GML_NS.equals(element.getNamespaceURI()))
+ currentSrsName = (String)srsNamesStack.pop();
+ try {
handler.endElement(element.getNamespaceURI(), element.getLocalName(), element.getQName().getStringValue());
- String currentSrsName = null;
- if (GML_NS.equals(element.getNamespaceURI())) {
- currentSrsName = (String)srsNamesStack.pop();
- }
- if (streamedGeometry != null) {
+ //Some invalid/(yet) incomplete geometries don't have a SRS
+ if (streamedGeometry != null && currentSrsName != null) {
currentNodeId = element.getNodeId();
geometries.put(currentNodeId, new SRSGeometry(currentSrsName, streamedGeometry));
if (flushAfter != -1 && geometries.size() >= flushAfter) {
@@ -707,9 +704,9 @@
public SRSGeometry(String SRSName, Geometry geometry) {
if (SRSName == null)
- throw new IllegalArgumentException("null SRS");
+ throw new IllegalArgumentException("Got null SRS");
if (geometry == null)
- throw new IllegalArgumentException("null geometry");
+ throw new IllegalArgumentException("Got null geometry");
this.SRSName = SRSName;
this.geometry = geometry;
}
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java 2007-05-31 12:49:56 UTC (rev 5961)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java 2007-05-31 12:52:14 UTC (rev 5962)
@@ -33,6 +33,7 @@
import org.exist.xquery.BasicFunction;
import org.exist.xquery.Cardinality;
import org.exist.xquery.FunctionSignature;
+import org.exist.xquery.IndexUseReporter;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
import org.exist.xquery.value.DoubleValue;
@@ -47,7 +48,9 @@
import com.vividsolutions.jts.io.WKTReader;
import com.vividsolutions.jts.operation.buffer.BufferOp;
-public class FunGMLProducers extends BasicFunction {
+public class FunGMLProducers extends BasicFunction implements IndexUseReporter {
+
+ boolean hasUsedIndex = false;
public final static FunctionSignature[] signatures = {
new FunctionSignature(
@@ -178,6 +181,7 @@
if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
sourceSRS = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
+ hasUsedIndex = true;
//Otherwise, build it
} else {
geometry = indexWorker.streamGeometryForNode(context, geometryNode);
@@ -211,6 +215,7 @@
if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
srsName = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
+ hasUsedIndex = true;
//Otherwise, build it
} else {
geometry = indexWorker.streamGeometryForNode(context, geometryNode);
@@ -247,6 +252,7 @@
if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
srsName = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
+ hasUsedIndex = true;
//Otherwise, build it
} else {
geometry = indexWorker.streamGeometryForNode(context, geometryNode);
@@ -266,6 +272,7 @@
if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
srsName = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
+ hasUsedIndex = true;
//Otherwise, build it
} else {
geometry = indexWorker.streamGeometryForNode(context, geometryNode);
@@ -294,10 +301,12 @@
if (geometryNode1.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry1 = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode1);
srsName1 = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode1, "SRS_NAME").getStringValue();
+ hasUsedIndex = true;
}
if (geometryNode2.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry2 = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode2);
srsName2 = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode2, "SRS_NAME").getStringValue();
+ hasUsedIndex = true;
}
//Otherwise build them
if (geometry1 == null) {
@@ -320,7 +329,6 @@
geometry2 = indexWorker.transformGeometry(geometry2, srsName1, srsName2);
}
-
if (isCalledAs("intersection")) {
geometry = geometry1.intersection(geometry2);
} else if (isCalledAs("union")) {
@@ -353,4 +361,8 @@
return result;
}
+ public boolean hasUsedIndex() {
+ return hasUsedIndex;
+ }
+
}
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java 2007-05-31 12:49:56 UTC (rev 5961)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java 2007-05-31 12:52:14 UTC (rev 5962)
@@ -32,6 +32,7 @@
import org.exist.xquery.Cardinality;
import org.exist.xquery.Constants;
import org.exist.xquery.FunctionSignature;
+import org.exist.xquery.IndexUseReporter;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
import org.exist.xquery.value.BooleanValue;
@@ -46,8 +47,10 @@
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.WKTWriter;
-public class FunGeometricProperties extends BasicFunction {
-
+public class FunGeometricProperties extends BasicFunction implements IndexUseReporter {
+
+ boolean hasUsedIndex = false;
+
public final static FunctionSignature[] signatures = {
new FunctionSignature(
new QName("GMLtoWKT", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
@@ -276,6 +279,7 @@
if (propertyName != null) {
//The node should be indexed : get its properties
result = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, propertyName);
+ hasUsedIndex = true;
} else {
//Or, at least, its geometry for further processing
geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
@@ -347,4 +351,8 @@
return result;
}
+ public boolean hasUsedIndex() {
+ return hasUsedIndex;
+ }
+
}
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunSpatialSearch.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunSpatialSearch.java 2007-05-31 12:49:56 UTC (rev 5961)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunSpatialSearch.java 2007-05-31 12:52:14 UTC (rev 5962)
@@ -32,19 +32,13 @@
import org.exist.xquery.BasicFunction;
import org.exist.xquery.Cardinality;
import org.exist.xquery.FunctionSignature;
+import org.exist.xquery.IndexUseReporter;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
import org.exist.xquery.value.NodeValue;
import org.exist.xquery.value.Sequence;
import org.exist.xquery.value.SequenceType;
import org.exist.xquery.value.Type;
-import org.geotools.gml.GMLFilterDocument;
-import org.geotools.gml.GMLFilterGeometry;
-import org.geotools.gml.GMLHandlerJTS;
-import org.w3c.dom.Element;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.XMLFilterImpl;
import com.vividsolutions.jts.geom.Geometry;
@@ -55,84 +49,85 @@
* Time: 15:18:59
* To change this template use File | Settings | File Templates.
*/
-public class FunSpatialSearch extends BasicFunction {
+public class FunSpatialSearch extends BasicFunction implements IndexUseReporter {
+
+ boolean hasUsedIndex = false;
public final static FunctionSignature[] signatures = {
- new FunctionSignature(
- new QName("equals", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the nodes in $a that contain a geometry which is equal to geometry $b",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
- ),
- new FunctionSignature(
- new QName("disjoint", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the nodes in $a that contain a geometry which is disjoint with geometry $b",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
- ),
- new FunctionSignature(
- new QName("intersects", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the nodes in $a that contain a geometry which instersects with geometry $b",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
- ),
- new FunctionSignature(
- new QName("touches", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the nodes in $a that contain a geometry which touches geometry $b",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
- ),
- new FunctionSignature(
- new QName("crosses", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the nodes in $a that contain a geometry which crosses geometry $b",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
- ),
- new FunctionSignature(
- new QName("within", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the nodes in $a that contain a geometry which is within geometry $b",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
- ),
- new FunctionSignature(
- new QName("contains", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the nodes in $a that contain a geometry which contains geometry $b",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
- ),
- new FunctionSignature(
- new QName("overlaps", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the nodes in $a that contain a geometry which overlaps geometry $b",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
- )
- };
-
- private Geometry currentGeometry;
+ new FunctionSignature(
+ new QName("equals", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the nodes in $a that contain a geometry which is equal to geometry $b",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
+ ),
+ new FunctionSignature(
+ new QName("disjoint", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the nodes in $a that contain a geometry which is disjoint with geometry $b",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
+ ),
+ new FunctionSignature(
+ new QName("intersects", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the nodes in $a that contain a geometry which instersects with geometry $b",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
+ ),
+ new FunctionSignature(
+ new QName("touches", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the nodes in $a that contain a geometry which touches geometry $b",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
+ ),
+ new FunctionSignature(
+ new QName("crosses", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the nodes in $a that contain a geometry which crosses geometry $b",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
+ ),
+ new FunctionSignature(
+ new QName("within", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the nodes in $a that contain a geometry which is within geometry $b",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
+ ),
+ new FunctionSignature(
+ new QName("contains", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the nodes in $a that contain a geometry which contains geometry $b",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
+ ),
+ new FunctionSignature(
+ new QName("overlaps", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the nodes in $a that contain a geometry which overlaps geometry $b",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE),
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_MORE)
+ )
+ };
+
public FunSpatialSearch(XQueryContext context, FunctionSignature signature) {
super(context, signature);
@@ -144,7 +139,7 @@
if (nodes.isEmpty())
result = Sequence.EMPTY_SEQUENCE;
else if (args[1].isEmpty())
- //TODO : to be discusses. We could also return an empty sequence here
+ //TODO : to be discussed. We could also return an empty sequence here
result = nodes;
else {
try {
@@ -157,22 +152,14 @@
if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE)
//The node should be indexed
EPSG4326_geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
- if (EPSG4326_geometry == null) {
- //builds the geometry
- GMLHandlerJTS geometryHandler = new GeometryHandler();
- GMLFilterGeometry geometryFilter = new GMLFilterGeometry(geometryHandler);
- GMLFilterDocument handler = new GMLFilterDocument(geometryFilter);
- try {
- geometryNode.toSAX(context.getBroker(), (ContentHandler)handler, null);
- } catch (SAXException e) {
- throw new XPathException("Unable to serialize '" + geometryNode + "' as a valid GML geometry", e);
- }
- if (currentGeometry == null)
- throw new XPathException(geometryNode.getNode().getLocalName() + " is not a GML geometry node");
-
- //Transform the geometry to EPSG:4326
- String originSrsName = ((Element)geometryNode).getAttribute("srsName").trim();
- EPSG4326_geometry = indexWorker.transformGeometry(currentGeometry, originSrsName, "EPSG:4326");
+ if (EPSG4326_geometry == null) {
+ Geometry geometry = indexWorker.streamGeometryForNode(context, geometryNode);
+ //Argl ! No SRS !
+ //sourceCRS = ((Element)geometryNode).getAttribute("srsName").trim();
+ //Erroneous workaround
+ String sourceCRS = "osgb:BNG";
+ //Transform the geometry to EPSG:4326
+ EPSG4326_geometry = indexWorker.transformGeometry(geometry, sourceCRS, "EPSG:4326");
}
int spatialOp = SpatialOperator.UNKNOWN;
if (isCalledAs("equals"))
@@ -193,6 +180,7 @@
spatialOp = SpatialOperator.OVERLAPS;
//Search the EPSG:4326 in the index
result = indexWorker.search(context.getBroker(), nodes.toNodeSet(), EPSG4326_geometry, spatialOp);
+ hasUsedIndex = true;
} catch (SpatialIndexException e) {
throw new XPathException(e);
}
@@ -200,9 +188,7 @@
return result;
}
- private class GeometryHandler extends XMLFilterImpl implements GMLHandlerJTS {
- public void geometry(Geometry geometry) {
- currentGeometry = geometry;
- }
+ public boolean hasUsedIndex() {
+ return hasUsedIndex;
}
}
Modified: trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java 2007-05-31 12:49:56 UTC (rev 5961)
+++ trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java 2007-05-31 12:52:14 UTC (rev 5962)
@@ -943,7 +943,9 @@
String query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getArea(//gml:Polygon[1])";
+ "(# exist:force-index-use #) { " +
+ "spatial:getArea(//gml:Polygon[1]) " +
+ "}";
Sequence seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() == 1);
@@ -960,7 +962,9 @@
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getArea(//gml:Polygon[1])";
+ "(# exist:force-index-use #) { " +
+ "spatial:getArea(//gml:Polygon[1])" +
+ "}";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() == 1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 12:49:58
|
Revision: 5961
http://svn.sourceforge.net/exist/?rev=5961&view=rev
Author: brihaye
Date: 2007-05-31 05:49:56 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Added a new interface to report index usage. To be improved ; there is probably a merge to do with org.exist.xquery.Optimizable.
Modified Paths:
--------------
trunk/eXist/src/org/exist/xquery/ForceIndexUse.java
trunk/eXist/src/org/exist/xquery/GeneralComparison.java
trunk/eXist/src/org/exist/xquery/functions/FunMatches.java
Added Paths:
-----------
trunk/eXist/src/org/exist/xquery/IndexUseReporter.java
Modified: trunk/eXist/src/org/exist/xquery/ForceIndexUse.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/ForceIndexUse.java 2007-05-31 11:26:17 UTC (rev 5960)
+++ trunk/eXist/src/org/exist/xquery/ForceIndexUse.java 2007-05-31 12:49:56 UTC (rev 5961)
@@ -44,8 +44,8 @@
bailout = !expression.hasUsedIndex();
}
public void visitBuiltinFunction(Function expression) {
- if (expression instanceof FunMatches)
- bailout = !((FunMatches)expression).hasUsedIndex();
+ if (expression instanceof IndexUseReporter)
+ bailout = !((IndexUseReporter)expression).hasUsedIndex();
}
});
Modified: trunk/eXist/src/org/exist/xquery/GeneralComparison.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/GeneralComparison.java 2007-05-31 11:26:17 UTC (rev 5960)
+++ trunk/eXist/src/org/exist/xquery/GeneralComparison.java 2007-05-31 12:49:56 UTC (rev 5961)
@@ -26,7 +26,6 @@
import java.util.List;
import org.exist.EXistException;
-import org.exist.xmldb.XmldbURI;
import org.exist.collections.Collection;
import org.exist.dom.ContextItem;
import org.exist.dom.DocumentSet;
@@ -38,6 +37,7 @@
import org.exist.storage.DBBroker;
import org.exist.storage.ElementValue;
import org.exist.storage.Indexable;
+import org.exist.xmldb.XmldbURI;
import org.exist.xquery.util.ExpressionDumper;
import org.exist.xquery.value.AtomicValue;
import org.exist.xquery.value.BooleanValue;
@@ -51,7 +51,7 @@
*
* @author wolf
*/
-public class GeneralComparison extends BinaryOp implements Optimizable {
+public class GeneralComparison extends BinaryOp implements Optimizable, IndexUseReporter {
/**
* The type of operator used for the comparison, i.e. =, !=, <, > ...
Added: trunk/eXist/src/org/exist/xquery/IndexUseReporter.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/IndexUseReporter.java (rev 0)
+++ trunk/eXist/src/org/exist/xquery/IndexUseReporter.java 2007-05-31 12:49:56 UTC (rev 5961)
@@ -0,0 +1,38 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2007 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ *
+ * @author Pierrick Brihaye <pie...@fr...>
+ */
+package org.exist.xquery;
+
+/** Expressions that use an index to speed-up their evaluation may implement this interface.
+ * Tt will help index-related pragmas like (# exist:force-index-use #) { foo }
+ *
+ * Probably to be merged with org.exist.xquery.Optimizable in the future.
+ *
+ * @author brihaye
+ *
+ */
+public interface IndexUseReporter {
+
+ public boolean hasUsedIndex();
+
+}
Modified: trunk/eXist/src/org/exist/xquery/functions/FunMatches.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/FunMatches.java 2007-05-31 11:26:17 UTC (rev 5960)
+++ trunk/eXist/src/org/exist/xquery/functions/FunMatches.java 2007-05-31 12:49:56 UTC (rev 5961)
@@ -47,6 +47,7 @@
import org.exist.xquery.Expression;
import org.exist.xquery.Function;
import org.exist.xquery.FunctionSignature;
+import org.exist.xquery.IndexUseReporter;
import org.exist.xquery.LocationStep;
import org.exist.xquery.NodeTest;
import org.exist.xquery.Optimizable;
@@ -70,7 +71,7 @@
*
* @author Wolfgang Meier (wol...@ex...)
*/
-public class FunMatches extends Function implements Optimizable {
+public class FunMatches extends Function implements Optimizable, IndexUseReporter {
public final static FunctionSignature signatures[] = {
new FunctionSignature(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <del...@us...> - 2007-05-31 11:26:19
|
Revision: 5960
http://svn.sourceforge.net/exist/?rev=5960&view=rev
Author: deliriumsky
Date: 2007-05-31 04:26:17 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Committing patches by Jos?\195?\169 Mar?\195?\173a Fern?\195?\161ndez, add's RPC encoded style alongside document literal style. Thanks Jos?\195?\169 :-)
The SOAP Server can now also receive and respond with arbitary XML nodes as part of the document thanks to fixes of eXist's in-memory node handling
Modified Paths:
--------------
trunk/eXist/src/org/exist/http/SOAPServer.java
trunk/eXist/tools/SOAPServer/README.txt
trunk/eXist/tools/SOAPServer/echo.xqws
trunk/eXist/tools/SOAPServer/soap.response.xslt
trunk/eXist/tools/SOAPServer/wsdl.xslt
Modified: trunk/eXist/src/org/exist/http/SOAPServer.java
===================================================================
--- trunk/eXist/src/org/exist/http/SOAPServer.java 2007-05-31 10:24:34 UTC (rev 5959)
+++ trunk/eXist/src/org/exist/http/SOAPServer.java 2007-05-31 11:26:17 UTC (rev 5960)
@@ -92,10 +92,10 @@
import org.xml.sax.XMLReader;
/**
- * @author Adam Retter (ada...@de...)
- * @author Jose Maria Fernandez (contributor)
+ * @author Adam Retter <ada...@de...>
+ * @author Jose Maria Fernandez
*
- * @serial 20061128T11:49:00
+ * @serial 20070531T12:18:00
*
* The SOAPServer allows Web Services to be written in XQuery; it translates a
* SOAP Request to an XQuery function call and then translates the result of the
@@ -106,9 +106,8 @@
* generate WSDL and human readable descriptions of the web service and individual
* functions.
*
- * XSLT's are provided for document-oriented Web Service's and are located
- * in $EXIST_HOME/tools/SOAPServer
- *
+ * XSLT's are provided for both document literal and RPC style Web Service's and are
+ * located in $EXIST_HOME/tools/SOAPServer
*/
public class SOAPServer
{
@@ -244,9 +243,10 @@
//add the function call to the xquery
String functionName = xqwsSOAPFunction.getLocalName();
- if(functionName==null) {
- functionName=xqwsSOAPFunction.getNodeName();
- }
+ if(functionName == null)
+ {
+ functionName = xqwsSOAPFunction.getNodeName();
+ }
query.append(xqwsDescription.getNamespace().getLocalName() + ":" + functionName + "(");
//add the arguments for the function call if any
@@ -276,7 +276,7 @@
query.append(")");
//compile the query
- return compileXQuery(broker, new StringSource(query.toString()), new XmldbURI[] { xqwsDescription.getCollectionURI() }, xqwsDescription.getCollectionURI(), request, response);
+ return compileXQuery(broker, new StringSource(query.toString()), new XmldbURI[]{xqwsDescription.getCollectionURI()}, xqwsDescription.getCollectionURI(), request, response);
}
@@ -289,67 +289,85 @@
* @param postfix The postfix for the value (casting syntax)
* @param isAtomic Whether the value of this type should be atomic or not (or even both)
*/
- private void processParameterValue(StringBuffer param,Node nParamSeqItem,String prefix,String postfix,int isAtomic)
- throws XPathException
+ private void processParameterValue(StringBuffer param,Node nParamSeqItem,String prefix,String postfix,int isAtomic) throws XPathException
{
- boolean justOnce=false;
- StringBuffer whiteContent=new StringBuffer();
+ boolean justOnce = false;
+ StringBuffer whiteContent = new StringBuffer();
- try {
- Transformer tr=TransformerFactory.newInstance().newTransformer();
+ try
+ {
+ Transformer tr = TransformerFactory.newInstance().newTransformer();
tr.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,"yes");
- Node n=nParamSeqItem.getFirstChild();
- StringWriter sw=new StringWriter();
- StreamResult result=new StreamResult(sw);
- StringBuffer psw=sw.getBuffer();
- while(n!=null) {
- switch(n.getNodeType()) {
+ Node n = nParamSeqItem.getFirstChild();
+ StringWriter sw = new StringWriter();
+ StreamResult result = new StreamResult(sw);
+ StringBuffer psw = sw.getBuffer();
+ while(n != null)
+ {
+ switch(n.getNodeType())
+ {
case Node.ELEMENT_NODE:
- if(isAtomic>0) {
- throw new Exception("Content of "+nParamSeqItem.getNodeName()+" must be an atomic value");
+ if(isAtomic>0)
+ {
+ throw new Exception("Content of " + nParamSeqItem.getNodeName() + " must be an atomic value");
}
- isAtomic=-1;
- if(justOnce) {
- throw new Exception(nParamSeqItem.getNodeName()+" must have ONLY ONE element child");
+ isAtomic = -1;
+ if(justOnce)
+ {
+ throw new Exception(nParamSeqItem.getNodeName() + " must have ONLY ONE element child");
}
- DOMSource source=new DOMSource(n);
+ DOMSource source = new DOMSource(n);
tr.transform(source,result);
// Only once!
- justOnce=true;
+ justOnce = true;
break;
case Node.TEXT_NODE:
case Node.CDATA_SECTION_NODE:
- String nodeValue=n.getNodeValue();
- boolean isNotWhite=!nodeValue.matches("[ \n\r\t]+");
- if(isAtomic>=0) {
- if(isNotWhite || isAtomic>0) {
- if(isAtomic==0) {
- isAtomic=1;
+ String nodeValue = n.getNodeValue();
+ boolean isNotWhite =! nodeValue.matches("[ \n\r\t]+");
+ if(isAtomic >= 0)
+ {
+ if(isNotWhite || isAtomic>0)
+ {
+ if(isAtomic == 0)
+ {
+ isAtomic = 1;
}
psw.append(nodeValue);
- } else if(isAtomic==0) {
+ }
+ else if(isAtomic == 0)
+ {
whiteContent.append(nodeValue);
}
- } else if(isNotWhite) {
- throw new Exception(nParamSeqItem.getNodeName()+" has mixed content, but it must have only one element child");
}
+ else if(isNotWhite)
+ {
+ throw new Exception(nParamSeqItem.getNodeName() + " has mixed content, but it must have only one element child");
+ }
break;
}
- n=n.getNextSibling();
+ n = n.getNextSibling();
}
- if(isAtomic>=0) {
+ if(isAtomic >= 0)
+ {
param.append(prefix);
}
- if(isAtomic==0) {
+ if(isAtomic == 0)
+ {
param.append(whiteContent);
- } else {
+ }
+ else
+ {
param.append(psw);
}
- if(isAtomic>=0) {
- param.append(postfix);
+ if(isAtomic >= 0)
+ {
+ param.append(postfix);
}
- } catch(Exception e) {
+ }
+ catch(Exception e)
+ {
throw new XPathException(e.getMessage());
}
}
@@ -370,40 +388,44 @@
//determine the type of the parameter
int type = Type.getType(paramType);
- int isAtomic=(Type.subTypeOf(type,Type.ATOMIC))?1:((Type.subTypeOf(type,Type.NODE))?-1:0);
+ int isAtomic = (Type.subTypeOf(type,Type.ATOMIC)) ? 1 : ((Type.subTypeOf(type,Type.NODE)) ? -1 : 0);
- if(isAtomic>=0) {
- if(isAtomic>0 && type!=Type.STRING) {
- String typeName=Type.getTypeName(type);
- if(typeName!=null) {
- prefix=typeName+"(\"";
- postfix = "\")";
- }
- } else {
+ if(isAtomic >= 0)
+ {
+ if(isAtomic >0 && type != Type.STRING)
+ {
+ String typeName = Type.getTypeName(type);
+ if(typeName != null)
+ {
+ prefix = typeName + "(\"";
+ postfix = "\")";
+ }
+ }
+ else
+ {
prefix = "\"";
postfix = prefix;
- }
- }
+ }
+ }
- StringBuffer param = new StringBuffer();
+ StringBuffer param = new StringBuffer();
+
//determine the cardinality of the parameter
if(paramCardinality >= Cardinality.MANY)
{
//sequence
-
param.append("(");
NodeList nlParamSequenceItems = nSOAPParam.getChildNodes();
- for(int i=0; i < nlParamSequenceItems.getLength(); i++)
+ for(int i = 0; i < nlParamSequenceItems.getLength(); i++)
{
Node nParamSeqItem = nlParamSequenceItems.item(i);
if(nParamSeqItem.getNodeType() == Node.ELEMENT_NODE)
{
- processParameterValue(param,nParamSeqItem,prefix,postfix,isAtomic);
+ processParameterValue(param, nParamSeqItem, prefix, postfix, isAtomic);
param.append(","); //seperator for next item in sequence
-
- }
+ }
}
//remove last superflurous seperator
@@ -416,10 +438,10 @@
}
else
{
- processParameterValue(param,nSOAPParam,prefix,postfix,isAtomic);
+ processParameterValue(param, nSOAPParam, prefix, postfix, isAtomic);
}
- return param;
+ return param;
}
/**
@@ -486,12 +508,20 @@
byte[] result = null;
if(request.getParameter("WSDL") != null || request.getParameter("wsdl") != null)
{
- //WSDL
+ //WSDL document literal
result = description.getWSDL();
//set output content type for wsdl
response.setContentType(MimeType.XML_TYPE.getName());
}
+ else if(request.getParameter("WSDLRPC") != null || request.getParameter("wsdlrpc") != null)
+ {
+ //WSDL RPC
+ result = description.getWSDL(false);
+
+ //set output content type for wsdl
+ response.setContentType(MimeType.XML_TYPE.getName());
+ }
else if(request.getParameter("function") != null)
{
//Specific Function Description
@@ -553,7 +583,7 @@
{
offset += bytes;
}
-
+
// 2) Create an XML Document from the SOAP Request
Document soapRequest = null;
try
@@ -572,7 +602,6 @@
// 4) Extract the function call from the SOAP Request
NodeList nlBody = soapRequest.getDocumentElement().getElementsByTagNameNS(Namespaces.SOAP_ENVELOPE, "Body");
- //NodeList nlBody = soapRequest.getElementsByTagName("SOAP-ENV:Body");
Node nSOAPBody = nlBody.item(0);
NodeList nlBodyChildren = nSOAPBody.getChildNodes();
Node nSOAPFunction = null;
@@ -607,6 +636,10 @@
return;
}
+ // 4.5) Detemine encoding style
+ String encodingStyle = ((org.w3c.dom.Element)nSOAPFunction).getAttributeNS(Namespaces.SOAP_ENVELOPE, "encodingStyle");
+ boolean isRpcEncoded = (encodingStyle != null && encodingStyle.equals("http://schemas.xmlsoap.org/soap/encoding/"));
+
// 5) Execute the XQWS function indicated by the SOAP request
try
{
@@ -621,11 +654,12 @@
Sequence xqwsResult = xqueryService.execute(xqCallXQWS, null);
// 6) Create a SOAP Response describing the Result
- String funcName=nSOAPFunction.getLocalName();
- if(funcName==null) {
- funcName=nSOAPFunction.getNodeName();
- }
- byte[] result = description.getSOAPResponse(funcName, xqwsResult, request);
+ String funcName = nSOAPFunction.getLocalName();
+ if(funcName == null)
+ {
+ funcName = nSOAPFunction.getNodeName();
+ }
+ byte[] result = description.getSOAPResponse(funcName, xqwsResult, request,isRpcEncoded);
// 7) Send the SOAP Response to the http servlet response
response.setContentType(MimeType.XML_TYPE.getName());
@@ -732,9 +766,7 @@
//TODO: SHARE THIS FUNCTION WITH RESTServer (copied at the moment)
private void writeResponse(HttpServletResponse response, String data, String contentType, String encoding) throws IOException
- {
-// response.setCharacterEncoding(encoding);
-
+ {
// possible format contentType: text/xml; charset=UTF-8
if ( contentType != null && !response.isCommitted() ) {
@@ -775,8 +807,8 @@
//cache for XQWS WSDL
private long lastModifiedWSDL = 0;
- private byte[] descriptionWSDL = null;
-
+ private byte[][] descriptionWSDL = {null, null};
+
//cache for XQWS Human Readable description
private long lastModifiedHuman = 0;
private byte[] descriptionHuman = null;
@@ -881,27 +913,48 @@
*/
public byte[] getWSDL() throws PermissionDeniedException, TransformerConfigurationException, SAXException
{
+ return getWSDL(true);
+ }
+
+ /**
+ * Returns the WSDL for the XQWS Description
+ * Caches the result, however the cache is regenerated if
+ * the StyleSheet used for the transformation changes
+ *
+ * @return byte array containing the WSDL
+ */
+ public byte[] getWSDL(boolean isDocumentLiteral) throws PermissionDeniedException, TransformerConfigurationException, SAXException
+ {
DocumentImpl docStyleSheet = null;
- try {
+ int wsdlIndex = isDocumentLiteral ? 0 : 1;
+ try
+ {
//get the WSDL StyleSheet
docStyleSheet = broker.getXMLResource(XmldbURI.create(XSLT_WEBSERVICE_WSDL), Lock.READ_LOCK);
//has the stylesheet changed, or is this the first call for this version
- if(docStyleSheet.getMetadata().getLastModified() != lastModifiedWSDL || descriptionWSDL == null)
+ if(docStyleSheet.getMetadata().getLastModified() != lastModifiedWSDL || descriptionWSDL[wsdlIndex] == null)
{
//TODO: validate the WSDL
+ Properties params = new Properties();
+ params.put("isDocumentLiteral", isDocumentLiteral ? "true" : "false");
+
//yes, so re-run the transformation
- descriptionWSDL = Transform(docXQWSDescription, docStyleSheet, null);
+ descriptionWSDL[wsdlIndex] = Transform(docXQWSDescription, docStyleSheet, params);
lastModifiedWSDL = docStyleSheet.getMetadata().getLastModified();
}
//return the result of the transformation
- return descriptionWSDL;
- } finally {
- if (docStyleSheet != null)
+ return descriptionWSDL[wsdlIndex];
+ }
+ finally
+ {
+ if(docStyleSheet != null)
+ {
//close the Stylesheet Document and release the read lock
- docStyleSheet.getUpdateLock().release(Lock.READ_LOCK);
+ docStyleSheet.getUpdateLock().release(Lock.READ_LOCK);
+ }
}
}
@@ -915,7 +968,8 @@
public byte[] getHumanDescription() throws PermissionDeniedException, TransformerConfigurationException, SAXException
{
DocumentImpl docStyleSheet = null;
- try {
+ try
+ {
//get the Human Description StyleSheet
docStyleSheet = broker.getXMLResource(XmldbURI.create(XSLT_WEBSERVICE_HUMAN_DESCRIPTION), Lock.READ_LOCK);
@@ -929,10 +983,14 @@
//return the result of the transformation
return descriptionHuman;
- } finally {
- if (docStyleSheet != null)
+ }
+ finally
+ {
+ if(docStyleSheet != null)
+ {
//close the Stylesheet Document and release the read lock
- docStyleSheet.getUpdateLock().release(Lock.READ_LOCK);
+ docStyleSheet.getUpdateLock().release(Lock.READ_LOCK);
+ }
}
}
@@ -948,7 +1006,8 @@
public byte[] getFunctionDescription(String functionName) throws PermissionDeniedException, TransformerConfigurationException, SAXException
{
DocumentImpl docStyleSheet = null;
- try {
+ try
+ {
//get the Function Description StyleSheet
docStyleSheet = broker.getXMLResource(XmldbURI.create(XSLT_WEBSERVICE_FUNCTION_DESCRIPTION), Lock.READ_LOCK);
@@ -973,10 +1032,14 @@
//return the result of the transformation from the cache
return (byte[])descriptionFunction.get(functionName);
- } finally {
- if (docStyleSheet != null)
+ }
+ finally
+ {
+ if(docStyleSheet != null)
+ {
//close the Stylesheet Document and release the read lock
docStyleSheet.getUpdateLock().release(Lock.READ_LOCK);
+ }
}
}
@@ -1144,7 +1207,7 @@
*
* @return byte array containing the SOAP Response
*/
- public byte[] getSOAPResponse(String functionName, Sequence functionResult, HttpServletRequest request) throws XPathException, PermissionDeniedException, TransformerConfigurationException, SAXException
+ public byte[] getSOAPResponse(String functionName, Sequence functionResult, HttpServletRequest request,boolean isRpcEncoded) throws XPathException, PermissionDeniedException, TransformerConfigurationException, SAXException
{
//get the Result StyleSheet for the SOAP Response
DocumentImpl docStyleSheet = broker.getXMLResource(XmldbURI.create(XSLT_WEBSERVICE_SOAP_RESPONSE), Lock.READ_LOCK);
@@ -1153,7 +1216,9 @@
org.exist.memtree.DocumentImpl docResult = describeWebService(modXQWS, xqwsFileURI, request, XQWSPath, functionName, functionResult);
//return the SOAP Response
- return Transform(docResult, docStyleSheet, null);
+ Properties params = new Properties();
+ params.put("isDocumentLiteral", isRpcEncoded ? "false" : "true");
+ return Transform(docResult, docStyleSheet, params);
}
/**
@@ -1166,7 +1231,10 @@
// 1) Get the XQWS
BinaryDocument docXQWS = getXQWS(broker, XQWSPath);
- if(docXQWS==null) throw new NotFoundException("Resource "+request.getRequestURL().toString()+" not found");
+ if(docXQWS == null)
+ {
+ throw new NotFoundException("Resource " + request.getRequestURL().toString() + " not found");
+ }
xqwsFileURI = docXQWS.getFileURI();
xqwsCollectionURI = docXQWS.getCollection().getURI();
@@ -1197,14 +1265,18 @@
private BinaryDocument getXQWS(DBBroker broker, String path) throws PermissionDeniedException
{
BinaryDocument docXQWS = null;
- try {
+ try
+ {
XmldbURI pathUri = XmldbURI.create(path);
docXQWS = (BinaryDocument) broker.getXMLResource(pathUri, Lock.READ_LOCK);
return docXQWS;
- } finally {
+ }
+ finally
+ {
//close the XQWS Document and release the read lock
- if(docXQWS!=null) {
- docXQWS.getUpdateLock().release(Lock.READ_LOCK);
+ if(docXQWS != null)
+ {
+ docXQWS.getUpdateLock().release(Lock.READ_LOCK);
}
}
}
@@ -1283,7 +1355,7 @@
query += "()";
//compile the query
- return compileXQuery(broker, new StringSource(query), new XmldbURI[] { xqwsCollectionUri}, xqwsCollectionUri, null, null);
+ return compileXQuery(broker, new StringSource(query), new XmldbURI[]{xqwsCollectionUri}, xqwsCollectionUri, null, null);
}
/**
@@ -1311,7 +1383,7 @@
private org.exist.memtree.DocumentImpl describeWebService(Module modXQWS, XmldbURI xqwsFileUri, HttpServletRequest request, String path, String functionName, Sequence functionResult) throws XPathException,SAXException
{
FunctionSignature[] xqwsFunctions = modXQWS.listFunctions();
- MemTreeBuilder builderWebserviceDoc = new MemTreeBuilder();
+ MemTreeBuilder builderWebserviceDoc = new MemTreeBuilder(broker.getXQueryService().newContext(AccessContext.REST));
builderWebserviceDoc.startDocument();
builderWebserviceDoc.startElement(new QName("webservice", null, null), null);
builderWebserviceDoc.startElement(new QName("name", null, null), null);
@@ -1428,13 +1500,13 @@
builderFunction.startElement(new QName("result", null, null), null);
//determine result cardinality
- DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builderFunction);
+ DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builderFunction);
if(iReturnCardinality >= Cardinality.MANY)
{
//sequence of values
builderFunction.startElement(new QName("sequence", null, null), null);
- for(int i=0; i < functionResult.getItemCount(); i++)
+ for(int i = 0; i < functionResult.getItemCount(); i++)
{
builderFunction.startElement(new QName("value", null, null), null);
functionResult.itemAt(i).copyTo(broker, receiver);
Modified: trunk/eXist/tools/SOAPServer/README.txt
===================================================================
--- trunk/eXist/tools/SOAPServer/README.txt 2007-05-31 10:24:34 UTC (rev 5959)
+++ trunk/eXist/tools/SOAPServer/README.txt 2007-05-31 11:26:17 UTC (rev 5960)
@@ -1,18 +1,20 @@
-SOAPServer Copyright 2006 Adam Retter <ada...@de...>
+SOAPServer Copyright 2007 Adam Retter <ada...@de...>
+Contributions by José María Fernández
SOAPServer is a Server module for the eXist EXistServlet that allows
webservices to be written in XQuery. Allowing for easy transportation
of XML data which can also be query dependant.
+The SOAPServer provides both document literal and RPC encoded styles.
Notes
-====
+=====
The SOAP Server operates on XQuery Modules stored in the database. These modules must
have a .xqws (XQuery Web Service) extension instead of a .xqm extension to be recognised as webservices.
Installing
-=====
+==========
The SOAP Server uses XSLT to create descriptions for XQWS (XQuery Web Service) functions and also
to return a SOAP Response. This enables the user to customize their descriptions and the SOAP Response
if needed by altering the XSLT files.
@@ -22,12 +24,15 @@
1) Create the collection "webservice" in the /db/system collection
2) Store the .xslt files found in $EXIST_HOME/tools/SOAPServer into the /db/system/webservice collection
-
+
+3) If you are using Saxon instead of Xalan, you will need to make a small change to soap.response.xslt, details are in the file.
+
+
Thats it :-)
Examples
-======
+========
For an example see $EXIST_HOME/tools/SOAPServer/echo.xqws, to use this you will need to store it anywhere in the db,
and call it from the REST e.g. http://localhost:8080/exist/servlet/db/mycollection/echo.xqws
Modified: trunk/eXist/tools/SOAPServer/echo.xqws
===================================================================
--- trunk/eXist/tools/SOAPServer/echo.xqws 2007-05-31 10:24:34 UTC (rev 5959)
+++ trunk/eXist/tools/SOAPServer/echo.xqws 2007-05-31 11:26:17 UTC (rev 5960)
@@ -1,5 +1,12 @@
module namespace echo = "http://exist-db.org/xquery/soap/echo";
+(:
+ Simple XQuery Web Service to test echoing of values to and from the SOAPServer
+
+ @author Adam Retter <ada...@de...>
+ @version 1.0
+:)
+
declare function echo:echo($value as xs:string) as xs:string
{
$value
@@ -7,7 +14,7 @@
declare function echo:echoSequence($values as xs:string*) as xs:string*
{
- $values
+ $values
};
declare function echo:echoWithDate($value as xs:string) as xs:string
@@ -18,4 +25,14 @@
declare function echo:echoConcat($value1 as xs:string, $value2 as xs:string) as xs:string
{
concat($value1, $value2)
+};
+
+declare function echo:getNode() as node()
+{
+ <testNode>testValue</testNode>
+};
+
+declare function echo:echoNode($node as node()) as node()
+{
+ $node
};
\ No newline at end of file
Modified: trunk/eXist/tools/SOAPServer/soap.response.xslt
===================================================================
--- trunk/eXist/tools/SOAPServer/soap.response.xslt 2007-05-31 10:24:34 UTC (rev 5959)
+++ trunk/eXist/tools/SOAPServer/soap.response.xslt 2007-05-31 11:26:17 UTC (rev 5960)
@@ -1,32 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
+<xsl:stylesheet xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" media-type="text/xml" omit-xml-declaration="no"/>
- <xsl:template match="/webservice">
+ <xsl:param name="isDocumentLiteral" as="xs:string">true</xsl:param>
+ <xsl:template match="/">
<SOAP-ENV:Envelope>
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
- <xsl:variable name="functionName" select="/webservice/functions/function[1]/name"/>
- <xsl:variable name="namespaceURL" select="/webservice/URL"/>
- <xsl:variable name="type" select="/webservice/functions/function[1]/return/type"/>
- <xsl:element name="{concat($functionName, 'Response')}" namespace="{$namespaceURL}">
- <xsl:element name="{concat($functionName, 'Result')}" namespace="{$namespaceURL}">
- <xsl:choose>
- <xsl:when test="/webservice/functions/function[1]/return/cardinality <= 4">
- <!-- atomic value -->
- <xsl:copy-of select="/webservice/functions/function[1]/return/result/value/node()"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- sequence of values -->
- <xsl:for-each select="/webservice/functions/function[1]/return/result/sequence/value">
- <xsl:element name="{substring-after($type, ':')}" namespace="{$namespaceURL}">
- <xsl:copy-of select="node()"/>
- </xsl:element>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:element>
+ <xsl:choose>
+ <xsl:when test="$isDocumentLiteral = 'true'">
+ <xsl:apply-templates select="webservice"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="functionName" select="/webservice/functions/function[1]/name"/>
+ <xsl:element name="{$functionName}">
+ <xsl:apply-templates select="webservice"/>
+ </xsl:element>
+ </xsl:otherwise>
+ </xsl:choose>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</xsl:template>
+ <xsl:template match="webservice">
+ <xsl:variable name="functionName" select="functions/function[1]/name"/>
+ <xsl:variable name="namespaceURL" select="URL"/>
+ <xsl:variable name="type" select="functions/function[1]/return/type"/>
+ <xsl:element name="{concat($functionName, 'Response')}" namespace="{$namespaceURL}">
+ <xsl:element name="{concat($functionName, 'Result')}" namespace="{$namespaceURL}">
+ <xsl:choose>
+ <xsl:when test="functions/function[1]/return/cardinality <= 4">
+ <!-- atomic value -->
+ <xsl:copy-of select="functions/function[1]/return/result/value/node()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- sequence of values -->
+ <xsl:for-each select="functions/function[1]/return/result/sequence/value">
+ <xsl:element name="{substring-after($type, ':')}" namespace="{$namespaceURL}">
+ <xsl:copy-of select="node()"/>
+ </xsl:element>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:element>
+ </xsl:element>
+ </xsl:template>
</xsl:stylesheet>
\ No newline at end of file
Modified: trunk/eXist/tools/SOAPServer/wsdl.xslt
===================================================================
--- trunk/eXist/tools/SOAPServer/wsdl.xslt 2007-05-31 10:24:34 UTC (rev 5959)
+++ trunk/eXist/tools/SOAPServer/wsdl.xslt 2007-05-31 11:26:17 UTC (rev 5960)
@@ -13,6 +13,19 @@
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:set="http://exslt.org/sets" version="2.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" media-type="text/xml" omit-xml-declaration="no"/>
+ <xsl:param name="isDocumentLiteral">true</xsl:param>
+ <xsl:variable name="bindingStyle" as="xs:string">
+ <xsl:choose>
+ <xsl:when test="$isDocumentLiteral='true'">document</xsl:when>
+ <xsl:otherwise>rpc</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="bindingEncoding">
+ <xsl:choose>
+ <xsl:when test="$isDocumentLiteral='true'">literal</xsl:when>
+ <xsl:otherwise>encoded</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<xsl:template match="/webservice">
<xsl:variable name="webserviceName" select="name" as="xs:string"/>
<xsl:variable name="webserviceURL" select="URL" as="xs:string"/>
@@ -21,121 +34,137 @@
<xs:schema elementFormDefault="qualified" targetNamespace="{$webserviceURL}">
<!-- creates array types for parameters and returns -->
<xsl:for-each select="set:distinct(functions/function/parameters/parameter[cardinality >= 4]/type | functions/function/return[cardinality >= 4]/type)">
- <xs:complexType name="{concat('arrayOf', translate(., ':', '_'))}">
- <xs:sequence>
- <xs:element minOccurs="0" maxOccurs="unbounded" name="{substring-after(., ':')}" nillable="true" type="{.}"/>
- </xs:sequence>
- </xs:complexType>
+ <xsl:call-template name="dumptype"/>
</xsl:for-each>
<xsl:for-each select="functions/function">
<xsl:variable name="funName" select="name" as="xs:string"/>
- <xs:element name="{$funName}">
- <xsl:if test="parameters/parameter">
- <xs:complexType>
- <xs:sequence>
- <xsl:for-each select="parameters/parameter">
- <xsl:variable name="name">
+ <xsl:if test="$isDocumentLiteral = 'true'">
+ <xs:element name="{$funName}">
+ <xsl:if test="parameters/parameter">
+ <xs:complexType>
+ <xs:sequence>
+ <xsl:for-each select="parameters/parameter">
+ <xsl:variable name="name">
+ <xsl:choose>
+ <xsl:when test="name != ''">
+ <xsl:value-of select="name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('arg', position())"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cardinality" select="cardinality"/>
+ <xsl:variable name="type">
+ <xsl:choose>
+ <xsl:when test="type = 'item'">
+ <xsl:value-of select="'xs:anyType'"/>
+ </xsl:when>
+ <xsl:when test="type = 'element'">
+ <xsl:value-of select="'xs:anyType'"/>
+ </xsl:when>
+ <xsl:when test="type = 'node'">
+ <xsl:value-of select="'xs:anyType'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<xsl:choose>
- <xsl:when test="name != ''">
- <xsl:value-of select="name"/>
+ <xsl:when test="$cardinality < 3">
+ <!-- ZERO, ONE -->
+ <xs:element name="{$name}" type="{$type}"/>
</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat('arg', position())"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="cardinality" select="cardinality"/>
- <xsl:variable name="type">
- <xsl:choose>
- <xsl:when test="type = 'item'">
- <xsl:value-of select="'xs:anyType'"/>
+ <xsl:when test="$cardinality = 3">
+ <!-- ZERO_OR_ONE -->
+ <xs:element name="{$name}" type="{$type}" minOccurs="0" maxOccurs="1"/>
</xsl:when>
- <xsl:when test="type = 'element'">
- <xsl:value-of select="'xs:anyType'"/>
+ <xsl:when test="$cardinality = 4 or $cardinality = 6">
+ <!-- MANY, ONE_OR_MANY -->
+ <xs:element name="{$name}" type="tns:arrayOf{translate($type,':','_')}" minOccurs="1" maxOccurs="1"/>
</xsl:when>
- <xsl:when test="type = 'node'">
- <xsl:value-of select="'xs:anyType'"/>
+ <xsl:when test="$cardinality = 7">
+ <!-- ZERO_OR_MORE -->
+ <xs:element name="{$name}" type="tns:arrayOf{translate($type,':','_')}" minOccurs="0" maxOccurs="1"/>
</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="type"/>
- </xsl:otherwise>
</xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$cardinality < 3">
- <!-- ZERO, ONE -->
- <xs:element name="{$name}" type="{$type}"/>
- </xsl:when>
- <xsl:when test="$cardinality = 3">
- <!-- ZERO_OR_ONE -->
- <xs:element name="{$name}" type="{$type}" minOccurs="0" maxOccurs="1"/>
- </xsl:when>
- <xsl:when test="$cardinality = 4 or $cardinality = 6">
- <!-- MANY, ONE_OR_MANY -->
- <xs:element name="{$name}" type="tns:arrayOf{translate($type,':','_')}" minOccurs="1" maxOccurs="1"/>
- </xsl:when>
- <xsl:when test="$cardinality = 7">
- <!-- ZERO_OR_MORE -->
- <xs:element name="{$name}" type="tns:arrayOf{translate($type,':','_')}" minOccurs="0" maxOccurs="1"/>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xs:sequence>
- </xs:complexType>
- </xsl:if>
- </xs:element>
- <xs:element name="{concat($funName, 'Response')}">
- <xs:complexType>
- <xs:sequence>
- <xsl:variable name="name" select="concat($funName, 'Result')"/>
- <xsl:variable name="cardinality" select="return/cardinality"/>
- <xsl:variable name="type">
- <xsl:choose>
- <xsl:when test="return/type = 'item'">
- <xsl:value-of select="'xs:anyType'"/>
- </xsl:when>
- <xsl:when test="return/type = 'element'">
- <xsl:value-of select="'xs:anyType'"/>
- </xsl:when>
- <xsl:when test="return/type = 'node'">
- <xsl:value-of select="'xs:anyType'"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="return/type"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
+ </xsl:for-each>
+ </xs:sequence>
+ </xs:complexType>
+ </xsl:if>
+ </xs:element>
+ </xsl:if>
+ <xsl:variable name="responseComplexType" select="concat($funName, 'Response')" />
+ <xs:complexType name="{$responseComplexType}Type">
+ <xs:sequence>
+ <xsl:variable name="name" select="concat($funName, 'Result')"/>
+ <xsl:variable name="cardinality" select="return/cardinality"/>
+ <xsl:variable name="type">
<xsl:choose>
- <xsl:when test="$cardinality < 3">
- <!-- ZERO, ONE -->
- <xs:element name="{$name}" type="{$type}"/>
+ <xsl:when test="return/type = 'item'">
+ <xsl:value-of select="'xs:anyType'"/>
</xsl:when>
- <xsl:when test="$cardinality = 3">
- <!-- ZERO_OR_ONE -->
- <xs:element name="{$name}" type="{$type}" minOccurs="0" maxOccurs="1"/>
+ <xsl:when test="return/type = 'element'">
+ <xsl:value-of select="'xs:anyType'"/>
</xsl:when>
- <xsl:when test="$cardinality = 4 or $cardinality = 6">
- <!-- MANY, ONE_OR_MANY -->
- <xs:element name="{$name}" type="tns:arrayOf{translate($type,':','_')}" minOccurs="1" maxOccurs="1"/>
+ <xsl:when test="return/type = 'node'">
+ <xsl:value-of select="'xs:anyType'"/>
</xsl:when>
- <xsl:when test="$cardinality = 7">
- <!-- ZERO_OR_MORE -->
- <xs:element name="{$name}" type="tns:arrayOf{translate($type,':','_')}" minOccurs="0" maxOccurs="1"/>
- </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="return/type"/>
+ </xsl:otherwise>
</xsl:choose>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$cardinality < 3">
+ <!-- ZERO, ONE -->
+ <xs:element name="{$name}" type="{$type}"/>
+ </xsl:when>
+ <xsl:when test="$cardinality = 3">
+ <!-- ZERO_OR_ONE -->
+ <xs:element name="{$name}" type="{$type}" minOccurs="0" maxOccurs="1"/>
+ </xsl:when>
+ <xsl:when test="$cardinality = 4 or $cardinality = 6">
+ <!-- MANY, ONE_OR_MANY -->
+ <xs:element name="{$name}" type="tns:arrayOf{translate($type,':','_')}" minOccurs="1" maxOccurs="1"/>
+ </xsl:when>
+ <xsl:when test="$cardinality = 7">
+ <!-- ZERO_OR_MORE -->
+ <xs:element name="{$name}" type="tns:arrayOf{translate($type,':','_')}" minOccurs="0" maxOccurs="1"/>
+ </xsl:when>
+ </xsl:choose>
+ </xs:sequence>
+ </xs:complexType>
+ <xsl:if test="$isDocumentLiteral = 'true'">
+ <xs:element name="{$responseComplexType}" type="tns:{$responseComplexType}Type" />
+ </xsl:if>
</xsl:for-each>
</xs:schema>
</types>
<xsl:for-each select="functions/function">
<xsl:variable name="funName" select="name" as="xs:string"/>
<message name="{concat($funName, 'SoapRequest')}">
- <part name="parameters" element="{concat('tns:',$funName)}"/>
+ <xsl:choose>
+ <xsl:when test="$isDocumentLiteral = 'true'">
+ <part name="parameters" element="{concat('tns:',$funName)}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="parameters/parameter">
+ <xsl:call-template name="partGenerator"/>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
</message>
<message name="{concat($funName, 'SoapResponse')}">
- <part name="parameters" element="{concat('tns:',$funName,'Response')}"/>
+ <xsl:choose>
+ <xsl:when test="$isDocumentLiteral = 'true'">
+ <part name="parameters" element="{concat('tns:',$funName,'Response')}"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <part name="{concat($funName,'Response')}" type="{concat('tns:',$funName,'ResponseType')}"/>
+ </xsl:otherwise>
+ </xsl:choose>
</message>
</xsl:for-each>
<portType name="{concat($webserviceName, 'SoapType')}">
@@ -151,16 +180,30 @@
</xsl:for-each>
</portType>
<binding name="{concat($webserviceName, 'SoapBinding')}" type="{concat('tns:', $webserviceName, 'SoapType')}">
- <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <soap:binding style="{$bindingStyle}" transport="http://schemas.xmlsoap.org/soap/http"/>
<xsl:for-each select="functions/function">
<xsl:variable name="funName" select="name" as="xs:string"/>
<operation name="{$funName}">
- <soap:operation soapAction="" style="document"/>
+ <soap:operation soapAction="{$webserviceURL}#{$funName}" />
<input>
- <soap:body use="literal"/>
+ <soap:body use="{$bindingEncoding}">
+ <!--
+ <xsl:if test="$isDocumentLiteral != 'true'">
+ <xsl:attribute name="encodingStyle">http://schemas.xmlsoap.org/soap/encoding/</xsl:attribute>
+ <xsl:attribute name="namespace" select="$webserviceURL" />
+ </xsl:if>
+ -->
+ </soap:body>
</input>
<output>
- <soap:body use="literal"/>
+ <soap:body use="{$bindingEncoding}">
+ <!--
+ <xsl:if test="$isDocumentLiteral != 'true'">
+ <xsl:attribute name="encodingStyle">http://schemas.xmlsoap.org/soap/encoding/</xsl:attribute>
+ <xsl:attribute name="namespace" select="$webserviceURL" />
+ </xsl:if>
+ -->
+ </soap:body>
</output>
</operation>
</xsl:for-each>
@@ -175,4 +218,83 @@
</service>
</definitions>
</xsl:template>
+
+ <xsl:template name="dumptype">
+ <xsl:variable name="type">
+ <xsl:choose>
+ <xsl:when test=". = 'item'">
+ <xsl:value-of select="'xs:anyType'"/>
+ </xsl:when>
+ <xsl:when test=". = 'element'">
+ <xsl:value-of select="'xs:anyType'"/>
+ </xsl:when>
+ <xsl:when test=". = 'node'">
+ <xsl:value-of select="'xs:anyType'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="name">
+ <xsl:choose>
+ <xsl:when test="contains($type,':')">
+ <xsl:value-of select="substring-after($type, ':')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xs:complexType name="{concat('arrayOf', translate($type, ':', '_'))}">
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" name="{$name}" nillable="true" type="{$type}"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xsl:template>
+
+ <xsl:template name="partGenerator">
+ <xsl:param name="partname" as="xs:string" />
+ <xsl:variable name="name">
+ <xsl:choose>
+ <xsl:when test="$partname">
+ <xsl:value-of select="$partname"/>
+ </xsl:when>
+ <xsl:when test="name != ''">
+ <xsl:value-of select="name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="concat('arg', position())"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="cardinality" select="cardinality"/>
+ <xsl:variable name="type">
+ <xsl:choose>
+ <xsl:when test="type = 'item'">
+ <xsl:value-of select="'xs:anyType'"/>
+ </xsl:when>
+ <xsl:when test="type = 'element'">
+ <xsl:value-of select="'xs:anyType'"/>
+ </xsl:when>
+ <xsl:when test="type = 'node'">
+ <xsl:value-of select="'xs:anyType'"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$cardinality <= 3">
+ <!-- ZERO, ONE or ZERO_OR_ONE -->
+ <part name="{$name}" type="{$type}"/>
+ </xsl:when>
+ <xsl:when test="$cardinality = 4 or $cardinality = 6 or $cardinality = 7">
+ <!-- MANY, ONE_OR_MANY, ZERO_OR_MORE -->
+ <part name="{$name}" type="tns:arrayOf{translate($type,':','_')}" />
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
</xsl:stylesheet>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-05-31 10:24:35
|
Revision: 5959
http://svn.sourceforge.net/exist/?rev=5959&view=rev
Author: dizzzz
Date: 2007-05-31 03:24:34 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Moved validate-with-specified-dtd check to correct location
Modified Paths:
--------------
trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
Modified: trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2007-05-31 08:07:36 UTC (rev 5958)
+++ trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2007-05-31 10:24:34 UTC (rev 5959)
@@ -113,14 +113,14 @@
};
-
+
public Validation(XQueryContext context, FunctionSignature signature) {
super(context, signature);
brokerPool = context.getBroker().getBrokerPool();
validator = new Validator( brokerPool );
}
- /**
+ /**
* @see BasicFunction#eval(Sequence[], Sequence)
*/
public Sequence eval(Sequence[] args, Sequence contextSequence)
@@ -130,8 +130,8 @@
if(args.length != 1 && args.length != 2){
return Sequence.EMPTY_SEQUENCE;
}
-
+
// Get inputstream
InputStream is=null;
try {
@@ -140,12 +140,6 @@
String url=args[0].getStringValue();
- if(url.endsWith(".dtd")){
- throw new XPathException(getASTNode(),
- "Unable to validate with a specified DTD. "+
- "Please register the DTD in an xml catalog document.");
- }
-
if(url.startsWith("/")){
url="xmldb:exist://"+url;
}
@@ -175,15 +169,26 @@
LOG.error(ex);
//ex.printStackTrace();
throw new XPathException(getASTNode(),"exception",ex);
- }
-
+ }
+
ValidationReport vr = null;
if(args.length==1){
vr = validator.validate(is);
} else {
- vr = validator.validate(is,args[1].getStringValue());
+ String url=args[1].getStringValue();
+ if(url.endsWith(".dtd")){
+ String txt = "Unable to validate with a specified DTD ("+url+"). "+
+ "Please register the DTD in an xml catalog document.";
+ LOG.error(txt);
+ throw new XPathException(getASTNode(), txt);
+ }
+ if(url.startsWith("/")){
+ url="xmldb:exist://"+url;
+ }
+
+ vr = validator.validate(is,url);
}
// Create response
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-31 08:07:38
|
Revision: 5958
http://svn.sourceforge.net/exist/?rev=5958&view=rev
Author: brihaye
Date: 2007-05-31 01:07:36 -0700 (Thu, 31 May 2007)
Log Message:
-----------
Removed my local pryx settings : they should now be in the general build.
Modified Paths:
--------------
trunk/eXist/extensions/indexes/spatial/build.xml
Modified: trunk/eXist/extensions/indexes/spatial/build.xml
===================================================================
--- trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-30 23:20:40 UTC (rev 5957)
+++ trunk/eXist/extensions/indexes/spatial/build.xml 2007-05-31 08:07:36 UTC (rev 5958)
@@ -3,8 +3,6 @@
<import file="../common.xml"/>
<property name="resources.dir" value="./test/resources"/>
-
- <setproxy proxyhost="proxy-bretagne.culture.fr" proxyport="8000"/>
<target name="jar" depends="compile">
<jar destfile="${top.dir}/exist-modules.jar" basedir="${classes}"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-30 23:20:50
|
Revision: 5957
http://svn.sourceforge.net/exist/?rev=5957&view=rev
Author: brihaye
Date: 2007-05-30 16:20:40 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Renamed name constant SteamListener.REMOVE_NODES as REMOVE_SOME_NODES (vs. REMOVE_ALL_NODES)
Fixed some bugs in spatial index stuff, but a nasty one remains...
Modified Paths:
--------------
trunk/eXist/extensions/indexes/ngram/src/org/exist/indexing/ngram/NGramIndexWorker.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java
trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java
trunk/eXist/src/org/exist/dom/ElementImpl.java
trunk/eXist/src/org/exist/indexing/IndexController.java
trunk/eXist/src/org/exist/indexing/IndexWorker.java
trunk/eXist/src/org/exist/indexing/StreamListener.java
Modified: trunk/eXist/extensions/indexes/ngram/src/org/exist/indexing/ngram/NGramIndexWorker.java
===================================================================
--- trunk/eXist/extensions/indexes/ngram/src/org/exist/indexing/ngram/NGramIndexWorker.java 2007-05-30 20:57:50 UTC (rev 5956)
+++ trunk/eXist/extensions/indexes/ngram/src/org/exist/indexing/ngram/NGramIndexWorker.java 2007-05-30 23:20:40 UTC (rev 5957)
@@ -153,7 +153,7 @@
saveIndex();
break;
case StreamListener.REMOVE_ALL_NODES :
- case StreamListener.REMOVE_NODES :
+ case StreamListener.REMOVE_SOME_NODES :
dropIndex(mode);
break;
}
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java 2007-05-30 20:57:50 UTC (rev 5956)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java 2007-05-30 23:20:40 UTC (rev 5957)
@@ -209,11 +209,15 @@
StoredNode topMost = node;
StoredNode currentNode = node;
for (int i = path.length() ; i > 0; i--) {
- currentNode = (StoredNode)node.getParentNode();
- if (GML_NS.equals(path.getComponent(i - 1).getNamespaceURI()))
+ currentNode = (StoredNode)currentNode.getParentNode();
+ if (GML_NS.equals(currentNode.getNamespaceURI()))
+ //TODO : retain only geometries
topMost = currentNode;
}
- return topMost;
+ //PROVISIONAL
+ if (!srsNamesStack.isEmpty())
+ srsNamesStack.clear();
+ return topMost;
}
public void flush() {
@@ -230,7 +234,7 @@
case StreamListener.STORE :
saveDocumentNodes(conn);
break;
- case StreamListener.REMOVE_NODES :
+ case StreamListener.REMOVE_SOME_NODES :
dropDocumentNode(conn);
break;
case StreamListener.REMOVE_ALL_NODES:
@@ -474,10 +478,10 @@
try {
for (Iterator iterator = geometries.entrySet().iterator(); iterator.hasNext();) {
Map.Entry entry = (Map.Entry) iterator.next();
- currentNodeId = (NodeId)entry.getKey();
+ NodeId nodeId = (NodeId)entry.getKey();
SRSGeometry srsGeometry = (SRSGeometry)entry.getValue();
saveGeometryNode(srsGeometry.getGeometry(), srsGeometry.getSRSName(),
- currentDoc, currentNodeId, conn);
+ currentDoc, nodeId, conn);
srsGeometry = null;
}
} finally {
@@ -490,11 +494,11 @@
return;
try {
boolean removed = removeDocumentNode(currentDoc, currentNodeId, conn);
- if (LOG.isDebugEnabled()) {
- if (removed)
+ if (!removed)
+ LOG.error("No data dropped for node " + currentNodeId.toString() + " from GML index");
+ else {
+ if (LOG.isDebugEnabled())
LOG.debug("Dropped data for node " + currentNodeId.toString() + " from GML index");
- else
- LOG.debug("No data dropped for node " + currentNodeId.toString() + " from GML index");
}
} finally {
currentNodeId = null;
@@ -575,6 +579,7 @@
try {
handler.startElement(deferredElement.getNamespaceURI(), deferredElement.getLocalName(), deferredElement.getQName().getStringValue(), attList);
} catch (Exception e) {
+ e.printStackTrace();
LOG.error(e);
}
}
@@ -597,7 +602,9 @@
handler.startElement(deferredElement.getNamespaceURI(), deferredElement.getLocalName(), deferredElement.getQName().getStringValue(), attList);
} catch (Exception e) {
e.printStackTrace();
+ LOG.error(e);
}
+ deferredElement = null;
}
try {
handler.endElement(element.getNamespaceURI(), element.getLocalName(), element.getQName().getStringValue());
@@ -623,8 +630,7 @@
} catch (Exception e) {
LOG.error("Unable to collect geometry for node: " + currentNodeId + ". Indexing will be skipped", e);
} finally {
- streamedGeometry = null;
- deferredElement = null;
+ streamedGeometry = null;
}
}
//Forward the event to the next listener
@@ -633,14 +639,15 @@
public void characters(Txn transaction, TextImpl text, NodePath path) {
if (isDocumentGMLAware) {
- if (deferredElement != null && mode == StreamListener.STORE) {
+ if (deferredElement != null /* && mode == StreamListener.STORE*/) {
AttributesImpl attList = collectAttributes(deferredElement);
try {
handler.startElement(deferredElement.getNamespaceURI(), deferredElement.getLocalName(), deferredElement.getQName().getStringValue(), attList);
} catch (Exception e) {
- LOG.error(e);
+ e.printStackTrace();
+ LOG.error(e);
}
- deferredElement = null;
+ deferredElement = null;
}
try {
handler.characters(text.getData().toCharArray(), 0, text.getLength());
@@ -663,7 +670,7 @@
AttrImpl attrib = (AttrImpl)attrs.item(i);
//Store the srs if relevant
- if (GML_NS.equals(element.getNamespaceURI())) {
+ if (GML_NS.equals(element.getNamespaceURI()) && attrib.getName().equals("srsName")) {
whatToPush = attrib.getValue();
}
@@ -699,6 +706,10 @@
private Geometry geometry;
public SRSGeometry(String SRSName, Geometry geometry) {
+ if (SRSName == null)
+ throw new IllegalArgumentException("null SRS");
+ if (geometry == null)
+ throw new IllegalArgumentException("null geometry");
this.SRSName = SRSName;
this.geometry = geometry;
}
Modified: trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java 2007-05-30 20:57:50 UTC (rev 5956)
+++ trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java 2007-05-30 23:20:40 UTC (rev 5957)
@@ -82,12 +82,6 @@
" </index>" +
"</collection>";
- private static String XUPDATE_START =
- "<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">";
-
- private static String XUPDATE_END =
- "</xu:modifications>";
-
String IN_MEMORY_GML = "<gml:Polygon xmlns:gml = 'http://www.opengis.net/gml' srsName='osgb:BNG'>" +
" <gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>" +
"278515.400,187060.450 278515.150,187057.950 278516.350,187057.150 " +
@@ -937,6 +931,49 @@
}
}
+ public void testUpdate() {
+ BrokerPool pool = null;
+ DBBroker broker = null;
+ try {
+ pool = BrokerPool.getInstance();
+ assertNotNull(pool);
+ broker = pool.get(org.exist.security.SecurityManager.SYSTEM_USER);
+ XQuery xquery = broker.getXQueryService();
+ assertNotNull(xquery);
+ String query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getArea(//gml:Polygon[1])";
+ Sequence seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() == 1);
+ String area1 = seq.toString();
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "update value //gml:Polygon[1]/gml:outerBoundaryIs/gml:LinearRing/gml:coordinates " +
+ "(: strip decimals :) " +
+ "with fn:replace(//gml:Polygon[1], '(\\d+).(\\d+)', '$1')";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() == 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getArea(//gml:Polygon[1])";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() == 1);
+ String area2 = seq.toString();
+ assertFalse(area1.equals(area2));
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ pool.release(broker);
+ }
+ }
+
protected void setUp() {
try {
// initialize driver
Modified: trunk/eXist/src/org/exist/dom/ElementImpl.java
===================================================================
--- trunk/eXist/src/org/exist/dom/ElementImpl.java 2007-05-30 20:57:50 UTC (rev 5956)
+++ trunk/eXist/src/org/exist/dom/ElementImpl.java 2007-05-30 23:20:40 UTC (rev 5957)
@@ -1117,11 +1117,11 @@
//May help getReindexRoot() to make some useful things
getBroker().getIndexController().setDocument(ownerDocument);
StoredNode reindexRoot = getBroker().getIndexController().getReindexRoot(this, path, true);
- getBroker().getIndexController().setMode(StreamListener.REMOVE_NODES);
+ getBroker().getIndexController().setMode(StreamListener.REMOVE_SOME_NODES);
if (reindexRoot == null) {
listener = getBroker().getIndexController().getStreamListener();
} else {
- getBroker().getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_NODES);
+ getBroker().getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_SOME_NODES);
}
StoredNode last = this;
@@ -1193,7 +1193,7 @@
// Remove indexes
if (reindexRoot == null)
reindexRoot = oldNode;
- getBroker().getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_NODES);
+ getBroker().getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_SOME_NODES);
// Remove the actual node data
getBroker().removeNode(transaction, oldNode, oldPath, null);
@@ -1228,11 +1228,11 @@
//May help getReindexRoot() to make some useful things
getBroker().getIndexController().setDocument(ownerDocument);
StoredNode reindexRoot = getBroker().getIndexController().getReindexRoot(oldNode, oldPath);
- getBroker().getIndexController().setMode(StreamListener.REMOVE_NODES);
+ getBroker().getIndexController().setMode(StreamListener.REMOVE_SOME_NODES);
if (reindexRoot == null) {
listener = getBroker().getIndexController().getStreamListener();
} else {
- getBroker().getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_NODES);
+ getBroker().getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_SOME_NODES);
}
getBroker().removeAllNodes(transaction, oldNode, oldPath, listener);
--children;
@@ -1260,7 +1260,7 @@
" is not a child of element " + nodeId);
final NodePath oldPath = old.getPath();
// remove old custom indexes
- getBroker().getIndexController().reindex(transaction, old, StreamListener.REMOVE_NODES);
+ getBroker().getIndexController().reindex(transaction, old, StreamListener.REMOVE_SOME_NODES);
getBroker().removeNode(transaction, old, oldPath, null);
children--;
attributes--;
@@ -1341,11 +1341,11 @@
//May help getReindexRoot() to make some useful things
getBroker().getIndexController().setDocument(ownerDocument);
StoredNode reindexRoot = getBroker().getIndexController().getReindexRoot(oldNode, oldPath);
- getBroker().getIndexController().setMode(StreamListener.REMOVE_NODES);
+ getBroker().getIndexController().setMode(StreamListener.REMOVE_SOME_NODES);
if (reindexRoot == null) {
listener = getBroker().getIndexController().getStreamListener();
} else {
- getBroker().getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_NODES);
+ getBroker().getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_SOME_NODES);
}
getBroker().removeAllNodes(transaction, oldNode, oldPath, listener);
Modified: trunk/eXist/src/org/exist/indexing/IndexController.java
===================================================================
--- trunk/eXist/src/org/exist/indexing/IndexController.java 2007-05-30 20:57:50 UTC (rev 5956)
+++ trunk/eXist/src/org/exist/indexing/IndexController.java 2007-05-30 23:20:40 UTC (rev 5957)
@@ -223,7 +223,7 @@
/**
* Reindex all nodes below the specified root node, using the given mode. Mode should be
* one of {@link StreamListener#UNKNOWN}, {@link StreamListener#STORE},
- * {@link StreamListener#REMOVE_NODES} or {@link StreamListener#REMOVE_ALL_NODES}.
+ * {@link StreamListener#REMOVE_SOME_NODES} or {@link StreamListener#REMOVE_ALL_NODES}.
*
* @param transaction the current transaction
* @param reindexRoot the root node to reindex
Modified: trunk/eXist/src/org/exist/indexing/IndexWorker.java
===================================================================
--- trunk/eXist/src/org/exist/indexing/IndexWorker.java 2007-05-30 20:57:50 UTC (rev 5956)
+++ trunk/eXist/src/org/exist/indexing/IndexWorker.java 2007-05-30 23:20:40 UTC (rev 5957)
@@ -93,7 +93,7 @@
/**
* Notify this worker to operate using the mode
* given. Mode will be one of {@link StreamListener#UNKNOWN}, {@link StreamListener#STORE},
- * {@link StreamListener#REMOVE_NODES} or {@link StreamListener#REMOVE_ALL_NODES}.
+ * {@link StreamListener#REMOVE_SOME_NODES} or {@link StreamListener#REMOVE_ALL_NODES}.
*
* @param mode the current operation mode
*/
@@ -102,7 +102,7 @@
/**
* Notify this worker to operate on the specified document, using the mode
* given. Mode will be one of {@link StreamListener#UNKNOWN}, {@link StreamListener#STORE},
- * {@link StreamListener#REMOVE_NODES} or {@link StreamListener#REMOVE_ALL_NODES}.
+ * {@link StreamListener#REMOVE_SOME_NODES} or {@link StreamListener#REMOVE_ALL_NODES}.
*
* @param doc the document which is processed
* @param mode the current operation mode
Modified: trunk/eXist/src/org/exist/indexing/StreamListener.java
===================================================================
--- trunk/eXist/src/org/exist/indexing/StreamListener.java 2007-05-30 20:57:50 UTC (rev 5956)
+++ trunk/eXist/src/org/exist/indexing/StreamListener.java 2007-05-30 23:20:40 UTC (rev 5957)
@@ -45,7 +45,7 @@
/**
* Mode for removing some nodes of a document
*/
- public final static int REMOVE_NODES = 2;
+ public final static int REMOVE_SOME_NODES = 2;
/**
* Set the next stream listener in the chain. Events should always be forwarded
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-05-30 20:57:58
|
Revision: 5956
http://svn.sourceforge.net/exist/?rev=5956&view=rev
Author: dizzzz
Date: 2007-05-30 13:57:50 -0700 (Wed, 30 May 2007)
Log Message:
-----------
First step refactoring. To be continued.......
Modified Paths:
--------------
trunk/eXist/src/org/exist/validation/internal/node/NodeInputStream.java
trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
Added Paths:
-----------
trunk/eXist/src/org/exist/validation/internal/node/NodeSerializer.java
trunk/eXist/src/org/exist/validation/internal/node/NodeSerializerThread.java
Removed Paths:
-------------
trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java
trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java
Deleted: trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java
===================================================================
--- trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java 2007-05-30 20:40:15 UTC (rev 5955)
+++ trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java 2007-05-30 20:57:50 UTC (rev 5956)
@@ -1,98 +0,0 @@
-/*
- * eXist Open Source Native XML Database
- * Copyright (C) 2001-07 The eXist Project
- * http://exist-db.org
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * $Id$
- */
-package org.exist.validation.internal.node;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.Properties;
-
-import javax.xml.transform.OutputKeys;
-
-import org.exist.storage.io.ExistIOException;
-import org.exist.storage.serializers.Serializer;
-import org.exist.util.serializer.SAXSerializer;
-import org.exist.util.serializer.SerializerPool;
-import org.exist.xquery.XQueryContext;
-import org.exist.xquery.value.NodeValue;
-import org.exist.xquery.value.SequenceIterator;
-
-/**
- * @author Dannes Wessels (di...@ex...)
- */
-public class NodeDownload {
-
- private XQueryContext context;
-
- /** Creates a new instance of NodeDownload */
- public NodeDownload(XQueryContext context) {
- this.context=context;
- }
-
-// public Properties parseSerializationOptions(SequenceIterator siSerializeParams) throws XPathException
-// {
-// //parse serialization options
-// Properties outputProperties = new Properties();
-// outputProperties.setProperty(OutputKeys.INDENT, "yes");
-// outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
-// while(siSerializeParams.hasNext())
-// {
-// String opt[] = Option.parseKeyValuePair(siSerializeParams.nextItem().getStringValue());
-// outputProperties.setProperty(opt[0], opt[1]);
-// }
-//
-// return outputProperties;
-// }
-
- public void serialize(SequenceIterator siNode, Properties outputProperties, OutputStream os) throws IOException {
- // serialize the node set
- SAXSerializer sax = (SAXSerializer) SerializerPool.getInstance().borrowObject(SAXSerializer.class);
- try {
- String encoding = outputProperties.getProperty(OutputKeys.ENCODING, "UTF-8");
- Writer writer = new OutputStreamWriter(os, encoding);
- sax.setOutput(writer, outputProperties);
- Serializer serializer = context.getBroker().getSerializer();
- serializer.reset();
- serializer.setProperties(outputProperties);
- serializer.setReceiver(sax);
-
- sax.startDocument();
-
- while(siNode.hasNext()) {
- NodeValue next = (NodeValue)siNode.nextItem();
- serializer.toSAX(next);
- }
-
- sax.endDocument();
- writer.close();
-
- } catch(Exception e) {
- throw new ExistIOException("A problem ocurred while serializing the node set: " + e.getMessage(), e);
-
- } finally {
- SerializerPool.getInstance().returnObject(sax);
- }
- }
-
-
-}
Deleted: trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java
===================================================================
--- trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java 2007-05-30 20:40:15 UTC (rev 5955)
+++ trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java 2007-05-30 20:57:50 UTC (rev 5956)
@@ -1,84 +0,0 @@
-/*
- * eXist Open Source Native XML Database
- * Copyright (C) 2001-07 The eXist Project
- * http://exist-db.org
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * $Id$
- */
-
-package org.exist.validation.internal.node;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import javax.xml.transform.OutputKeys;
-
-import org.apache.log4j.Logger;
-
-import org.exist.storage.io.BlockingOutputStream;
-import org.exist.xquery.XQueryContext;
-import org.exist.xquery.value.SequenceIterator;
-
-/**
- * @author Dannes Wessels (di...@ex...)
- */
-public class NodeDownloadThread extends Thread{
-
- private final static Logger logger = Logger.getLogger(NodeDownloadThread.class);
-
- private XQueryContext context;
- private SequenceIterator siNode;
- private BlockingOutputStream bos;
-
- /** Creates a new instance of NodeDownloadThread */
- public NodeDownloadThread(XQueryContext context, SequenceIterator siNode, BlockingOutputStream bos) {
- this.context=context;
- this.siNode=siNode;
- this.bos=bos;
- }
-
- /**
- * Write resource to the output stream.
- */
- public void run() {
- logger.debug("Thread started." );
- IOException exception=null;
- try {
- //parse serialization options
- Properties outputProperties = new Properties();
- outputProperties.setProperty(OutputKeys.INDENT, "no");
- outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
-
- NodeDownload ed = new NodeDownload(context);
- ed.serialize(siNode, outputProperties, bos);
-
- } catch (IOException ex) {
- logger.error(ex);
- exception = ex;
-
- } finally {
- try { // NEEDED!
- bos.close(exception);
- } catch (IOException ex) {
- logger.debug(ex);
- }
- logger.debug("Thread stopped." );
- }
- }
-
-
-}
Modified: trunk/eXist/src/org/exist/validation/internal/node/NodeInputStream.java
===================================================================
--- trunk/eXist/src/org/exist/validation/internal/node/NodeInputStream.java 2007-05-30 20:40:15 UTC (rev 5955)
+++ trunk/eXist/src/org/exist/validation/internal/node/NodeInputStream.java 2007-05-30 20:57:50 UTC (rev 5956)
@@ -41,7 +41,7 @@
private BlockingInputStream bis;
private BlockingOutputStream bos;
- private NodeDownloadThread rt;
+ private NodeSerializerThread rt;
/** Creates a new instance of NodeInputStream */
@@ -51,7 +51,7 @@
bis = new BlockingInputStream();
bos = bis.getOutputStream();
- rt = new NodeDownloadThread(context, siNode , bos);
+ rt = new NodeSerializerThread(context, siNode , bos);
rt.start();
Copied: trunk/eXist/src/org/exist/validation/internal/node/NodeSerializer.java (from rev 5955, trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java)
===================================================================
--- trunk/eXist/src/org/exist/validation/internal/node/NodeSerializer.java (rev 0)
+++ trunk/eXist/src/org/exist/validation/internal/node/NodeSerializer.java 2007-05-30 20:57:50 UTC (rev 5956)
@@ -0,0 +1,100 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-07 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ */
+package org.exist.validation.internal.node;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Properties;
+
+import javax.xml.transform.OutputKeys;
+
+import org.exist.storage.io.ExistIOException;
+import org.exist.storage.serializers.Serializer;
+import org.exist.util.serializer.SAXSerializer;
+import org.exist.util.serializer.SerializerPool;
+import org.exist.xquery.XQueryContext;
+import org.exist.xquery.value.NodeValue;
+import org.exist.xquery.value.SequenceIterator;
+
+/**
+ * @author Dannes Wessels (di...@ex...)
+ */
+public class NodeSerializer {
+
+ private XQueryContext context;
+
+ /**
+ * Creates a new instance of NodeSerializer
+ */
+ public NodeSerializer(XQueryContext context) {
+ this.context=context;
+ }
+
+// public Properties parseSerializationOptions(SequenceIterator siSerializeParams) throws XPathException
+// {
+// //parse serialization options
+// Properties outputProperties = new Properties();
+// outputProperties.setProperty(OutputKeys.INDENT, "yes");
+// outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+// while(siSerializeParams.hasNext())
+// {
+// String opt[] = Option.parseKeyValuePair(siSerializeParams.nextItem().getStringValue());
+// outputProperties.setProperty(opt[0], opt[1]);
+// }
+//
+// return outputProperties;
+// }
+
+ public void serialize(SequenceIterator siNode, Properties outputProperties, OutputStream os) throws IOException {
+ // serialize the node set
+ SAXSerializer sax = (SAXSerializer) SerializerPool.getInstance().borrowObject(SAXSerializer.class);
+ try {
+ String encoding = outputProperties.getProperty(OutputKeys.ENCODING, "UTF-8");
+ Writer writer = new OutputStreamWriter(os, encoding);
+ sax.setOutput(writer, outputProperties);
+ Serializer serializer = context.getBroker().getSerializer();
+ serializer.reset();
+ serializer.setProperties(outputProperties);
+ serializer.setReceiver(sax);
+
+ sax.startDocument();
+
+ while(siNode.hasNext()) {
+ NodeValue next = (NodeValue)siNode.nextItem();
+ serializer.toSAX(next);
+ }
+
+ sax.endDocument();
+ writer.close();
+
+ } catch(Exception e) {
+ throw new ExistIOException("A problem ocurred while serializing the node set: " + e.getMessage(), e);
+
+ } finally {
+ SerializerPool.getInstance().returnObject(sax);
+ }
+ }
+
+
+}
Copied: trunk/eXist/src/org/exist/validation/internal/node/NodeSerializerThread.java (from rev 5955, trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java)
===================================================================
--- trunk/eXist/src/org/exist/validation/internal/node/NodeSerializerThread.java (rev 0)
+++ trunk/eXist/src/org/exist/validation/internal/node/NodeSerializerThread.java 2007-05-30 20:57:50 UTC (rev 5956)
@@ -0,0 +1,86 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-07 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ */
+
+package org.exist.validation.internal.node;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.xml.transform.OutputKeys;
+
+import org.apache.log4j.Logger;
+
+import org.exist.storage.io.BlockingOutputStream;
+import org.exist.xquery.XQueryContext;
+import org.exist.xquery.value.SequenceIterator;
+
+/**
+ * @author Dannes Wessels (di...@ex...)
+ */
+public class NodeSerializerThread extends Thread{
+
+ private final static Logger logger = Logger.getLogger(NodeSerializerThread.class);
+
+ private XQueryContext context;
+ private SequenceIterator siNode;
+ private BlockingOutputStream bos;
+
+ /**
+ * Creates a new instance of NodeSerializerThread
+ */
+ public NodeSerializerThread(XQueryContext context, SequenceIterator siNode, BlockingOutputStream bos) {
+ this.context=context;
+ this.siNode=siNode;
+ this.bos=bos;
+ }
+
+ /**
+ * Write resource to the output stream.
+ */
+ public void run() {
+ logger.debug("Thread started." );
+ IOException exception=null;
+ try {
+ //parse serialization options
+ Properties outputProperties = new Properties();
+ outputProperties.setProperty(OutputKeys.INDENT, "no");
+ outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+
+ NodeSerializer ed = new NodeSerializer(context);
+ ed.serialize(siNode, outputProperties, bos);
+
+ } catch (IOException ex) {
+ logger.error(ex);
+ exception = ex;
+
+ } finally {
+ try { // NEEDED!
+ bos.close(exception);
+ } catch (IOException ex) {
+ logger.debug(ex);
+ }
+ logger.debug("Thread stopped." );
+ }
+ }
+
+
+}
Modified: trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2007-05-30 20:40:15 UTC (rev 5955)
+++ trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2007-05-30 20:57:50 UTC (rev 5956)
@@ -130,14 +130,22 @@
if(args.length != 1 && args.length != 2){
return Sequence.EMPTY_SEQUENCE;
}
+
// Get inputstream
InputStream is=null;
try {
if(args[0].getItemType()==Type.ANY_URI || args[0].getItemType()==Type.STRING){
// anyURI provided
- LOG.info("URI");
+
String url=args[0].getStringValue();
+
+ if(url.endsWith(".dtd")){
+ throw new XPathException(getASTNode(),
+ "Unable to validate with a specified DTD. "+
+ "Please register the DTD in an xml catalog document.");
+ }
+
if(url.startsWith("/")){
url="xmldb:exist://"+url;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <di...@us...> - 2007-05-30 20:41:08
|
Revision: 5955
http://svn.sourceforge.net/exist/?rev=5955&view=rev
Author: dizzzz
Date: 2007-05-30 13:40:15 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Updated validation features.
Extended validate() functions, now it is possible to validate constructed nodes (elements) and the node returned by fn:doc()
Added jUnit tests. Need to be refactored a bit (better error handling, node serialization can be improved)
Modified Paths:
--------------
trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
Added Paths:
-----------
trunk/eXist/src/org/exist/validation/internal/node/
trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java
trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java
trunk/eXist/src/org/exist/validation/internal/node/NodeInputStream.java
trunk/eXist/test/src/org/exist/validation/ValidationFunctions_Node_Test.java
Added: trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java
===================================================================
--- trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java (rev 0)
+++ trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java 2007-05-30 20:40:15 UTC (rev 5955)
@@ -0,0 +1,98 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-07 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ */
+package org.exist.validation.internal.node;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Properties;
+
+import javax.xml.transform.OutputKeys;
+
+import org.exist.storage.io.ExistIOException;
+import org.exist.storage.serializers.Serializer;
+import org.exist.util.serializer.SAXSerializer;
+import org.exist.util.serializer.SerializerPool;
+import org.exist.xquery.XQueryContext;
+import org.exist.xquery.value.NodeValue;
+import org.exist.xquery.value.SequenceIterator;
+
+/**
+ * @author Dannes Wessels (di...@ex...)
+ */
+public class NodeDownload {
+
+ private XQueryContext context;
+
+ /** Creates a new instance of NodeDownload */
+ public NodeDownload(XQueryContext context) {
+ this.context=context;
+ }
+
+// public Properties parseSerializationOptions(SequenceIterator siSerializeParams) throws XPathException
+// {
+// //parse serialization options
+// Properties outputProperties = new Properties();
+// outputProperties.setProperty(OutputKeys.INDENT, "yes");
+// outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+// while(siSerializeParams.hasNext())
+// {
+// String opt[] = Option.parseKeyValuePair(siSerializeParams.nextItem().getStringValue());
+// outputProperties.setProperty(opt[0], opt[1]);
+// }
+//
+// return outputProperties;
+// }
+
+ public void serialize(SequenceIterator siNode, Properties outputProperties, OutputStream os) throws IOException {
+ // serialize the node set
+ SAXSerializer sax = (SAXSerializer) SerializerPool.getInstance().borrowObject(SAXSerializer.class);
+ try {
+ String encoding = outputProperties.getProperty(OutputKeys.ENCODING, "UTF-8");
+ Writer writer = new OutputStreamWriter(os, encoding);
+ sax.setOutput(writer, outputProperties);
+ Serializer serializer = context.getBroker().getSerializer();
+ serializer.reset();
+ serializer.setProperties(outputProperties);
+ serializer.setReceiver(sax);
+
+ sax.startDocument();
+
+ while(siNode.hasNext()) {
+ NodeValue next = (NodeValue)siNode.nextItem();
+ serializer.toSAX(next);
+ }
+
+ sax.endDocument();
+ writer.close();
+
+ } catch(Exception e) {
+ throw new ExistIOException("A problem ocurred while serializing the node set: " + e.getMessage(), e);
+
+ } finally {
+ SerializerPool.getInstance().returnObject(sax);
+ }
+ }
+
+
+}
Property changes on: trunk/eXist/src/org/exist/validation/internal/node/NodeDownload.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java
===================================================================
--- trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java (rev 0)
+++ trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java 2007-05-30 20:40:15 UTC (rev 5955)
@@ -0,0 +1,84 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-07 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ */
+
+package org.exist.validation.internal.node;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.xml.transform.OutputKeys;
+
+import org.apache.log4j.Logger;
+
+import org.exist.storage.io.BlockingOutputStream;
+import org.exist.xquery.XQueryContext;
+import org.exist.xquery.value.SequenceIterator;
+
+/**
+ * @author Dannes Wessels (di...@ex...)
+ */
+public class NodeDownloadThread extends Thread{
+
+ private final static Logger logger = Logger.getLogger(NodeDownloadThread.class);
+
+ private XQueryContext context;
+ private SequenceIterator siNode;
+ private BlockingOutputStream bos;
+
+ /** Creates a new instance of NodeDownloadThread */
+ public NodeDownloadThread(XQueryContext context, SequenceIterator siNode, BlockingOutputStream bos) {
+ this.context=context;
+ this.siNode=siNode;
+ this.bos=bos;
+ }
+
+ /**
+ * Write resource to the output stream.
+ */
+ public void run() {
+ logger.debug("Thread started." );
+ IOException exception=null;
+ try {
+ //parse serialization options
+ Properties outputProperties = new Properties();
+ outputProperties.setProperty(OutputKeys.INDENT, "no");
+ outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+
+ NodeDownload ed = new NodeDownload(context);
+ ed.serialize(siNode, outputProperties, bos);
+
+ } catch (IOException ex) {
+ logger.error(ex);
+ exception = ex;
+
+ } finally {
+ try { // NEEDED!
+ bos.close(exception);
+ } catch (IOException ex) {
+ logger.debug(ex);
+ }
+ logger.debug("Thread stopped." );
+ }
+ }
+
+
+}
Property changes on: trunk/eXist/src/org/exist/validation/internal/node/NodeDownloadThread.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: trunk/eXist/src/org/exist/validation/internal/node/NodeInputStream.java
===================================================================
--- trunk/eXist/src/org/exist/validation/internal/node/NodeInputStream.java (rev 0)
+++ trunk/eXist/src/org/exist/validation/internal/node/NodeInputStream.java 2007-05-30 20:40:15 UTC (rev 5955)
@@ -0,0 +1,89 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-07 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id$
+ */
+
+package org.exist.validation.internal.node;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.log4j.Logger;
+
+import org.exist.storage.io.BlockingInputStream;
+import org.exist.storage.io.BlockingOutputStream;
+import org.exist.xquery.XQueryContext;
+import org.exist.xquery.value.SequenceIterator;
+
+/**
+ * @author Dannes Wessels (di...@ex...)
+ */
+public class NodeInputStream extends InputStream{
+
+ private final static Logger logger = Logger.getLogger(NodeInputStream.class);
+
+ private BlockingInputStream bis;
+ private BlockingOutputStream bos;
+ private NodeDownloadThread rt;
+
+
+ /** Creates a new instance of NodeInputStream */
+ public NodeInputStream(XQueryContext context, SequenceIterator siNode) {
+ logger.debug("Initializing NodeInputStream");
+
+ bis = new BlockingInputStream();
+ bos = bis.getOutputStream();
+
+ rt = new NodeDownloadThread(context, siNode , bos);
+
+ rt.start();
+
+ logger.debug("Initializing NodeInputStream done");
+ }
+
+ public int read(byte[] b, int off, int len) throws IOException {
+ return bis.read(b, off, len);
+ }
+
+ public int read(byte[] b) throws IOException {
+ return bis.read(b, 0, b.length);
+ }
+
+ public long skip(long n) throws IOException {
+ return bis.skip(n);
+ }
+
+ public void reset() throws IOException {
+ bis.reset();
+ }
+
+ public int read() throws IOException {
+ return bis.read();
+ }
+
+ public void close() throws IOException {
+ bis.close();
+ }
+
+ public int available() throws IOException {
+ return bis.available();
+ }
+
+}
Property changes on: trunk/eXist/src/org/exist/validation/internal/node/NodeInputStream.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java
===================================================================
--- trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2007-05-30 20:30:29 UTC (rev 5954)
+++ trunk/eXist/src/org/exist/xquery/functions/validation/Validation.java 2007-05-30 20:40:15 UTC (rev 5955)
@@ -22,18 +22,16 @@
package org.exist.xquery.functions.validation;
-import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
-import java.net.URISyntaxException;
import java.net.URL;
import org.exist.dom.QName;
import org.exist.storage.BrokerPool;
+import org.exist.storage.io.ExistIOException;
import org.exist.validation.ValidationReport;
import org.exist.validation.Validator;
-
-import org.exist.xmldb.XmldbURI;
+import org.exist.validation.internal.node.NodeInputStream;
import org.exist.xquery.BasicFunction;
import org.exist.xquery.Cardinality;
import org.exist.xquery.FunctionSignature;
@@ -55,11 +53,13 @@
public class Validation extends BasicFunction {
private static final String simpleFunctionTxt=
- "Validate document specified by $a. The grammar files "+
- "are resolved using the global catalog file(s).";
+ "Validate document specified by $a. " +
+ "$a is of type xs:anyURI, or a node (element or returned by fn:doc()). "+
+ "The grammar files are resolved using the global catalog file(s).";
private static final String extendedFunctionTxt=
"Validate document specified by $a using $b. "+
+ "$a is of type xs:anyURI, or a node (element or returned by fn:doc()). "+
"$b can point to an OASIS catalog file, a grammar (xml schema only) "+
"or a collection (path ends with '/')";
@@ -73,66 +73,44 @@
ValidationModule.PREFIX),
simpleFunctionTxt,
new SequenceType[]{
- new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.ITEM, Cardinality.EXACTLY_ONE)
},
new SequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE)
),
-// new FunctionSignature(
-// new QName("validate", ValidationModule.NAMESPACE_URI,
-// ValidationModule.PREFIX),
-// "Validate document specified by $a. The grammar files "
-// +"are searched inside the database.",
-// new SequenceType[]{
-// new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE)
-// },
-// new SequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE)
-// ),
new FunctionSignature(
new QName("validate", ValidationModule.NAMESPACE_URI,
ValidationModule.PREFIX),
extendedFunctionTxt,
new SequenceType[]{
- new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE),
+ new SequenceType(Type.ITEM, Cardinality.EXACTLY_ONE),
new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
},
new SequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE)
),
-// new FunctionSignature(
-// new QName("validate", ValidationModule.NAMESPACE_URI,
-// ValidationModule.PREFIX),
-// "Validate document specified by $a using path $b. "
-// +"$b can point a grammar, a collection containing "
-// +"grammars (usefull for XSD) or a OASIS catalog file.",
-// new SequenceType[]{
-// new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE),
-// new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
-// },
-// new SequenceType(Type.BOOLEAN, Cardinality.EXACTLY_ONE)
-// ),
-
new FunctionSignature(
new QName("validate-report", ValidationModule.NAMESPACE_URI,
ValidationModule.PREFIX),
- simpleFunctionTxt,
+ simpleFunctionTxt+" A simple report is returned.",
new SequenceType[]{
- new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.ITEM, Cardinality.EXACTLY_ONE)
},
new SequenceType(Type.STRING, Cardinality.ZERO_OR_MORE)
),
-
+
new FunctionSignature(
new QName("validate-report", ValidationModule.NAMESPACE_URI,
ValidationModule.PREFIX),
- extendedFunctionTxt,
+ extendedFunctionTxt+" A simple report is returned.",
new SequenceType[]{
- new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE),
+ new SequenceType(Type.ITEM, Cardinality.EXACTLY_ONE),
new SequenceType(Type.ANY_URI, Cardinality.EXACTLY_ONE)
},
new SequenceType(Type.STRING, Cardinality.ZERO_OR_MORE)
)
+
};
@@ -154,22 +132,41 @@
}
// Get inputstream
- InputStream is;
+ InputStream is=null;
try {
- String url=args[0].getStringValue();
- if(url.startsWith("/")){
- url="xmldb:exist://"+url;
+ if(args[0].getItemType()==Type.ANY_URI || args[0].getItemType()==Type.STRING){
+ // anyURI provided
+ LOG.info("URI");
+ String url=args[0].getStringValue();
+ if(url.startsWith("/")){
+ url="xmldb:exist://"+url;
+ }
+ is = new URL(url).openStream();
+
+ } else if (args[0].getItemType()==Type.ELEMENT || args[0].getItemType()==Type.DOCUMENT){
+ // Node provided
+ LOG.info("Node");
+ is= new NodeInputStream(context, args[0].iterate()); // new NodeInputStream()
+
+ } else {
+ LOG.error("Wrong item type "+ Type.getTypeName(args[0].getItemType()));
+ throw new XPathException(getASTNode(),"wrong item type "+ Type.getTypeName(args[0].getItemType()));
}
- is = new URL(url).openStream();
} catch (MalformedURLException ex) {
- ex.printStackTrace();
+ //ex.printStackTrace();
LOG.error(ex);
throw new XPathException(getASTNode(),"Invalid resource URI",ex);
- } catch (IOException ex) {
+
+ } catch (ExistIOException ex) {
+ LOG.error(ex.getCause());
+ //ex.getCause().printStackTrace();
+ throw new XPathException(getASTNode(),"eXistIOexception",ex.getCause());
+
+ } catch (Exception ex) {
LOG.error(ex);
- ex.printStackTrace();
- throw new XPathException(getASTNode(),"IOexception",ex);
+ //ex.printStackTrace();
+ throw new XPathException(getASTNode(),"exception",ex);
}
ValidationReport vr = null;
@@ -194,6 +191,7 @@
}
} else {
// ohoh
+ LOG.error("invoked with wrong function name");
result = Sequence.EMPTY_SEQUENCE;
}
Added: trunk/eXist/test/src/org/exist/validation/ValidationFunctions_Node_Test.java
===================================================================
--- trunk/eXist/test/src/org/exist/validation/ValidationFunctions_Node_Test.java (rev 0)
+++ trunk/eXist/test/src/org/exist/validation/ValidationFunctions_Node_Test.java 2007-05-30 20:40:15 UTC (rev 5955)
@@ -0,0 +1,203 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2001-07 The eXist Project
+ * http://exist-db.org
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * $Id: ValidationFunctions_XSD_Test.java 5941 2007-05-29 20:27:59Z dizzzz $
+ */
+package org.exist.validation;
+
+import junit.framework.TestCase;
+import junit.textui.TestRunner;
+
+import org.apache.log4j.Logger;
+
+import org.exist.storage.DBBroker;
+import org.exist.xmldb.DatabaseInstanceManager;
+import org.exist.xquery.XPathException;
+
+import org.xmldb.api.DatabaseManager;
+import org.xmldb.api.base.Collection;
+import org.xmldb.api.base.Database;
+import org.xmldb.api.base.ResourceSet;
+import org.xmldb.api.modules.XPathQueryService;
+
+/**
+ * Set of Tests for validation:validate($a) and validation:validate($a, $b)
+ * regaring validatin using XSD's.
+ *
+ * @author Dannes Wessels (di...@ex...)
+ */
+public class ValidationFunctions_Node_Test extends TestCase {
+
+ private final static Logger logger = Logger.getLogger(ValidationFunctions_Node_Test.class);
+
+ private static XPathQueryService service;
+ private static Collection root = null;
+ private static Database database = null;
+
+ public static void main(String[] args) throws XPathException {
+ TestRunner.run(ValidationFunctions_XSD_Test.class);
+ }
+
+ public ValidationFunctions_Node_Test(String arg0) {
+ super(arg0);
+ }
+
+ public void testsetUp() throws Exception {
+
+ // initialize driver
+ System.out.println(this.getName());
+ logger.info(this.getName());
+
+ Class cl = Class.forName("org.exist.xmldb.DatabaseImpl");
+ database = (Database) cl.newInstance();
+ database.setProperty("create-database", "true");
+ DatabaseManager.registerDatabase(database);
+ root = DatabaseManager.getCollection("xmldb:exist://" + DBBroker.ROOT_COLLECTION, "admin", null);
+ service = (XPathQueryService) root.getService( "XQueryService", "1.0" );
+ }
+
+ // ===========================================================
+
+ private void clearGrammarCache() {
+ logger.info("Clearing grammar cache");
+ ResourceSet result = null;
+ try {
+ result = service.query("validation:grammar-cache-clear()");
+
+ } catch (Exception e) {
+ logger.error(e);
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ }
+
+
+ public void testStoredNode() {
+
+ System.out.println(this.getName());
+ logger.info(this.getName());
+
+ clearGrammarCache();
+
+ String query = null;
+ ResourceSet result = null;
+ String r = null;
+
+ try {
+ logger.info("Test1");
+ query = "let $doc := doc('/db/validationtest/addressbook_valid.xml') "+
+ "let $result := validation:validate( $doc, "+
+ " xs:anyURI('/db/validationtest/xsd/addressbook.xsd') ) "+
+ "return $result";
+ result = service.query(query);
+ r = (String) result.getResource(0).getContent();
+ assertEquals( "valid document as node", "true", r );
+
+ clearGrammarCache();
+
+ } catch (Exception e) {
+ logger.error(e);
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ try {
+ logger.info("Test2");
+
+ query = "let $doc := doc('/db/validationtest/addressbook_invalid.xml') "+
+ "let $result := validation:validate( $doc, "+
+ " xs:anyURI('/db/validationtest/xsd/addressbook.xsd') ) "+
+ "return $result";
+ result = service.query(query);
+ r = (String) result.getResource(0).getContent();
+ assertEquals( "invalid document as node", "false", r );
+
+ clearGrammarCache();
+
+ } catch (Exception e) {
+ logger.error(e);
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+
+ public void testConstructedNode() {
+
+ System.out.println(this.getName());
+ logger.info(this.getName());
+
+ clearGrammarCache();
+
+ String query = null;
+ ResourceSet result = null;
+ String r = null;
+
+ try {
+ logger.info("Test1");
+
+ query = "let $doc := "+
+ "<addressBook xmlns=\"http://jmvanel.free.fr/xsd/addressBook\">"+
+ "<owner> <cname>John Punin</cname> <email>pu...@cs...</email> </owner>"+
+ "<person> <cname>Harrison Ford</cname> <email>hf...@fa...</email> </person>"+
+ "<person> <cname>Julia Roberts</cname> <email>jr...@pw...</email> </person>"+
+ "</addressBook> " +
+ "let $result := validation:validate( $doc, "+
+ " xs:anyURI('/db/validationtest/xsd/addressbook.xsd') ) "+
+ "return $result";
+ result = service.query(query);
+ r = (String) result.getResource(0).getContent();
+ assertEquals( "valid document as node", "true", r );
+
+ clearGrammarCache();
+
+ } catch (Exception e) {
+ logger.error(e);
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ try {
+ logger.info("Test2");
+
+ query = "let $doc := "+
+ "<addressBook xmlns=\"http://jmvanel.free.fr/xsd/addressBook\">"+
+ "<owner1> <cname>John Punin</cname> <email>pu...@cs...</email> </owner1>"+
+ "<person> <cname>Harrison Ford</cname> <email>hf...@fa...</email> </person>"+
+ "<person> <cname>Julia Roberts</cname> <email>jr...@pw...</email> </person>"+
+ "</addressBook> " +
+ "let $result := validation:validate( $doc, "+
+ " xs:anyURI('/db/validationtest/xsd/addressbook.xsd') ) "+
+ "return $result";
+ result = service.query(query);
+ r = (String) result.getResource(0).getContent();
+ assertEquals( "invalid document as node", "false", r );
+
+ clearGrammarCache();
+
+ } catch (Exception e) {
+ logger.error(e);
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wol...@us...> - 2007-05-30 20:30:31
|
Revision: 5954
http://svn.sourceforge.net/exist/?rev=5954&view=rev
Author: wolfgang_m
Date: 2007-05-30 13:30:29 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Match tagging did not work yet if the output stream was sent to a transformer or SAX handler.
Modified Paths:
--------------
trunk/eXist/src/org/exist/storage/serializers/Serializer.java
Modified: trunk/eXist/src/org/exist/storage/serializers/Serializer.java
===================================================================
--- trunk/eXist/src/org/exist/storage/serializers/Serializer.java 2007-05-30 18:33:31 UTC (rev 5953)
+++ trunk/eXist/src/org/exist/storage/serializers/Serializer.java 2007-05-30 20:30:29 UTC (rev 5954)
@@ -669,10 +669,8 @@
xslHandler.getTransformer().setParameter(param, value);
}
- protected void setXSLHandler() {
- if (templates == null)
- return;
- if (xslHandler != null) {
+ protected void setXSLHandler(NodeProxy root) {
+ if (templates != null && xslHandler != null) {
SAXResult result = new SAXResult();
boolean processXInclude =
getProperty(
@@ -696,7 +694,22 @@
} else
receiver = new ReceiverToSAX(xslHandler);
}
- }
+ if (root != null && getHighlightingMode() != TAG_NONE) {
+ IndexController controller = broker.getIndexController();
+ MatchListener listener = controller.getMatchListener(root);
+ if (ftmatch.hasMatches(root)) {
+ ftmatch.reset(root);
+ ftmatch.setNextInChain(receiver);
+ receiver = ftmatch;
+ LOG.debug("Applying FTMatchListener");
+ }
+ if (listener != null) {
+ MatchListener last = (MatchListener) listener.getLastInChain();
+ last.setNextInChain(receiver);
+ receiver = listener;
+ }
+ }
+ }
public void toSAX(DocumentImpl doc) throws SAXException {
if (outputProperties.getProperty(EXistOutputKeys.PROCESS_XSL_PI, "no").equals("yes")) {
@@ -713,7 +726,7 @@
} catch (TransformerConfigurationException e) {
throw new SAXException(e.getMessage(), e);
}
- setXSLHandler();
+ setXSLHandler(null);
serializeToReceiver(
doc,
getProperty(GENERATE_DOC_EVENTS, "false").equals("true"));
@@ -725,7 +738,7 @@
} catch (TransformerConfigurationException e) {
throw new SAXException(e.getMessage(), e);
}
- setXSLHandler();
+ setXSLHandler(n.getImplementationType() == NodeValue.PERSISTENT_NODE ? (NodeProxy)n : null);
serializeToReceiver(
n,
getProperty(GENERATE_DOC_EVENTS, "false").equals("true"));
@@ -737,7 +750,7 @@
} catch (TransformerConfigurationException e) {
throw new SAXException(e.getMessage(), e);
}
- setXSLHandler();
+ setXSLHandler(p);
if (p.getNodeId() == NodeId.DOCUMENT_NODE) {
serializeToReceiver(p.getDocument(), getProperty(GENERATE_DOC_EVENTS, "false").equals("true"));
} else {
@@ -764,7 +777,7 @@
} catch (TransformerConfigurationException e) {
throw new SAXException(e.getMessage(), e);
}
- setXSLHandler();
+ setXSLHandler(null);
AttrList attrs = new AttrList();
attrs.addAttribute(ATTR_HITS_QNAME, Integer.toString(seq.getItemCount()));
attrs.addAttribute(ATTR_START_QNAME, Integer.toString(start));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-30 18:33:34
|
Revision: 5953
http://svn.sourceforge.net/exist/?rev=5953&view=rev
Author: brihaye
Date: 2007-05-30 11:33:31 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Renamed some variables in VirtualNodeSet now that my understanding is better.
Added some comments also.
Modified Paths:
--------------
trunk/eXist/src/org/exist/dom/VirtualNodeSet.java
Modified: trunk/eXist/src/org/exist/dom/VirtualNodeSet.java
===================================================================
--- trunk/eXist/src/org/exist/dom/VirtualNodeSet.java 2007-05-30 18:27:29 UTC (rev 5952)
+++ trunk/eXist/src/org/exist/dom/VirtualNodeSet.java 2007-05-30 18:33:31 UTC (rev 5953)
@@ -91,14 +91,14 @@
* @return a <code>boolean</code> value
*/
public boolean contains(NodeProxy p) {
- NodeProxy first = getFirstParent(p, null, (axis == Constants.SELF_AXIS), 0);
+ NodeProxy firstParent = getFirstParent(p, null, (axis == Constants.SELF_AXIS), 0);
// Timo Boehme: getFirstParent returns now only real parents
- // therefore test if node is child of context
- if (first != null) {
+ // therefore test if node is child of context
+ if (firstParent != null) {
return true;
}
// if (context.get(p.getDocument(), p.getNodeId().getParentId()) != null) {
- // return true;
+ // return true;
// }
return false;
}
@@ -141,9 +141,9 @@
* @param recursions an <code>int</code> value
* @return a <code>NodeProxy</code> value
*/
- private NodeProxy getFirstParent(NodeProxy node, NodeProxy first,
+ private NodeProxy getFirstParent(NodeProxy self, NodeProxy firstParent,
boolean includeSelf, int recursions) {
- return getFirstParent(node, first, includeSelf, true, recursions);
+ return getFirstParent(self, firstParent, includeSelf, true, recursions);
}
/**
@@ -156,93 +156,97 @@
* @param recursions an <code>int</code> value
* @return a <code>NodeProxy</code> value
*/
- private NodeProxy getFirstParent(NodeProxy node, NodeProxy first,
- boolean includeSelf, boolean directParent, int recursions) {
+ private NodeProxy getFirstParent(NodeProxy self, NodeProxy candidateFirstParent,
+ boolean includeSelf, boolean restrictToDirectParent, int recursions) {
- NodeId pid = node.getNodeId().getParentId();
-
- /* if the node has no parent, i.e. pid == -1, we still need to
+ /* if the node has is a doument node we still need to
* complete this method to check if we have found a potential parent
* in one of the iterations before.
*/
- NodeProxy parent;
+ NodeId parentOfSelfId = self.getNodeId().getParentId();
+
// check if the start-node should be included, e.g. to process an
// expression like *[. = 'xxx']
- if (recursions == 0 && includeSelf && test.matches(node)) {
+ //TODO : investigate on expression like *[.//* = 'xxx']
+ if (recursions == 0 && includeSelf && test.matches(self)) {
+ // if we're on the child axis, test if
+ // the node is a direct child of the context node
if (axis == Constants.CHILD_AXIS) {
- // if we're on the child axis, test if
- // the node is a direct child of the context node
- parent = context.get(node.getDocument(), pid);
+ //WARNING : get() realizes virtual node sets
+ //TODO : investigate more efficent solutions
+ NodeProxy parent = context.get(self.getDocument(), parentOfSelfId);
if (parent != null) {
- node.copyContext(parent);
+ self.copyContext(parent);
if (useSelfAsContext && inPredicate) {
- node.addContextNode(contextId, node);
+ self.addContextNode(contextId, self);
} else if (inPredicate)
- node.addContextNode(contextId, parent);
- return node;
+ self.addContextNode(contextId, parent);
+ return self;
}
} else {
// descendant axis: remember the node and continue
- first = node;
+ candidateFirstParent = self;
}
}
// if this is the first call to this method, remember the first
- // parent node and re-evaluate the method. We can't just return
- // the first parent as we need a parent that is actually contained
- // in the context set. We thus call the method again to complete.
- if (first == null) {
- if (pid == NodeId.DOCUMENT_NODE) {
- // given node was already document element -> no parent
+ // parent node and continue to evaluate the method. We can't just return
+ // the first parent as we need a parent that is *actually* contained
+ // in the context set. We will thus call the method again to complete.
+ if (candidateFirstParent == null) {
+ //given node was already document element -> no parent
+ if (parentOfSelfId == NodeId.DOCUMENT_NODE) {
return null;
}
- first = new NodeProxy(node.getDocument(), pid, Node.ELEMENT_NODE,
- StoredNode.UNKNOWN_NODE_IMPL_ADDRESS);
+ candidateFirstParent = new NodeProxy(self.getDocument(), parentOfSelfId, Node.ELEMENT_NODE);
// if we are on the self axis, check if the first parent can be selected
if (axis == Constants.DESCENDANT_SELF_AXIS) {
- parent = context.get(first.getDocument(), pid);
+ //WARNING : get() realizes virtual node sets
+ //TODO : investigate more efficent solutions
+ NodeProxy parent = context.get(candidateFirstParent.getDocument(), parentOfSelfId);
if (parent != null && test.matches(parent)) {
- first.copyContext(parent);
+ candidateFirstParent.copyContext(parent);
if (useSelfAsContext && inPredicate) {
- first.addContextNode(contextId, first);
+ candidateFirstParent.addContextNode(contextId, candidateFirstParent);
} else if (inPredicate)
- first.addContextNode(contextId, parent);
- return first;
+ candidateFirstParent.addContextNode(contextId, parent);
+ return candidateFirstParent;
}
}
- // Timo Boehme: we need a real parent (child from context)
- return getFirstParent(first, first, false, directParent, recursions + 1);
+ // We need a real parent : keep the candidate and continue to ierate from this one
+ return getFirstParent(candidateFirstParent, candidateFirstParent, false, restrictToDirectParent, recursions + 1);
}
- // is pid member of the context set?
- parent = context.get(node.getDocument(), pid);
+ // is the node's parent in the context set?
+ //WARNING : get() realizes virtual node sets
+ //TODO : investigate more efficent solutions
+ NodeProxy parentOfSelf = context.get(self.getDocument(), parentOfSelfId);
- if (parent != null && test.matches(node)) {
+ if (parentOfSelf != null && test.matches(self)) {
if (axis != Constants.CHILD_AXIS) {
- // if we are on the descendant-axis, we return the first node
+ // if we are on the descendant axis, we return the first node
// we found while walking bottom-up.
// Otherwise, we return the last one (which is node)
- node = first;
+ self = candidateFirstParent;
}
- node.copyContext(parent);
+ self.copyContext(parentOfSelf);
if (useSelfAsContext && inPredicate) {
- node.addContextNode(contextId, node);
+ self.addContextNode(contextId, self);
} else if (inPredicate) {
- node.addContextNode(contextId, parent);
+ self.addContextNode(contextId, parentOfSelf);
}
// Timo Boehme: we return the ancestor which is child of context
- return node;
- } else if (pid == NodeId.DOCUMENT_NODE) {
+ return self;
+ } else if (parentOfSelfId == NodeId.DOCUMENT_NODE) {
// no matching node has been found in the context
return null;
- } else if (directParent && axis == Constants.CHILD_AXIS && recursions == 1) {
+ } else if (restrictToDirectParent && axis == Constants.CHILD_AXIS && recursions == 1) {
// break here if the expression is like /*/n
return null;
} else {
// continue for expressions like //*/n or /*//n
- parent = new NodeProxy(node.getDocument(), pid, Node.ELEMENT_NODE,
- StoredNode.UNKNOWN_NODE_IMPL_ADDRESS);
- return getFirstParent(parent, first, false, false, recursions + 1);
+ parentOfSelf = new NodeProxy(self.getDocument(), parentOfSelfId, Node.ELEMENT_NODE);
+ return getFirstParent(parentOfSelf, candidateFirstParent, false, false, recursions + 1);
}
}
@@ -275,9 +279,9 @@
* @param level an <code>int</code> value
* @return a <code>NodeProxy</code> value
*/
- public NodeProxy parentWithChild(NodeProxy proxy, boolean directParent, boolean includeSelf,
+ public NodeProxy parentWithChild(NodeProxy proxy, boolean restrictToDirectParent, boolean includeSelf,
int level) {
- NodeProxy first = getFirstParent(proxy, null, includeSelf, directParent, 0);
+ NodeProxy first = getFirstParent(proxy, null, includeSelf, restrictToDirectParent, 0);
if (first != null)
//TODO : should we set an empty cardinality here ?
addInternal(first);
@@ -293,8 +297,8 @@
* @param includeSelf a <code>boolean</code> value
* @return a <code>NodeProxy</code> value
*/
- public NodeProxy parentWithChild(DocumentImpl doc, NodeId nodeId, boolean directParent, boolean includeSelf) {
- NodeProxy first = getFirstParent(new NodeProxy(doc, nodeId), null, includeSelf, directParent, 0);
+ public NodeProxy parentWithChild(DocumentImpl doc, NodeId nodeId, boolean restrictToDirectParent, boolean includeSelf) {
+ NodeProxy first = getFirstParent(new NodeProxy(doc, nodeId), null, includeSelf, restrictToDirectParent, 0);
if (first != null)
//TODO : should we set an empty cardinality here ?
addInternal(first);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <br...@us...> - 2007-05-30 18:27:43
|
Revision: 5952
http://svn.sourceforge.net/exist/?rev=5952&view=rev
Author: brihaye
Date: 2007-05-30 11:27:29 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Refactored geometric properties with regard to output SRS. More test cases.
Modified Paths:
--------------
trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java
trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/SpatialModule.java
trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java 2007-05-30 16:59:40 UTC (rev 5951)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java 2007-05-30 18:27:29 UTC (rev 5952)
@@ -408,7 +408,7 @@
return streamedGeometry;
}
- public Element getGML(Geometry geometry, Receiver receiver) throws SpatialIndexException {
+ public Element getGML(Geometry geometry, String srsName, Receiver receiver) throws SpatialIndexException {
//YES !!!
String gmlString = null;
try {
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java 2007-05-30 16:59:40 UTC (rev 5951)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGMLProducers.java 2007-05-30 18:27:29 UTC (rev 5952)
@@ -50,8 +50,16 @@
public class FunGMLProducers extends BasicFunction {
public final static FunctionSignature[] signatures = {
- //Functions that might depend from the SRS
new FunctionSignature(
+ new QName("transform", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the GML representation of geometry $a with the SRS $b",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
+ new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ },
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ ),
+ new FunctionSignature(
new QName("WKTtoGML", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
"Returns the GML representation of WKT $a with the SRS $b",
new SequenceType[]{
@@ -72,17 +80,6 @@
),
new FunctionSignature(
new QName("buffer", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of a buffer around geometry $a having width $b in its CRS in the CRS specified by $c. " +
- "Curves will be represented by 8 segments per circle quadrant.",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
- },
- new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
- ),
- new FunctionSignature(
- new QName("buffer", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
"Returns the GML representation of a buffer around geometry $a having width $b in its CRS. " +
"Curves will be represented by $c segments per circle quadrant.",
new SequenceType[]{
@@ -94,19 +91,6 @@
),
new FunctionSignature(
new QName("buffer", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of a buffer around geometry $a having width $b in its CRS in the CRS specified by $c. " +
- "Curves will be represented by $c segments per circle quadrant.",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE),
- new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
- },
- new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
- )
- ,
- new FunctionSignature(
- new QName("buffer", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
"Returns the GML representation of a buffer around geometry $a having width $b in its CRS. " +
"Curves will be represented by $c segments per circle quadrant.",
new SequenceType[]{
@@ -117,20 +101,6 @@
},
new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
),
- new FunctionSignature(
- new QName("buffer", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of a buffer around geometry $a having width $b in its CRS in the CRS specified by $c. " +
- "Curves will be represented by $c segments per circle quadrant." +
- "$d specifies the way line string ends are buffered : 1, as semi-circle, 2, as perpendicular straight lines, 3 as half-squares.",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.DOUBLE, Cardinality.EXACTLY_ONE),
- new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE),
- new SequenceType(Type.INTEGER, Cardinality.EXACTLY_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
- },
- new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
- ),
new FunctionSignature(
new QName("convexHull", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
"Returns the GML representation of the convex hull of geometry $a.",
@@ -140,107 +110,49 @@
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("convexHull", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the convex hull of geometry $a in the CRS specified by $b.",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
- new FunctionSignature(
- new QName("boundary", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the boundary of geometry $a.",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
- new FunctionSignature(
new QName("boundary", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the boundary of geometry $a in the CRS specified by $b.",
+ "Returns the GML representation of the boundary of geometry $a.",
new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
+ ),
new FunctionSignature(
- new QName("intersection", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the intersection of geometry $a and geometry $b.",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
- new FunctionSignature(
new QName("intersection", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the intersection of geometry $a and geometry $b in the CRS specified by $b.",
+ "Returns the GML representation of the intersection of geometry $a and geometry $b.",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
+ ),
new FunctionSignature(
- new QName("union", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the union of geometry $a and geometry $b.",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
- new FunctionSignature(
new QName("union", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the union of geometry $a and geometry $b in the CRS specified by $b.",
+ "Returns the GML representation of the union of geometry $a and geometry $b.",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("difference", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the difference of geometry $a and geometry $b.",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
- new FunctionSignature(
new QName("difference", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the difference of geometry $a and geometry $b in the CRS specified by $b.",
+ "Returns the GML representation of the difference of geometry $a and geometry $b.",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
+ ),
new FunctionSignature(
- new QName("symetricDifference", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the symetric difference of geometry $a and geometry $b.",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
- new FunctionSignature(
new QName("symetricDifference", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the GML representation of the symetric difference of geometry $a and geometry $b in the CRS specified by $b.",
+ "Returns the GML representation of the symetric difference of geometry $a and geometry $b.",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- ),
+ )
};
public FunGMLProducers(XQueryContext context, FunctionSignature signature) {
@@ -250,22 +162,42 @@
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
Sequence result = null;
try {
- String originSrsName = null;
- String targetSrsName = null;
AbstractGMLJDBCIndexWorker indexWorker = (AbstractGMLJDBCIndexWorker)
context.getBroker().getIndexController().getIndexWorkerById(AbstractGMLJDBCIndex.ID);
if (indexWorker == null)
throw new XPathException("Unable to find a spatial index worker");
Geometry geometry = null;
- if (isCalledAs("WKTtoGML")) {
+ String srsName = null;
+ if (isCalledAs("transform")) {
if (args[0].isEmpty())
result = Sequence.EMPTY_SEQUENCE;
else {
+ NodeValue geometryNode = (NodeValue) args[0].itemAt(0);
+ String sourceSRS = null;
+ //Try to get the geometry from the index
+ if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
+ geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
+ sourceSRS = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
+ //Otherwise, build it
+ } else {
+ geometry = indexWorker.streamGeometryForNode(context, geometryNode);
+ //Argl ! No SRS !
+ //sourceSRS = ((Element)geometryNode).getAttribute("srsName").trim();
+ //Erroneous workaround
+ sourceSRS = "osgb:BNG";
+ }
+ srsName = args[1].itemAt(0).getStringValue().trim();
+ geometry = indexWorker.transformGeometry(geometry, sourceSRS, srsName);
+ }
+ } else if (isCalledAs("WKTtoGML")) {
+ if (args[0].isEmpty())
+ result = Sequence.EMPTY_SEQUENCE;
+ else {
String wkt = args[0].itemAt(0).getStringValue();
- targetSrsName = args[1].itemAt(0).getStringValue().trim();
WKTReader wktReader = new WKTReader();
try {
geometry = wktReader.read(wkt);
+ srsName = args[1].itemAt(0).getStringValue().trim();
} catch (ParseException e) {
throw new XPathException(e);
}
@@ -276,11 +208,17 @@
else {
NodeValue geometryNode = (NodeValue) args[0].itemAt(0);
//Try to get the geometry from the index
- if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE)
+ if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
+ srsName = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
//Otherwise, build it
- else
- geometry = indexWorker.streamGeometryForNode(context, geometryNode);
+ } else {
+ geometry = indexWorker.streamGeometryForNode(context, geometryNode);
+ //Argl ! No SRS !
+ //srsName = ((Element)geometryNode).getAttribute("srsName").trim();
+ //Erroneous workaround
+ srsName = "osgb:BNG";
+ }
double distance = ((DoubleValue)args[1].itemAt(0)).getDouble();
int quadrantSegments = 8;
int endCapStyle = BufferOp.CAP_ROUND;
@@ -299,10 +237,6 @@
}
geometry = geometry.buffer(distance, quadrantSegments, endCapStyle);
-
- //Get the SRS which is the last argument iff it is a string
- if (Type.subTypeOf(args[getArgumentCount() - 1].itemAt(0).getType(), Type.STRING))
- targetSrsName = args[getArgumentCount() - 1].itemAt(0).getStringValue().trim();
}
} else if (isCalledAs("convexHull")) {
if (args[0].isEmpty())
@@ -310,13 +244,17 @@
else {
NodeValue geometryNode = (NodeValue) args[0].itemAt(0);
//Try to get the geometry from the index
- if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE)
+ if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
+ srsName = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
//Otherwise, build it
- else
- geometry = indexWorker.streamGeometryForNode(context, geometryNode);
- if (getArgumentCount() > 1)
- targetSrsName = args[1].itemAt(0).getStringValue().trim();
+ } else {
+ geometry = indexWorker.streamGeometryForNode(context, geometryNode);
+ //Argl ! No SRS !
+ //srsName = ((Element)geometryNode).getAttribute("srsName").trim();
+ //Erroneous workaround
+ srsName = "osgb:BNG";
+ }
geometry = geometry.convexHull();
}
} else if (isCalledAs("boundary")) {
@@ -325,13 +263,17 @@
else {
NodeValue geometryNode = (NodeValue) args[0].itemAt(0);
//Try to get the geometry from the index
- if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE)
+ if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
+ srsName = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
//Otherwise, build it
- else
- geometry = indexWorker.streamGeometryForNode(context, geometryNode);
- if (getArgumentCount() > 1)
- targetSrsName = args[1].itemAt(0).getStringValue().trim();
+ } else {
+ geometry = indexWorker.streamGeometryForNode(context, geometryNode);
+ //Argl ! No SRS !
+ //srsName = ((Element)geometryNode).getAttribute("srsName").trim();
+ //Erroneous workaround
+ srsName = "osgb:BNG";
+ }
geometry = geometry.getBoundary();
}
} else {
@@ -355,7 +297,7 @@
}
if (geometryNode2.getImplementationType() == NodeValue.PERSISTENT_NODE) {
geometry2 = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode2);
- srsName2 = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode1, "SRS_NAME").getStringValue();
+ srsName2 = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode2, "SRS_NAME").getStringValue();
}
//Otherwise build them
if (geometry1 == null) {
@@ -363,17 +305,15 @@
//Argl ! No SRS !
//srsName1 = ((Element)geometryNode1).getAttribute("srsName").trim();
//Erroneous workaround
- srsName1 = "EPSG:4326";
+ srsName1 = "osgb:BNG";
}
if (geometry2 == null) {
geometry2 = indexWorker.streamGeometryForNode(context, geometryNode2);
//Argl ! No SRS !
//srsName2 = ((Element)geometryNode2).getAttribute("srsName").trim();
//Erroneous workaround
- srsName2 = "EPSG:4326";
+ srsName2 = "osgb:BNG";
}
- if (getArgumentCount() > 2)
- targetSrsName = args[2].itemAt(0).getStringValue().trim();
//Transform the second geometry if necessary
if (!srsName1.equalsIgnoreCase(srsName2)) {
@@ -390,18 +330,10 @@
} else if (isCalledAs("symetricDifference")) {
geometry = geometry1.symDifference(geometry2);
}
-
- //Keep the first SRS for future use
- originSrsName = srsName1;
}
}
if (result == null) {
- //Transform the geometry if necessary
- if (targetSrsName != null && originSrsName != null && !originSrsName.equalsIgnoreCase(targetSrsName)) {
- geometry = indexWorker.transformGeometry(geometry, originSrsName, targetSrsName) ;
- }
-
String gmlPrefix = context.getPrefixForURI(AbstractGMLJDBCIndexWorker.GML_NS);
if (gmlPrefix == null)
throw new XPathException("'" + AbstractGMLJDBCIndexWorker.GML_NS + "' namespace is not defined");
@@ -410,7 +342,7 @@
try {
MemTreeBuilder builder = context.getDocumentBuilder();
DocumentBuilderReceiver receiver = new DocumentBuilderReceiver(builder);
- result = (NodeValue)indexWorker.getGML(geometry, receiver);
+ result = (NodeValue)indexWorker.getGML(geometry, srsName, receiver);
} finally {
context.popDocumentContext();
}
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java 2007-05-30 16:59:40 UTC (rev 5951)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/FunGeometricProperties.java 2007-05-30 18:27:29 UTC (rev 5952)
@@ -30,6 +30,7 @@
import org.exist.indexing.spatial.SpatialIndexException;
import org.exist.xquery.BasicFunction;
import org.exist.xquery.Cardinality;
+import org.exist.xquery.Constants;
import org.exist.xquery.FunctionSignature;
import org.exist.xquery.XPathException;
import org.exist.xquery.XQueryContext;
@@ -45,17 +46,9 @@
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.WKTWriter;
-/**
- * Created by IntelliJ IDEA.
- * User: wolf
- * Date: 28-Feb-2007
- * Time: 15:18:59
- * To change this template use File | Settings | File Templates.
- */
public class FunGeometricProperties extends BasicFunction {
public final static FunctionSignature[] signatures = {
- //Functions that might depend from the SRS
new FunctionSignature(
new QName("GMLtoWKT", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
"Returns the WKT representation of geometry $a",
@@ -65,142 +58,125 @@
new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("GMLtoWKT", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the WKT representation of geometry $a in the CRS specified by $b",
+ new QName("getMinX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the minimal X of geometry $a",
new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
- new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
+ new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("getMinX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the minimal X of geometry $a",
+ new QName("getMaxX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the maximal X of geometry $a",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("getMinX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the minimal X of geometry $a in the CRS specified by $b",
+ new QName("getMinY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the minimal Y of geometry $a",
new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
- ),
+ ),
new FunctionSignature(
- new QName("getMaxX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the maximal X of geometry $a",
+ new QName("getMaxY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the maximal Y of geometry $a",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("getMaxX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the maximal X of geometry $a in the CRS specified by $b",
+ new QName("getCentroidX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the X of centroid of geometry $a",
new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("getMinY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the minimal Y of geometry $a",
+ new QName("getCentroidY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the Y of centroid of geometry $a",
new SequenceType[]{
new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("getMinY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the minimal Y of geometry $a in the CRS specified by $b",
+ new QName("getArea", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the area of geometry $a",
new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("getMaxY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the maximal Y of geometry $a",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
- ),
+ new QName("getEPSG4326MinX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the minimal X of geometry $a",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
+ ),
new FunctionSignature(
- new QName("getMaxY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the maximal Y of geometry $a in the CRS specified by $b",
+ new QName("getEPSG4326MaxX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the maximal X of geometry $a",
new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("getCentroidX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the X of centroid of geometry $a",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
- ),
+ new QName("getEPSG4326MinY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the minimal Y of geometry $a",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
+ ),
new FunctionSignature(
- new QName("getCentroidX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the X of centroid of geometry $a in the CRS specified by $b",
+ new QName("getEPSG4326MaxY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the maximal Y of geometry $a",
new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("getCentroidY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the Y of centroid of geometry $a",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
- ),
+ new QName("getEPSG4326CentroidX", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the X of centroid of geometry $a",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
+ },
+ new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
+ ),
new FunctionSignature(
- new QName("getCentroidY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the Y of centroid of geometry $a in the CRS specified by $b",
+ new QName("getEPSG4326CentroidY", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the Y of centroid of geometry $a",
new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
new FunctionSignature(
- new QName("area", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the area of geometry $a",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
- },
- new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
- ),
- new FunctionSignature(
- new QName("area", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the area of geometry $a in the CRS specified by $b",
+ new QName("getEPSG4326Area", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the area of geometry $a",
new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- new SequenceType(Type.STRING, Cardinality.EXACTLY_ONE)
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE)
},
new SequenceType(Type.DOUBLE, Cardinality.ZERO_OR_ONE)
),
- //Functions that do no depend of the CRS
new FunctionSignature(
- new QName("getSRS", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
- "Returns the spatial reference system of geometry $a",
- new SequenceType[]{
- new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
- },
- new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
- ),
+ new QName("getSRS", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
+ "Returns the spatial reference system of geometry $a",
+ new SequenceType[]{
+ new SequenceType(Type.NODE, Cardinality.ZERO_OR_ONE),
+ },
+ new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)
+ ),
new FunctionSignature(
new QName("getGeometryType", SpatialModule.NAMESPACE_URI, SpatialModule.PREFIX),
"Returns the type of geometry $a",
@@ -246,36 +222,45 @@
result = Sequence.EMPTY_SEQUENCE;
else {
try {
- String targetSrsName= null;
Geometry geometry = null;
- if (getArgumentCount() == 2)
- targetSrsName = args[1].itemAt(0).getStringValue().trim();
+ String sourceCRS = null;
AbstractGMLJDBCIndexWorker indexWorker = (AbstractGMLJDBCIndexWorker)
context.getBroker().getIndexController().getIndexWorkerById(AbstractGMLJDBCIndex.ID);
if (indexWorker == null)
throw new XPathException("Unable to find a spatial index worker");
NodeValue geometryNode = (NodeValue) nodes.itemAt(0);
if (geometryNode.getImplementationType() == NodeValue.PERSISTENT_NODE) {
- boolean optimizeOnEpsg4326 = false;
- //TODO : try to spot equivalent CRS
- optimizeOnEpsg4326 = "EPSG:4326".equalsIgnoreCase(targetSrsName);
String propertyName = null;
if (isCalledAs("GMLtoWKT")) {
- propertyName = optimizeOnEpsg4326 ? "EPSG4326_WKT" : "WKT";
+ propertyName = "WKT";
} else if (isCalledAs("getMinX")) {
- propertyName = optimizeOnEpsg4326 ? "EPSG4326_MINX" : "MINX";
+ propertyName = "MINX";
} else if (isCalledAs("getMaxX")) {
- propertyName = optimizeOnEpsg4326 ? "EPSG4326_MAXX" : "MAXX";
+ propertyName = "MAXX";
} else if (isCalledAs("getMinY")) {
- propertyName = optimizeOnEpsg4326 ? "EPSG4326_MINY" : "MINY";
+ propertyName = "MINY";
} else if (isCalledAs("getMaxY")) {
- propertyName = optimizeOnEpsg4326 ? "EPSG4326_MAXY" : "MAXY";
+ propertyName = "MAXY";
} else if (isCalledAs("getCentroidX")) {
- propertyName = optimizeOnEpsg4326 ? "EPSG4326_CENTROID_X" : "CENTROID_X";
+ propertyName = "CENTROID_X";
} else if (isCalledAs("getCentroidY")) {
- propertyName = optimizeOnEpsg4326 ? "EPSG4326_CENTROID_Y" : "CENTROID_Y";
- } else if (isCalledAs("area")) {
- propertyName = optimizeOnEpsg4326 ? "EPSG4326_AREA" : "AREA";
+ propertyName = "CENTROID_Y";
+ } else if (isCalledAs("getArea")) {
+ propertyName = "AREA";
+ } else if (isCalledAs("getEPSG4326MinX")) {
+ propertyName = "EPSG4326_MINX";
+ } else if (isCalledAs("getEPSG4326MaxX")) {
+ propertyName = "EPSG4326_MAXX";
+ } else if (isCalledAs("getEPSG4326MinY")) {
+ propertyName = "EPSG4326_MINY";
+ } else if (isCalledAs("getEPSG4326MaxY")) {
+ propertyName = "EPSG4326_MAXY";
+ } else if (isCalledAs("getEPSG4326CentroidX")) {
+ propertyName = "EPSG4326_CENTROID_X";
+ } else if (isCalledAs("getEPSG4326CentroidY")) {
+ propertyName = "EPSG4326_CENTROID_Y";
+ } else if (isCalledAs("getEPSG4326Area")) {
+ propertyName = "EPSG4326_AREA";
} else if (isCalledAs("getSRS")) {
propertyName = "SRS_NAME";
} else if (isCalledAs("getGeometryType")) {
@@ -288,25 +273,44 @@
propertyName = "IS_VALID";
} else
throw new XPathException("Unknown spatial property: " + mySignature.getName().getLocalName());
- if (propertyName != null)
+ if (propertyName != null) {
//The node should be indexed : get its properties
result = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, propertyName);
- else
+ } else {
//Or, at least, its geometry for further processing
geometry = indexWorker.getGeometryForNode(context.getBroker(), (NodeProxy)geometryNode);
+ sourceCRS = indexWorker.getGeometricPropertyForNode(context.getBroker(), (NodeProxy)geometryNode, "SRS_NAME").getStringValue();
+ }
}
if (result == null) {
- if (geometry == null) {
- //builds the geometry
+ //builds the geometry
+ if (geometry == null) {
geometry = indexWorker.streamGeometryForNode(context, geometryNode);
+ //Argl ! No SRS !
+ //sourceCRS = ((Element)geometryNode).getAttribute("srsName").trim();
+ //Erroneous workaround
+ sourceCRS = "osgb:BNG";
}
- if (geometry == null)
- throw new XPathException(geometryNode.getNode().getLocalName() + " is not a GML geometry node");
- //Transform the geometry if necessary
- String originSrsName = ((Element)geometryNode).getAttribute("srsName").trim();
- if (targetSrsName != null && !originSrsName.equalsIgnoreCase(targetSrsName))
- geometry = indexWorker.transformGeometry(geometry, originSrsName, targetSrsName);
- if (isCalledAs("GMLtoWKT")) {
+
+ //Transform the geometry to EPSG:4326 if relevant
+ if (mySignature.getName().getLocalName().indexOf("EPSG4326") != Constants.STRING_NOT_FOUND) {
+ geometry = indexWorker.transformGeometry(geometry, sourceCRS, "EPSG:4326");
+ if (isCalledAs("getEPSG4326MinX")) {
+ result = new DoubleValue(geometry.getEnvelopeInternal().getMinX());
+ } else if (isCalledAs("getEPSG4326MaxX")) {
+ result = new DoubleValue(geometry.getEnvelopeInternal().getMaxX());
+ } else if (isCalledAs("getEPSG4326MinY")) {
+ result = new DoubleValue(geometry.getEnvelopeInternal().getMinY());
+ } else if (isCalledAs("getEPSG4326MaxY")) {
+ result = new DoubleValue(geometry.getEnvelopeInternal().getMaxY());
+ } else if (isCalledAs("getEPSG4326CentroidX")) {
+ result = new DoubleValue(geometry.getCentroid().getX());
+ } else if (isCalledAs("getEPSG4326CentroidY")) {
+ result = new DoubleValue(geometry.getCentroid().getY());
+ } else if (isCalledAs("getEPSG4326Area")) {
+ result = new DoubleValue(geometry.getArea());
+ }
+ } else if (isCalledAs("GMLtoWKT")) {
WKTWriter wktWriter = new WKTWriter();
result = new StringValue(wktWriter.write(geometry));
} else if (isCalledAs("getMinX")) {
@@ -321,6 +325,8 @@
result = new DoubleValue(geometry.getCentroid().getX());
} else if (isCalledAs("getCentroidY")) {
result = new DoubleValue(geometry.getCentroid().getY());
+ } else if (isCalledAs("getArea")) {
+ result = new DoubleValue(geometry.getArea());
} else if (isCalledAs("getSRS")) {
result = new StringValue(((Element)geometryNode).getAttribute("srsName"));
} else if (isCalledAs("getGeometryType")) {
Modified: trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/SpatialModule.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/SpatialModule.java 2007-05-30 16:59:40 UTC (rev 5951)
+++ trunk/eXist/extensions/indexes/spatial/src/org/exist/xquery/modules/spatial/SpatialModule.java 2007-05-30 18:27:29 UTC (rev 5952)
@@ -60,8 +60,8 @@
new FunctionDef(FunGeometricProperties.signatures[16], FunGeometricProperties.class),
new FunctionDef(FunGeometricProperties.signatures[17], FunGeometricProperties.class),
new FunctionDef(FunGeometricProperties.signatures[18], FunGeometricProperties.class),
+ new FunctionDef(FunGeometricProperties.signatures[18], FunGeometricProperties.class),
new FunctionDef(FunGeometricProperties.signatures[19], FunGeometricProperties.class),
- new FunctionDef(FunGeometricProperties.signatures[20], FunGeometricProperties.class),
new FunctionDef(FunGMLProducers.signatures[0], FunGMLProducers.class),
new FunctionDef(FunGMLProducers.signatures[1], FunGMLProducers.class),
new FunctionDef(FunGMLProducers.signatures[2], FunGMLProducers.class),
@@ -72,15 +72,7 @@
new FunctionDef(FunGMLProducers.signatures[7], FunGMLProducers.class),
new FunctionDef(FunGMLProducers.signatures[8], FunGMLProducers.class),
new FunctionDef(FunGMLProducers.signatures[9], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[10], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[11], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[12], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[13], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[14], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[15], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[16], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[17], FunGMLProducers.class),
- new FunctionDef(FunGMLProducers.signatures[18], FunGMLProducers.class)
+ new FunctionDef(FunGMLProducers.signatures[10], FunGMLProducers.class)
};
public SpatialModule() {
Modified: trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java
===================================================================
--- trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java 2007-05-30 16:59:40 UTC (rev 5951)
+++ trunk/eXist/extensions/indexes/spatial/test/src/org/exist/indexing/spatial/GMLIndexTest.java 2007-05-30 18:27:29 UTC (rev 5952)
@@ -389,100 +389,107 @@
Sequence seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:GMLtoWKT(//gml:Polygon[1], 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getMinX(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMinX(//gml:Polygon[1])";
+ "spatial:getMaxX(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMinX(//gml:Polygon[1], 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getMinY(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMaxX(//gml:Polygon[1])";
+ "spatial:getMaxY(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMaxX(//gml:Polygon[1], 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getCentroidX(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMinY(//gml:Polygon[1])";
+ "spatial:getCentroidY(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMinY(//gml:Polygon[1], 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getArea(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMaxY(//gml:Polygon[1])";
+ "spatial:getEPSG4326MinX(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMaxY(//gml:Polygon[1], 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getEPSG4326MaxX(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
- assertTrue(seq.getItemCount() > 0);
+ assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getCentroidX(//gml:Polygon[1])";
+ "spatial:getEPSG4326MinY(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getCentroidX(//gml:Polygon[1], 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getEPSG4326MaxY(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getCentroidY(//gml:Polygon[1])";
+ "spatial:getEPSG4326CentroidX(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getCentroidY(//gml:Polygon[1], 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getEPSG4326CentroidY(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getEPSG4326Area(//gml:Polygon[1])";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() > 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
"spatial:getSRS(//gml:Polygon[1])";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
@@ -527,12 +534,11 @@
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:GMLtoWKT((), 'EPSG:4326')";
+ "spatial:getArea(())";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
- assertTrue(seq.getItemCount() == 0);
-
- //In-memory tests
+ assertTrue(seq.getItemCount() == 0);
+ //In-memory tests
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
@@ -540,98 +546,109 @@
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:GMLtoWKT(" + IN_MEMORY_GML + ", 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getMinX(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMinX(" + IN_MEMORY_GML + ")";
+ "spatial:getMaxX(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMinX(" + IN_MEMORY_GML + ", 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getMinY(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMaxX(" + IN_MEMORY_GML + ")";
+ "spatial:getMaxY(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMaxX(" + IN_MEMORY_GML + ", 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getCentroidX(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMinY(" + IN_MEMORY_GML + ")";
+ "spatial:getCentroidY(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getArea(" + IN_MEMORY_GML + ")";
+ seq = xquery.execute(query, null, AccessContext.TEST);
+ assertNotNull(seq);
+ assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMinY(" + IN_MEMORY_GML + ", 'EPSG:4326')";
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getEPSG4326MinX(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMaxY(" + IN_MEMORY_GML + ")";
+ "spatial:getEPSG4326MaxX(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getMaxY(" + IN_MEMORY_GML + ", 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getEPSG4326MinY(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
- assertTrue(seq.getItemCount() > 0);
+ assertTrue(seq.getItemCount() > 0);
query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
"at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
"declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getCentroidX(" + IN_MEMORY_GML + ")";
+ "spatial:getEPSG4326MaxY(" + IN_MEMORY_GML + ")";
seq = xquery.execute(query, null, AccessContext.TEST);
assertNotNull(seq);
assertTrue(seq.getItemCount() > 0);
- query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
- "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
- "declare namespace gml = 'http://www.opengis.net/gml'; " +
- "spatial:getCentroidX(" + IN_MEMORY_GML + ", 'EPSG:4326')";
+ query = "import module namespace spatial='http://exist-db.org/xquery/spatial' " +
+ "at 'java:org.exist.examples.indexing.spatial.module.SpatialModule'; " +
+ "declare namespace gml = 'http://www.opengis.net/gml'; " +
+ "spatial:getEPSG4326CentroidX(" + IN_MEMORY_GML + ")...
[truncated message content] |
|
From: <del...@us...> - 2007-05-30 17:37:36
|
Revision: 5949
http://svn.sourceforge.net/exist/?rev=5949&view=rev
Author: deliriumsky
Date: 2007-05-30 09:53:33 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Update Jetty from 5.0.0 to 5.1.12
Modified Paths:
--------------
trunk/eXist/tools/jetty/lib/org.mortbay.jetty.jar
Modified: trunk/eXist/tools/jetty/lib/org.mortbay.jetty.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|