Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Stephane Crozat
hdoc
Commits
81c6eade
Commit
81c6eade
authored
Jan 04, 2017
by
simei.yin
Browse files
add namespace and diffrentiate xquery library modules from main module
parent
14ec2763
Changes
5
Show whitespace changes
Inline
Side-by-side
hdoc_to_basex/basex/xquery/XQueryFunctions.hq
deleted
100644 → 0
View file @
14ec2763
hdoc_to_basex/basex/xquery/XQueryFunctions.xq
0 → 100644
View file @
81c6eade
(: 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"
;
(: myNs:searchDocByTitle('^NF29_HdocEtherpad$', //document ):)
(: myNs:searchSectionByTitle('contenu', //document) :)
myNs:searchDocByAuthor
(
'Montangé'
,
//
document
)
\ No newline at end of file
hdoc_to_basex/basex/xquery/searchDocByAuthor.
hq
→
hdoc_to_basex/basex/xquery/searchDocByAuthor.
xqm
View file @
81c6eade
...
...
@@ -4,7 +4,9 @@
(: For example, $name := 'Montangé', to search for documents whose author named Coutant:)
(: Remark : case and accents in author's name have been taken care of :)
declare function local:searchDocByAuthor($name as xs:string, $docs as node()*) as node()*
module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex";
declare function myNs:searchDocByAuthor($name as xs:string, $docs as node()*) as node()*
{
let $name_noAcc := translate($name, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
for $doc in $docs
...
...
@@ -16,6 +18,3 @@ declare function local:searchDocByAuthor($name as xs:string, $docs as node()*) a
group by $titre (: Avoid duplications of documents by their titre:)
return $doc
};
\ No newline at end of file
(: Example :)
local:searchDocByAuthor('Montangé', //document)
\ No newline at end of file
hdoc_to_basex/basex/xquery/searchDocByTitle.
hq
→
hdoc_to_basex/basex/xquery/searchDocByTitle.
xqm
View file @
81c6eade
...
...
@@ -3,12 +3,11 @@
(: For example, $name := '^NF29_HdocEtherpad$', to search for an exact name:)
(: For example, $name := 'NF29', to search for documents whose name contains 'NF29':)
declare function local:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex";
declare function myNs:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
{
for $doc in $docs
where matches($doc/titre, $name, "i")
return $doc
};
\ No newline at end of file
(: Example :)
local:searchDocByTitle('^NF29_HdocEtherpad$', //document)
\ No newline at end of file
hdoc_to_basex/basex/xquery/searchSectionByTitle.
hq
→
hdoc_to_basex/basex/xquery/searchSectionByTitle.
xqm
View file @
81c6eade
...
...
@@ -4,7 +4,9 @@
(: For example, $keyword := 'Syntax', to search for sections whose titles containing "Syntax" :)
(: Remark : case and accents in the keyword have been taken care of :)
declare function local:searchSectionByTitle($keyword as xs:string, $docs as node()*) as node()*
module namespace myNs = "https://gitlab.utc.fr/crozatst/hdoc/tree/master/hdoc_to_basex";
declare function myNs:searchSectionByTitle($keyword as xs:string, $docs as node()*) as node()*
{
let $keyword_noAcc := translate($keyword, 'áàâäéèêëíìîïóòôöúùûüABCDEFGHIJKLMNOPQRSTUVWXYZ','aaaaeeeeiiiioooouuuuabcdefghijklmnopqrstuvwxyz')
for $doc in $docs
...
...
@@ -14,6 +16,3 @@ declare function local:searchSectionByTitle($keyword as xs:string, $docs as node
where matches($title_noAcc, $keyword_noAcc)
return $section
};
\ No newline at end of file
(: Example :)
local:searchSectionByTitle('contenu', //document)
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment