Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fontane-notizbuecher
SADE
Commits
896d9217
Commit
896d9217
authored
Oct 17, 2019
by
mrodzis
🌿
Browse files
Merge branch 'bugfix/failing-tests' into 'develop'
Bugfix/failing tests Closes
#117
and
#116
See merge request
!52
parents
765be049
e27376cf
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
modules/fontane/index-api.xqm
View file @
896d9217
...
...
@@ -20,8 +20,6 @@ import module namespace config="http://textgrid.de/ns/SADE/config" at "../config
import module namespace ixp="http://fontane-nb.dariah.eu/index-processor" at "index-processor.xqm";
import module namespace rest="http://exquery.org/ns/restxq";
declare variable $index:dataPath := "/db/sade-projects/textgrid/data/xml/data";
(:~
: resolves and lists all references on a given page based on their index data
:
...
...
@@ -58,14 +56,14 @@ declare
function index:entites-per-page($uri as xs:string, $surface as xs:string)
as element(xhtml:ul)* {
let $docpath := $i
nde
x:dataPath ||
"/" ||
$uri || ".xml"
let $docpath := $ix
p
:dataPath || $uri || ".xml"
let $surface := tokenize($surface, "-")
(: test for document available :)
return
if(not(doc-available($docpath)))
then
let $docsInDb :=
collection($index:dataPath)
//tei:sourceDoc
let $docsInDb :=
$ixp:dataCollection
//tei:sourceDoc
/replace(base-uri(), "\.xml|/|db|sade-projects|textgrid|data|xml", "")
=> string-join(", ")
return
...
...
@@ -101,7 +99,7 @@ return
element xhtml:ul {
for $entity in $entities[substring-before(., ":") = $group]
let $ref := substring-after($entity, ":")
let $index := (
collection($index:dataPath)
/id($ref))[1]
let $index := (
$ixp:dataCollection
/id($ref))[1]
let $name := string($index/*[1])
let $list := index:get-list-by-id($ref)
let $href := "register.html?e=" || $ref
...
...
@@ -159,7 +157,7 @@ declare
function index:get-list-by-id($id as xs:string)
as xs:string {
let $entity :=
collection($index:dataPath)
/id($id)[ not(. instance of element(tei:handNote) ) ]
let $entity :=
$ixp:dataCollection
/id($id)[ not(. instance of element(tei:handNote) ) ]
let $test := if($entity[2]) then error(QName("FONTANE", "INDEX-API3"), "Entity »" || $id || "« has more then one occurence." ) else ()
return
switch ( $entity/local-name() )
...
...
@@ -214,7 +212,7 @@ declare
%test:assertTrue
function index:rendered-entity($id as xs:string)
as item()* {
let $node :=
collection($index:dataPath)
/id($id)
let $node :=
$ixp:dataCollection
/id($id)
let $type := $node/root()//tei:body/*[1]/local-name()
(: listEvent, listPlace, listOrg, listPerson or list :)
return
...
...
@@ -252,6 +250,7 @@ declare
%test:name("simple search")
%test:arg("query", "Dom Karlos")
%test:arg("index", "listEvent,listOrg,listPerson,listPlace,list-works,list-Fontane,list-periodicals")
%test:assertXPath("array:size($result) = 2")
function index:search($query as xs:string, $index)
...
...
@@ -261,12 +260,12 @@ return if(string-length($query) lt 2) then () else
let $prepare := tokenize($index, ",")
let $hits :=
(
collection($index:dataPath)
//tei:person[contains(tei:persName, $query)],
collection($index:dataPath)
//tei:personGrp[contains(tei:persName, $query)],
collection($index:dataPath)
//tei:place[contains(tei:placeName, $query)],
collection($index:dataPath)
//tei:org[contains(tei:orgName, $query)],
collection($index:dataPath)
//tei:event[contains(tei:label, $query)],
collection($index:dataPath)
//tei:item[tei:name/contains(., $query) = true()]
$ixp:dataCollection
//tei:person[contains(tei:persName, $query)],
$ixp:dataCollection
//tei:personGrp[contains(tei:persName, $query)],
$ixp:dataCollection
//tei:place[contains(tei:placeName, $query)],
$ixp:dataCollection
//tei:org[contains(tei:orgName, $query)],
$ixp:dataCollection
//tei:event[contains(tei:label, $query)],
$ixp:dataCollection
//tei:item[tei:name/contains(., $query) = true()]
)
return
array{
...
...
@@ -300,9 +299,9 @@ declare
%test:arg("id", "Arnoldi-Denkmal")
%test:arg("type", "plc")
%test:assert
True
%test:assert
XPath("$result?1 => exists()")
function index:rendered-entity($type as xs:string, $id as xs:string)
as
item()*
{
as
array(*)
{
let $request :=
<hc:request
method="get"
...
...
modules/fontane/index-processor.xqm
View file @
896d9217
...
...
@@ -32,6 +32,7 @@ declare variable $ixp:notebookParam := try {request:get-parameter('nb', '')} cat
declare variable $ixp:getNotebook := $ixp:targetStart || $ixp:notebookParam;
declare variable $ixp:dataCollection := collection($config:data-root || "/data");
declare variable $ixp:dataPath := '/db/sade-projects/textgrid/data/xml/data/';
(:~
: Helper function to collect all main nodes from the index files.
...
...
modules/fontane/misc.xqm
View file @
896d9217
...
...
@@ -12,7 +12,7 @@ declare variable $f-misc:metadata-collection := collection("/db/sade-projects/t
declare
%test:arg("baseUri","textgrid:16b00") %test:assertEquals("Notizbuch C7")
%test:arg("baseUri","") %test:assertE
quals("")
%test:arg("baseUri","") %test:assertE
mpty
function f-misc:get-title-by-baseUri($baseUri as xs:string)
as xs:string? {
if($baseUri = "") then () else
...
...
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