Commit 43bbc2ee authored by simei.yin's avatar simei.yin

update xquery requests according to rename of balises in xlst

parent c0685863
(: this script with .xq as suffix is the main module :)
(: all functions defined in .xqm files (library modules) can be called here :)
import module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex" at "searchSectionByTitle.xqm", "searchSectionByTitle.xqm", "searchDocByAuthor.xqm";
import module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex" at "searchSectionByTitle.xqm", "searchDocByTitle.xqm", "searchDocByAuthor.xqm";
(: myNs:searchDocByTitle('^NF29_HdocEtherpad$', //document ):)
(: myNs:searchDocByTitle('^NF29_HdocEtherpad$', //document ) :)
(: myNs:searchSectionByTitle('contenu', //document) :)
(: myNs:searchDocByAuthor('montangé', //document) :)
......
......@@ -12,9 +12,9 @@ declare function myNs:searchDocByAuthor($name as xs:string, $docs as node()*) as
for $doc in $docs
return
for $author in $doc/authors/author
let $titre := $doc/titre
let $title := $doc/title
let $author_noAcc := translate($author, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
where matches($author_noAcc, $name_noAcc)
group by $titre (: Avoid duplications of documents by their titre:)
group by $title (: Avoid duplications of documents by their titre:)
return $doc
};
\ No newline at end of file
......@@ -8,6 +8,6 @@ module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to
declare function myNs:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
{
for $doc in $docs
where matches($doc/titre, $name, "i")
where matches($doc/title, $name, "i")
return $doc
};
\ No newline at end of file
......@@ -12,7 +12,7 @@ declare function myNs:searchSectionByTitle($keyword as xs:string, $docs as node(
for $doc in $docs
return
for $section in $doc/sections/section
let $title_noAcc := translate($section/titresection, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
let $title_noAcc := translate($section/titlesection, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
where matches($title_noAcc, $keyword_noAcc)
return $section
};
\ No newline at end of file
# This script will a database that includes all the xml files in the folder /hdoc_to_basex/output automatically
# This script will a database that includes all the xml files in the folder /opale_to_basex/output automatically
# Before executing this script, please make sure that you have successfully finished the transformation in the step 1 in the part "user story" of the README.md
# Syntax : CREATE DB [name] ([input])
#CREATE DB myDB [..the repertory of the projet in your local disk..]/hdoc/hdoc_to_basex/output
#CREATE DB myDB [..the repertory of the projet in your local disk..]/hdoc/opale_to_basex/output
# Example :
CREATE DB myDB D:/School/UTC/GI04/NF29/Projet/hdoc/hdoc_to_basex/output
CREATE DB myDB D:/School/UTC/GI04/NF29/Projet/hdoc/opale_to_basex/output
# P.S. If you get error message : Resource "..." not found, please confirm your file repertory is correct
\ No newline at end of file
(: this script with .xq as suffix is the main module :)
(: all functions defined in .xqm files (library modules) can be called here :)
import module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex" at "searchSectionByTitle.xqm", "searchSectionByTitle.xqm", "searchDocByAuthor.xqm";
import module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex" at "searchSectionByTitle.xqm", "searchDocByTitle.xqm", "searchDocByAuthor.xqm";
(: myNs:searchDocByTitle('^NF29_HdocEtherpad$', //document ):)
(: myNs:searchDocByTitle('^NF29_HdocEtherpad$', //document ) :)
(: myNs:searchSectionByTitle('contenu', //document) :)
(: myNs:searchDocByAuthor('montangé', //document) :)
......
......@@ -12,9 +12,9 @@ declare function myNs:searchDocByAuthor($name as xs:string, $docs as node()*) as
for $doc in $docs
return
for $author in $doc/authors/author
let $titre := $doc/titre
let $title := $doc/title
let $author_noAcc := translate($author, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
where matches($author_noAcc, $name_noAcc)
group by $titre (: Avoid duplications of documents by their titre:)
group by $title (: Avoid duplications of documents by their titre:)
return $doc
};
\ No newline at end of file
......@@ -8,6 +8,6 @@ module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to
declare function myNs:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
{
for $doc in $docs
where matches($doc/titre, $name, "i")
where matches($doc/title, $name, "i")
return $doc
};
\ No newline at end of file
......@@ -12,7 +12,7 @@ declare function myNs:searchSectionByTitle($keyword as xs:string, $docs as node(
for $doc in $docs
return
for $section in $doc/sections/section
let $title_noAcc := translate($section/titresection, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
let $title_noAcc := translate($section/titlesection, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
where matches($title_noAcc, $keyword_noAcc)
return $section
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment