Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to eXist 5 #376

Merged
merged 40 commits into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6fa2622
apply some fixes for current eXist-db 4.7
peterstadler May 28, 2019
0ba0ded
add collation for sorting of facets
peterstadler May 29, 2019
1072455
some speedups for eXist 4.7
peterstadler Apr 27, 2020
bdf098c
add `norm:create-norm-doc-documents()`
peterstadler Apr 28, 2020
d3c2c8a
response data is always an array
peterstadler Apr 28, 2020
2681650
Merge branch 'develop' into test-4.7
peterstadler Sep 25, 2020
77e9fda
Merge branch 'develop' into test-4.7
peterstadler Sep 29, 2020
9c7ed8f
Merge branch 'develop' into test-4.7
peterstadler Sep 29, 2020
4005093
move functions
peterstadler Sep 30, 2020
f58fbbd
refactor to use eXist5 facets and fields
peterstadler Sep 30, 2020
c3b3eab
remove outdated stuff
peterstadler Sep 30, 2020
46eadb8
move `strip-diacritics()` to WeGA-WebApp-lib str module
peterstadler Sep 30, 2020
21af8d5
get rid of norm module completely
peterstadler Sep 30, 2020
186c334
fix `core:undated`
peterstadler Sep 30, 2020
9a3766c
declare namespace
peterstadler Sep 30, 2020
df76556
remove superfluous lines
peterstadler Oct 1, 2020
afcf3b7
refactor `core:undated()` to use date filter
peterstadler Oct 1, 2020
5d40748
add function `core:index-keys-for-field()`
peterstadler Oct 1, 2020
82b7b6c
fix filtering
peterstadler Oct 2, 2020
2906dd2
Merge branch 'develop' into test-4.7
peterstadler Oct 8, 2020
ec89ce4
set semver-min
peterstadler Nov 9, 2020
65baecd
update processing/filtering of tests
peterstadler Nov 9, 2020
b54447f
Merge branch 'develop' into test-4.7
peterstadler Nov 23, 2020
a3a8f94
Merge branch 'develop' into test-4.7
peterstadler Nov 23, 2020
c0f04b8
update Dockerfile to use eXist5.2.0
peterstadler Nov 30, 2020
fb4ef35
use local curl binary
peterstadler Nov 30, 2020
b4215c1
update (some) expected results
peterstadler Nov 30, 2020
d03a894
add dependencies
peterstadler Nov 30, 2020
99b486d
getting saxon from sourceforge
peterstadler Nov 30, 2020
dff6de5
try to reduce memory consumption
peterstadler Nov 30, 2020
231cb2c
normalize characterNames
peterstadler Nov 30, 2020
f450351
update expected results
peterstadler Nov 30, 2020
b049fd2
try more recent distro for travis
peterstadler Nov 30, 2020
307dd3a
Merge branch 'develop' into test-4.7
peterstadler Dec 2, 2020
894c153
ups, never meant to commit these files
peterstadler Dec 2, 2020
5d8139a
exclude xpr-files from the xar package
peterstadler Dec 2, 2020
33b672d
Merge branch 'develop' into test-4.7
peterstadler Dec 2, 2020
914136e
refactor some API endpoints
peterstadler Dec 7, 2020
ea19a17
Merge branch 'develop' into test-4.7
peterstadler Dec 8, 2020
a9581e8
update Readme
peterstadler Dec 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor to use eXist5 facets and fields
instead of norm module
  • Loading branch information
peterstadler committed Sep 30, 2020
commit f58fbbdfbb09e2bc37a196e3027d0316941cc368
9 changes: 5 additions & 4 deletions modules/core.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ declare namespace mei="http://www.music-encoding.org/ns/mei";
declare namespace request="http://exist-db.org/xquery/request";
declare namespace xmldb="http://exist-db.org/xquery/xmldb";
declare namespace util="http://exist-db.org/xquery/util";
declare namespace ft="http://exist-db.org/xquery/lucene";

import module namespace config="http://xquery.weber-gesamtausgabe.de/modules/config" at "config.xqm";
import module namespace crud="http://xquery.weber-gesamtausgabe.de/modules/crud" at "crud.xqm";
import module namespace wega-util="http://xquery.weber-gesamtausgabe.de/modules/wega-util" at "wega-util.xqm";
import module namespace norm="http://xquery.weber-gesamtausgabe.de/modules/norm" at "norm.xqm";
import module namespace wdt="http://xquery.weber-gesamtausgabe.de/modules/wdt" at "wdt.xqm";
import module namespace mycache="http://xquery.weber-gesamtausgabe.de/modules/cache" at "xmldb:exist:///db/apps/WeGA-WebApp-lib/xquery/cache.xqm";
import module namespace date="http://xquery.weber-gesamtausgabe.de/modules/date" at "xmldb:exist:///db/apps/WeGA-WebApp-lib/xquery/date.xqm";
Expand Down Expand Up @@ -76,7 +76,8 @@ declare %private function core:createColl($collName as xs:string, $cacheKey as x
: @return document-node()*
:)
declare function core:undated($docType as xs:string) as document-node()* {
let $norm-file := norm:get-norm-doc($docType)
for $i in $norm-file//norm:entry[not(text())]
return crud:doc($i/@docID)
switch($docType)
case 'letters' case 'writings' case 'documents' return
(crud:data-collection($docType)/tei:TEI[not(@ref)] except crud:data-collection($docType)//tei:TEI[ft:query(., (), map { "fields": ("date") })])/root()
default return ()
};
31 changes: 23 additions & 8 deletions modules/query.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ declare namespace xdt="http://www.w3.org/2005/xpath-datatypes";

import module namespace config="http://xquery.weber-gesamtausgabe.de/modules/config" at "config.xqm";
import module namespace crud="http://xquery.weber-gesamtausgabe.de/modules/crud" at "crud.xqm";
import module namespace norm="http://xquery.weber-gesamtausgabe.de/modules/norm" at "norm.xqm";
import module namespace core="http://xquery.weber-gesamtausgabe.de/modules/core" at "core.xqm";
import module namespace wdt="http://xquery.weber-gesamtausgabe.de/modules/wdt" at "wdt.xqm";
import module namespace wega-util="http://xquery.weber-gesamtausgabe.de/modules/wega-util" at "wega-util.xqm";
Expand Down Expand Up @@ -274,7 +273,7 @@ declare function query:text-sources($doc as document-node()) as element()* {

(:~
: Get the normalized date for a document
: (needed for core:sortColl() as well as norm:get-norm-doc())
: NB: This should be aligned with the function `facets:normalize-date()` from the WeGA-data facets module!
:
: @author Peter Stadler
: @param $doc the TEI document
Expand Down Expand Up @@ -336,13 +335,29 @@ declare function query:get-facets($collection as node()*, $facet as xs:string) a
default return ()
};

(:~
: Compute correspondence partners
: For each correspondent (addressees and senders) of $id
: the sum of incoming and outgoing correspondence will be computed
:
: @param $id the person ID for which to compute the partners
: @return a map object with all correspondence partner IDs and the respective weights,
: e.g. map {"A000915": 2, "A008673": 57}
:)
declare function query:correspondence-partners($id as xs:string) as map(*) {
map:merge(
for $i in (norm:get-norm-doc('letters')//norm:entry[contains(@addresseeID, $id)] | norm:get-norm-doc('letters')//norm:entry[contains(@authorID, $id)])/(@authorID, @addresseeID)/tokenize(., '\s+')
group by $partnerID := data($i)
return
map:entry($partnerID, count($i))
)
let $id-as-sender := map { "facets": map { "sender": $id } }
let $id-as-addressee := map { "facets": map { "addressee": $id } }
let $result1 := crud:data-collection('letters')/tei:TEI[ft:query(., (), $id-as-sender)]
let $facets1 := ft:facets($result1, "addressee", ())
let $result2 := crud:data-collection('letters')/tei:TEI[ft:query(., (), $id-as-addressee)]
let $facets2 := ft:facets($result2, "sender", ())
return
map:merge((
$facets2,
map:for-each($facets1, function($label, $count) {
map:entry($label, sum(($count, $facets2($label))))
})
))
};

(:~
Expand Down