Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hdoc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Stephane Crozat
hdoc
Commits
ba999e38
Commit
ba999e38
authored
Dec 22, 2016
by
simei.yin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change simple xquery requests to xquery functions
parent
076812b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
hdoc_to_basex/basex/xquery/searchDocByAuthor.hq
hdoc_to_basex/basex/xquery/searchDocByAuthor.hq
+7
-5
hdoc_to_basex/basex/xquery/searchDocByTitle.hq
hdoc_to_basex/basex/xquery/searchDocByTitle.hq
+7
-4
No files found.
hdoc_to_basex/basex/xquery/searchDocByAuthor.hq
View file @
ba999e38
...
...
@@ -3,11 +3,10 @@
(: For example, $author := '^Baptiste Montangé$', to search for an exact name:)
(: For example, $name := 'Montangé', to search for documents whose author named Coutant:)
(: Remark : Accents in the authors' names have been taken care of :)
<documents>{
let $name := 'Montangé'
declare function local:searchDocByAuthor($name as xs:string, $docs as node()*) as node()*
{
let $name_noAcc := translate($name, 'áàâäéèêëíìîïóòôöúùûü','aaaaeeeeiiiioooouuuu')
for $doc in
//document
for $doc in
$docs
return
for $author in $doc/authors/author
let $titre := $doc/titre
...
...
@@ -15,4 +14,7 @@
where matches($author_noAcc, $name_noAcc)
group by $titre (: Avoid duplications of documents by their titre:)
return $doc
}</documents>
\ No newline at end of file
};
(: Example :)
local:searchDocByAuthor('Montangé', //document)
\ No newline at end of file
hdoc_to_basex/basex/xquery/searchDocByTitle.hq
View file @
ba999e38
...
...
@@ -3,9 +3,12 @@
(: For example, $name := '^NF29_HdocEtherpad$', to search for an exact name:)
(: For example, $name := 'NF29', to search for documents whose name contains 'NF29':)
<documents>{
let $name := '^NF29_HdocEtherpad$'
for $doc in
//document
declare function local:searchDocByTitle($name as xs:string, $docs as node()*) as node()*
{
for $doc in
$docs
where matches($doc/titre, $name, "i")
return $doc
}</documents>
\ No newline at end of file
};
(: Example :)
local:searchDocByTitle('^NF29_HdocEtherpad$', //document)
\ No newline at end of file
Write
Preview
Markdown
is supported
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