1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
<?vsp
--
-- $Id: main.vsp,v 1.2 2006/08/15 19:30:33 source Exp $
--
-- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
-- project.
--
-- Copyright (C) 1998-2006 OpenLink Software
--
-- This project is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; only version 2 of the License, dated June 1991.
--
-- 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
-- General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
--
declare _ctr integer;
declare _tf any;
declare _path varchar;
declare _cases any;
declare _case_id varchar;
_tf := "XQ"."XQ"."LIST_TEST_FILES"();
if ({?'reset'}='Y')
{
delete from "XQ"."XQ"."TEST_FILES";
delete from "XQ"."XQ"."TEST_CASES";
}
_ctr := 0;
while (_ctr < length (_tf))
{
_path := concat ('xqdemo/', aref (aref (_tf, _ctr), 0));
if (not exists (select 1 from "XQ"."XQ"."TEST_FILES" where "NAME" = _path))
{
insert into "XQ"."XQ"."TEST_FILES" ("ID", "NAME", "COMMENT")
values (sequence_next('_'), _path, aref (aref (_tf, _ctr), 1));
}
_ctr := _ctr+1;
}
-- whenever sqlstate '39000' goto abort_reading;
update "XQ"."XQ"."TEST_FILES" set "TEXT" = "XQ"."XQ"."GET_DAV_DATA" ("NAME") where "TEXT" is null;
--!! update "XQ"."XQ"."TEST_FILES" set "TEXT" = file_to_string ( concat ('xqdemo/', "NAME")) where "TEXT" is null;
-- update "XQ"."XQ"."TEST_FILES" set "TEXT" = file_to_string ( concat ('samples/xquery/', "NAME")) where "TEXT" is null;
-- update "XQ"."XQ"."TEST_FILES" set "TEXT" = file_to_string ( concat ('G:/binsrc/samples/xquery/', "NAME")) where "TEXT" is null;
abort_reading:;
-- whenever sqlstate 'XP101' goto abort_parseing;
update "XQ"."XQ"."TEST_FILES" set "XPER" = xper_doc ("TEXT") where "NAME" like '%xml' and "TEXT" is not null and "XPER" is null;
abort_parseing:;
?>
<HTML>
<HEAD>
<TITLE>XQuery demo | Intro</TITLE>
</HEAD>
<BODY>
<P>
Welcome to <A HREF="http://www.w3.org/TR/xquery">XML Query</A> demo.
At these pages, you can run queries over data from W3C's <A HREF="http://www.w3.org/TR/xmlquery-use-cases">XML Query Use Cases</A>.
This page is mostly for maintenance purposes only.
There's much more convenient <A HREF="demo.vsp">public version of this demo</A>.
</P>
<P>
To run all tests in one batch, go <A HREF="deskall.vsp">batch testing page</A>.
</P>
<P>
This demo is powered by <A HREF="http://www.openlinksw.com">OpenLink Virtuoso</A>.
</P>
<TABLE>
<TR><TH>File</TH><TH>Comment</TH><TH>Status</TH></TR>
<?vsp
for select "NAME", "COMMENT", "TEXT", "XPER" from "XQ"."XQ"."TEST_FILES" order by "ID" do
{
?><TR><TD><A HREF="file.vsp?name=<?/ "NAME" ?>"><?= "NAME" ?></A></TD><TD><?= "COMMENT" ?></TD><TD><?vsp if ("TEXT" is null) { ?>not loaded<?vsp } else { if ("XPER" is null) { ?>loaded<?vsp } else { ?>parsed<?vsp } } ?></TD></TR><?vsp
}
?>
</TABLE>
<P><A HREF="main.vsp?reset=Y">Reset input data</A></P>
<?vsp
for select "NAME" as _use_coll_name, "TEXT" as _text from "XQ"."XQ"."TEST_FILES" where "NAME"='xqdemo/20010608a1.xml' and "TEXT" is not null do
{
?>
<TABLE>
<TR><TH>Id</TH><TH>Description</TH></TR>
<?vsp
for select use_case from "XQ"."XQ"."TEST_FILES" where "NAME"=_use_coll_name and xpath_contains ("XPER", '//case', use_case) do
{
_case_id := xpath_eval ('@id', use_case);
if ({?'reset'}='Y')
{
insert into "XQ"."XQ"."TEST_CASES" ("ID", "NAME", "DESCR", "ORIGIN", "XQUERY", "ETALON")
values (sequence_next('_'), _case_id,
xpath_eval ('.//descr', use_case),
xpath_eval ('.//origin', use_case),
xpath_eval ('.//xquery', use_case),
xpath_eval ('.//etalon', use_case) );
}
?><TR><TD><A HREF="case.vsp?coll=<?/ _use_coll_name ?>&case=<?/ _case_id ?>"><?= _case_id ?></A></TD><TD><FONT SIZE=-1>
<?= xpath_eval ('.//descr', use_case) ?></FONT></TD></TR><?vsp
}
?>
</TABLE>
<?vsp
}
?>
</BODY>
</HTML>
|