--- /dev/null
+echo \#\#\# DOC :
+cat ./tests/docs/XPath-PT.xml
+echo
+for quer in ./tests/queries/XPath-PT/*.xpl ; do
+ echo $quer:
+ cat "$quer"
+ ./solve.native ./tests/docs/XPath-PT.xml -f "$quer"
+ cat "$quer".swr
+ echo
+done
\ No newline at end of file
(** use: [./test xml_file -f XPath_queries_file]
- one query per line [XPath_querie_file]
+ one query per line [XPath_querie_file], output
+ a solution per line.
*)
open Format
let fd = open_in Sys.argv.(1) in
let d = Tree.load_xml_file fd in
close_in fd;
- fprintf err_formatter "Parse Tree OK ! ";
d
with _ -> list in
let list = list_qu fq [] in
close_in fq;
- fprintf err_formatter "Parse query OK !\n %!";
list
- else failwith "Use -f"
+ else failwith "Use ./test xml_file -f XPath_queries_file"
let compute_run doc query =
let run = Run.compute doc query in
let flag = Array.length Sys.argv = 5 in
Format.pp_set_margin err_formatter 80;
let doc = doc () in
- output_string stderr "##### Doc with positions #####\n";
- Tree.print_xml_preorder stderr doc (Tree.root doc);
- output_string stderr "\n";
let queries = query () in
let rec print_selec fmt l = match l with
| [x] -> fprintf fmt "%s" (string_of_int x)
let asta = Compil.trans query in
let selected_nodes = Run.selected_nodes doc asta in
let run = compute_run doc asta in
- fprintf err_formatter "\n ### Query: %a"
- XPath.Ast.print query;
+ if flag
+ then
+ fprintf err_formatter " ### Query: %a"
+ XPath.Ast.print query
+ else ();
fprintf err_formatter "@. ### Selected nodes: {%a}@."
print_selec selected_nodes;
if flag
Run.print err_formatter run;
end
else ();
- let asta = Asta.empty in
solve_queries tl in
solve_queries queries;
exit 0
--- /dev/null
+<X>
+ <b>
+ <a>
+ <c>
+ <e>
+ <f>
+ <g>
+ <b>
+ <g/>
+ </b>
+ </g>
+ </f>
+ <e/>
+ </e>
+ </c>
+ </a>
+ </b>
+ <a>
+ <c>
+ <e>
+ <f/>
+ </e>
+ <f>
+ <X>
+ <g/>
+ <b>
+ <g/>
+ </b>
+ </X>
+ <e/>
+ </f>
+ </c>
+ </a>
+</X>
--- /dev/null
+/site/closed_auctions/closed_auction/annotation/description/text/keyword
\ No newline at end of file
--- /dev/null
+//closed_auction//keyword
\ No newline at end of file
--- /dev/null
+/site/closed_auctions/closed_auction//keyword
\ No newline at end of file
--- /dev/null
+/site/closed_auctions/closed_auction[annotation/description/text/keyword]/date
\ No newline at end of file
--- /dev/null
+/site/closed_auctions/closed_auction[descendant::keyword]/date
\ No newline at end of file
--- /dev/null
+/site/people/person[profile/gender and profile/age]/name
\ No newline at end of file
--- /dev/null
+/site/people/person[phone or homepage]/name
\ No newline at end of file
--- /dev/null
+/site/people/person[address and (phone or homepage) and (creditcard or profile)]/name
\ No newline at end of file
--- /dev/null
+/site/regions/*/item[parent::namerica or parent::samerica]/name
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction[(not(bidder/following::bidder) or not(bidder/preceding::bidder)) and (bidder/following::bidder and bidder/preceding::bidder)]/interval
\ No newline at end of file
--- /dev/null
+//keyword/ancestor::listitem/text/keyword
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction/bidder[following-sibling::bidder]
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction/bidder[preceding-sibling::bidder]
\ No newline at end of file
--- /dev/null
+/site/regions/*/item[following::item]/name
\ No newline at end of file
--- /dev/null
+/site/regions/*/item[preceding::item]/name
\ No newline at end of file
--- /dev/null
+//person[profile/@income]/name
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction[bidder and not(bidder/preceding-sibling::bidder)]/interval
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction[(not(bidder/following::bidder) or not(bidder/preceding::bidder)) or (bidder/following::bidder and bidder/preceding::bidder)]/interval
\ No newline at end of file
--- /dev/null
+/site/people/person[profile/age >= 18 and profile/@income < 10000 and address/city != 'Dallas']/name
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction[bidder/increase = current]/interval
\ No newline at end of file
--- /dev/null
+/site/people/person[profile/@income = /site/open_auctions/open_auction/current]/name
\ No newline at end of file
--- /dev/null
+/site/people/person[watches/watch/id(@open_auction)/seller/@person = @id]/name
\ No newline at end of file
--- /dev/null
+id('person0')/name
\ No newline at end of file
--- /dev/null
+/site/people/person/watches/watch/id(@open_auction)/interval
\ No newline at end of file
--- /dev/null
+/site/people/person[watches/watch/id(@open_auction)/itemref/id(@item)/parent::australian]/name
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction[(count(bidder) mod 2) = 0]/interval
\ No newline at end of file
--- /dev/null
+count(//text) + count(//bold) + count(//emph) + count(//keyword)
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction[sum(bidder/increase) > 10 * initial]/interval
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction[sum(bidder/increase) != (current - initial)]/interval
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction[bidder and (sum(bidder/increase) div count(bidder)) > 2 * initial]/interval"
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction[number(bidder[1]/increase) < number(bidder[floor((last() + 1) div 2)]/increase) and number(bidder[floor((last() + 1) div 2)]/increase) < number(bidder[last()]/increase)]/interval
\ No newline at end of file
--- /dev/null
+/site/regions/europe/item/description/descendant::keyword[last()]
\ No newline at end of file
--- /dev/null
+//keyword/ancestor::listitem[1]/text/keyword
\ No newline at end of file
--- /dev/null
+/site/open_auctions/open_auction/bidder[number(preceding-sibling::bidder[1]/increase) <= number(increase) and number(increase) <= number(following-sibling::bidder[1]/increase)]
\ No newline at end of file
--- /dev/null
+/site/regions/*/item[preceding::item[100] and following::item[100]]/name
\ No newline at end of file
--- /dev/null
+/site/regions/*/item[contains(description, name)]/name
\ No newline at end of file
--- /dev/null
+/site/regions/*/item[contains(substring-before(description, 'eros'), 'passion') and contains(substring-after(description, 'eros'), 'dangerous')]/name
\ No newline at end of file
--- /dev/null
+/site/regions/*/item[string-length(translate(normalize-space(description),' ','')) > 10000]/name
\ No newline at end of file
--- /dev/null
+/descendant::*[descendant::L]
\ No newline at end of file