From 2bafe8e39a52ac0bfd0e6715c7d168680c326a35 Mon Sep 17 00:00:00 2001 From: Winona Salesky Date: Thu, 15 Aug 2024 17:14:10 -0400 Subject: [PATCH 1/4] Updates for CBSS search #102 --- modules/lib/data.xqm | 4 +- modules/lib/facets.xql | 61 +++++++++--------- modules/search/bibl-search.xqm | 39 ++++++------ repo-config.xml | 2 +- zotero2bibl/getLocalJSONdata.xql | 106 +++++++++++++++++++++++++++++++ zotero2bibl/zotero2tei.xqm | 37 +++++------ 6 files changed, 176 insertions(+), 73 deletions(-) create mode 100644 zotero2bibl/getLocalJSONdata.xql diff --git a/modules/lib/data.xqm b/modules/lib/data.xqm index f0892db..c2204d4 100644 --- a/modules/lib/data.xqm +++ b/modules/lib/data.xqm @@ -514,10 +514,10 @@ declare function data:dynamic-paths($search-config as xs:string?){ declare function data:keyword-search(){ if(request:get-parameter('keyword', '') != '') then for $query in request:get-parameter('keyword', '') - return concat("[ft:query(descendant-or-self::tei:body,'",data:clean-string($query),"',sf:facet-query()) or ft:query(ancestor::tei:TEI/descendant::tei:teiHeader,'",data:clean-string($query),"',sf:facet-query())]") + return concat("[ft:query(.,'",data:clean-string($query),"',sf:facet-query())]") else if(request:get-parameter('q', '') != '') then for $query in request:get-parameter('q', '') - return concat("[ft:query(descendant-or-self::tei:body,'",data:clean-string($query),"',sf:facet-query()) or ft:query(ancestor::tei:TEI/descendant::tei:teiHeader,'",data:clean-string($query),"',sf:facet-query())]") + return concat("[ft:query(.,'",data:clean-string($query),"',sf:facet-query())]") else () }; diff --git a/modules/lib/facets.xql b/modules/lib/facets.xql index b161dec..106cb7d 100644 --- a/modules/lib/facets.xql +++ b/modules/lib/facets.xql @@ -50,7 +50,7 @@ declare function sf:build-index(){ - + { let $facets := for $f in collection($config:app-root)//facet:facet-definition @@ -58,14 +58,14 @@ declare function sf:build-index(){ group by $facet-grp := $f/@name return if($f[1]/facet:group-by/@function != '') then - (, - ) + ((:, + :)) else if($f[1]/facet:range) then - (, - ) + ((:, + :)) else - (, - ) + ((:, + :)) return $facets } @@ -82,11 +82,11 @@ declare function sf:build-index(){ } } else - ( , - , - , - , - ) + (, + , + , + , + ) } @@ -100,6 +100,9 @@ declare function sf:build-index(){ + + + @@ -571,7 +574,7 @@ declare function sf:field-title($element as item()*, $name as xs:string){ : TEI idno field, specific to Srophe applications :) declare function sf:field-idno($element as item()*, $name as xs:string){ - replace($element/ancestor-or-self::tei:TEI/descendant::tei:publicationStmt/tei:idno[@type="URI"][1],'/tei','') + replace($element/descendant::tei:publicationStmt/tei:idno[@type="URI"][1],'/tei','') }; (:~ @@ -662,31 +665,31 @@ declare function sf:field-titleTransliteration($element as item()*, $name as xs: (: Title Facet :) declare function sf:facet-title($element as item()*, $facet-definition as item(), $name as xs:string){ - if($element/ancestor-or-self::tei:TEI/descendant::tei:biblStruct) then - $element/ancestor-or-self::tei:TEI/descendant::tei:biblStruct/descendant::tei:title - else $element/ancestor-or-self::tei:TEI/descendant::tei:titleStmt/tei:title + if($element/descendant::tei:biblStruct) then + $element/descendant::tei:biblStruct/descendant::tei:title + else $element/descendant::tei:titleStmt/tei:title }; (: Author field :) declare function sf:field-author($element as item()*, $name as xs:string){ - if($element/ancestor-or-self::tei:TEI/descendant::tei:biblStruct) then - if($element/ancestor-or-self::tei:TEI/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:surname) then - concat($element/ancestor-or-self::tei:TEI/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:surname, ',', - $element/ancestor-or-self::tei:TEI/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:forename) - else if($element/ancestor-or-self::tei:TEI/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:editor[1]/descendant-or-self::tei:surname) then - concat($element/ancestor-or-self::tei:TEI/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:surname, ',', - $element/ancestor-or-self::tei:TEI/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:forename) - else $element/ancestor-or-self::tei:TEI/descendant::tei:biblStruct/descendant::tei:author - else $element/ancestor-or-self::tei:TEI/descendant::tei:titleStmt/descendant::tei:author + if($element/descendant::tei:biblStruct) then + if($element/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:surname) then + concat($element/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:surname, ',', + $element/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:forename) + else if($element/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:editor[1]/descendant-or-self::tei:surname) then + concat($element/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:surname, ',', + $element/descendant::tei:body/tei:biblStruct/descendant-or-self::tei:author[1]/descendant-or-self::tei:forename) + else $element/descendant::tei:biblStruct/descendant::tei:author + else $element/descendant::tei:titleStmt/descendant::tei:author }; (:~ : TEI author facet, specific to Srophe applications :) declare function sf:facet-authors($element as item()*, $facet-definition as item(), $name as xs:string){ - if($element/ancestor-or-self::tei:TEI/descendant::tei:biblStruct) then - $element/ancestor-or-self::tei:TEI/descendant::tei:biblStruct/descendant::tei:author | $element/ancestor-or-self::tei:TEI/descendant::tei:biblStruct/descendant::tei:editor - else $element/ancestor-or-self::tei:TEI/descendant::tei:titleStmt/descendant::tei:author + if($element/descendant::tei:biblStruct) then + $element/descendant::tei:biblStruct/descendant::tei:author | $element/descendant::tei:biblStruct/descendant::tei:editor + else $element/descendant::tei:titleStmt/descendant::tei:author }; (:~ @@ -707,7 +710,7 @@ declare function sf:facet-cbssPubType($element as item()*, $facet-definition as else if($value = 'journalArticle') then 'Journal Article' else if($value = 'bookSection') then 'Book Section' else if($value = 'thesis') then 'Thesis' - else () + else $value }; (: diff --git a/modules/search/bibl-search.xqm b/modules/search/bibl-search.xqm index 9e938aa..a039704 100644 --- a/modules/search/bibl-search.xqm +++ b/modules/search/bibl-search.xqm @@ -24,12 +24,12 @@ declare variable $bibls:abstract {request:get-parameter('abstract', '')}; declare variable $bibls:keywordSearch {request:get-parameter('keywordSearch', '')}; declare function bibls:title() as xs:string? { - if($bibls:title != '') then concat("[ft:query(descendant::tei:title,'",data:clean-string($bibls:title),"',sf:facet())]") + if($bibls:title != '') then concat("[ft:query(descendant::tei:title,'",data:clean-string($bibls:title),"',sf:facet-query())]") else () }; declare function bibls:author() as xs:string? { - if($bibls:author != '') then concat("[ft:query(descendant::tei:author,'",data:clean-string($bibls:author),"',sf:facet()) or ft:query(descendant::tei:editor,'",data:clean-string($bibls:author),"',sf:facet())]") + if($bibls:author != '') then concat("[ft:query(descendant::tei:author,'",data:clean-string($bibls:author),"',sf:facet-query()) or ft:query(descendant::tei:editor,'",data:clean-string($bibls:author),"',sf:facet-query())]") else () }; @@ -54,13 +54,13 @@ declare function bibls:idno() as xs:string? { declare function bibls:pub-place() as xs:string? { if($bibls:pub-place != '') then - concat("[ft:query(descendant::tei:imprint/tei:pubPlace,'",data:clean-string($bibls:pub-place),"',sf:facet())]") + concat("[descendant::tei:pubPlace[ft:query(.,'",data:clean-string($bibls:pub-place),"',sf:facet-query())]]") else () }; declare function bibls:publisher() as xs:string? { if($bibls:publisher != '') then - concat("[ft:query(descendant::tei:imprint/tei:publisher,'",data:clean-string($bibls:publisher),"',sf:facet())]") + concat("[descendant::tei:publisher[ft:query(.,'",data:clean-string($bibls:publisher),"',sf:facet-query())]]") else () }; @@ -83,14 +83,14 @@ declare function bibls:bibl() as xs:string?{ }; declare function bibls:abstract() as xs:string? { - if($bibls:pub-place != '') then - concat("[ft:query(descendant::biblStruct/tei:note[@type='abstract'],'",data:clean-string($bibls:abstract),"',sf:facet())]") + if($bibls:abstract != '') then + concat("[descendant::tei:note[ft:query(.,'",data:clean-string($bibls:abstract),"',sf:facet-query())][@type='abstract']]") else () }; declare function bibls:keywordSearch() as xs:string? { if($bibls:keywordSearch != '') then - concat("[ft:query(descendant::tei:listRelation/tei:relation[@type='subject']/tei:desc,'",data:clean-string($bibls:keywordSearch),"',sf:facet())]") + concat("[descendant::tei:desc[ft:query(.,'",data:clean-string($bibls:keywordSearch),"',sf:facet-query())][parent::tei:relation]]") else () }; @@ -98,17 +98,17 @@ declare function bibls:limits() as xs:string? { let $limits := string-join( ( - if(request:get-parameter('bookLimit', '') != 'true') then - "descendant::tei:biblStruct[@type != 'book']" + if(request:get-parameter('bookLimit', '') = 'true') then + "descendant::tei:biblStruct[@type = 'book']" else(), - if(request:get-parameter('journalArticleLimit', '') != 'true') then - "descendant::tei:biblStruct[@type != 'journalArticle']" + if(request:get-parameter('journalArticleLimit', '') = 'true') then + "descendant::tei:biblStruct[@type = 'journalArticle']" else(), - if(request:get-parameter('bookSectionLimit', '') != 'true') then - "descendant::tei:biblStruct[@type != 'bookSection']" + if(request:get-parameter('bookSectionLimit', '') = 'true') then + "descendant::tei:biblStruct[@type = 'bookSection']" else(), - if(request:get-parameter('thesisLimit', '') != 'true') then - "descendant::tei:biblStruct[@type != 'thesis']" + if(request:get-parameter('thesisLimit', '') = 'true') then + "descendant::tei:biblStruct[@type = 'thesis']" else() ),' or ') return @@ -124,7 +124,7 @@ declare function bibls:query-string() as xs:string? { if($bibls:subject != '') then bibls:subject() else if(request:get-parameter('bibl', '')) then bibls:bibl() else - concat("collection('",$config:data-root,"/bibl/tei')//tei:body", + concat("collection('",$config:data-root,"/bibl/tei')//tei:TEI", data:keyword-search(), bibls:abstract(), bibls:keywordSearch(), @@ -180,12 +180,13 @@ declare function bibls:search-form() {
-
- +
+
{global:keyboard-select-menu('keywordSearch')}
-
+
+
diff --git a/repo-config.xml b/repo-config.xml index 23c0c15..3bb53c8 100644 --- a/repo-config.xml +++ b/repo-config.xml @@ -74,7 +74,7 @@ - + diff --git a/zotero2bibl/getLocalJSONdata.xql b/zotero2bibl/getLocalJSONdata.xql new file mode 100644 index 0000000..146842b --- /dev/null +++ b/zotero2bibl/getLocalJSONdata.xql @@ -0,0 +1,106 @@ +xquery version "3.1"; +(:~ + : XQuery Zotero integration + : Queries Zotero API : https://api.zotero.org + : Checks for updates since last modified version using Zotero Last-Modified-Version header + : Converts Zotero records to Syriaca.org TEI using zotero2tei.xqm + : Adds new records to directory. + : + : To be done: + : Submit to Perseids +:) + +import module namespace http="http://expath.org/ns/http-client"; +import module namespace zotero2tei="http://syriaca.org/zotero2tei" at "zotero2tei.xqm"; +import module namespace console="http://exist-db.org/xquery/console"; +declare namespace tei="http://www.tei-c.org/ns/1.0"; +declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization"; + +declare variable $zotero-api := 'https://api.zotero.org'; + +(: Access zotero-api configuration file :) +declare variable $zotero-config := doc('zotero-config.xml'); +(: Zotero group id :) +declare variable $groupid := $zotero-config//groupid/text(); +(: Zotero last modified version, to check for updates. :) +declare variable $last-modified-version := $zotero-config//last-modified-version/text(); +(: Directory bibl data is stored in :) +declare variable $data-dir := $zotero-config//data-dir/text(); +(: Local URI pattern for bibl records :) +declare variable $base-uri := $zotero-config//base-uri/text(); +(: Format defaults to tei :) +declare variable $format := if($zotero-config//format/text() != '') then $zotero-config//format/text() else 'tei'; + +(:~ + : Convert records to Syriaca.org compliant TEI records, using zotero2tei.xqm + : Save records to the database. + : @param $record + : @param $index-number + : @param $format +:) +declare function local:process-records($record as item()?, $format as xs:string?){ + let $idNumber := tokenize($record?key,'/')[last()] + let $file-name := concat($idNumber,'.xml') + let $new-record := zotero2tei:build-new-record($record, $idNumber, $format) + return + if($idNumber != '') then + try {xmldb:store($data-dir, xmldb:encode-uri($file-name), $new-record)} catch *{ + + Failed to add resource {$file-name}: {concat($err:code, ": ", $err:description), console:log(concat($err:code, ": ", $err:description))} + + } + else () +}; + +(:~ + : Get and process Zotero data. +:) +declare function local:get-zotero(){ +
{ + for $r in uri-collection('/db/apps/syriaca-data/cbss/data') + let $doc := json-doc($r) + for $rec in $doc?* + where not(exists($rec?data?parentItem)) + return local:process-records($rec,'json') + }
+}; + +(: Helper function to recursively create a collection hierarchy. :) +declare function local:mkcol-recursive($collection, $components) { + if (exists($components)) then + let $newColl := concat($collection, "/", $components[1]) + return ( + xmldb:create-collection($collection, $components[1]), + local:mkcol-recursive($newColl, subsequence($components, 2)) + ) + else () +}; + +(: Helper function to recursively create a collection hierarchy. :) +declare function local:mkcol($collection, $path) { + local:mkcol-recursive($collection, tokenize($path, "/")) +}; + +(:~ + : Check action parameter, if empty, return contents of config.xml + : If $action is not empty, check for specified collection, create if it does not exist. + : Run Zotero request. +:) +if(request:get-parameter('action', '') = 'update') then + if(xmldb:collection-available($data-dir)) then + local:get-zotero() + else (local:mkcol("/db/apps", replace($data-dir,'/db/apps','')),local:get-zotero()) +else if(request:get-parameter('action', '') = 'initiate') then + if(request:get-parameter('start', '') != '' and xmldb:collection-available($data-dir)) then + local:get-zotero() + else if((request:get-parameter('start', '') = '0' or request:get-parameter('start', '') = '1') and xmldb:collection-available($data-dir)) then + local:get-zotero() + else if(xmldb:collection-available($data-dir)) then + (xmldb:remove($data-dir),local:mkcol("/db/apps", replace($data-dir,'/db/apps','')),local:get-zotero()) + else (local:mkcol("/db/apps", replace($data-dir,'/db/apps','')),local:get-zotero()) +else +
+

{$groupid}

+

{$last-modified-version}

+

{$data-dir}

+
\ No newline at end of file diff --git a/zotero2bibl/zotero2tei.xqm b/zotero2bibl/zotero2tei.xqm index 0bd7661..908b7ab 100644 --- a/zotero2bibl/zotero2tei.xqm +++ b/zotero2bibl/zotero2tei.xqm @@ -380,13 +380,19 @@ let $imprint := if (empty($rec?data?place) and empty($rec?data?publisher) and em if ($rec?data?date) then ({$rec?data?date}) else () }) (: Transforming tags to relation... if no subject or ms s present, still shows , I have to fix that :) -let $list-relations := if (empty($rec?data?tags) or empty($rec?data?relations)) then () else ({( +let $list-relations := if(empty($rec?data?tags) or empty($rec?data?relations)) then () else ({( for $tag in $rec?data?tags?*?tag + let $type := replace($tag,'^\s*(.+?):\s*.*','$1') return - if (matches($tag,'^\s*(MS|Subject|Part|Section|Book|Provenance|Source|Translator):\s*')) then ( - element relation { + element relation { + ( + attribute active {$local-uri}, + attribute ref {"dc:subject"}, + element desc {$tag} + ) + } + (:element relation { attribute active {$local-uri}, - if (matches($tag,'^\s*(Subject|Part|Section|Book|Provenance|Source|Translator):\s*')) then ( let $type := replace($tag,'^\s*(.+?):\s*.*','$1') return (attribute ref {"dc:subject"}, @@ -394,24 +400,8 @@ let $list-relations := if (empty($rec?data?tags) or empty($rec?data?relations)) attribute type {lower-case($type)} else(), element desc {substring-after($tag,concat($type,": "))} - )) else (), - if (matches($tag,'^\s*MS:\s*')) then ( - attribute ref{"dcterms:references"}, - element desc { - element msDesc { - element msIdentifier { - element settlement {normalize-space(tokenize(substring-after($tag,"MS: "),",")[1])}, - element collection {normalize-space(tokenize(substring-after($tag,"MS: "),",")[2])}, - element idno { - attribute type {"shelfmark"}, - normalize-space(replace($tag,"MS:.*?,.*?,","")) - } - } - } - } - ) else () - } - ) else (), + }:) + , let $relations := $rec?data?relations let $rec := $local-uri let $zotero-url := concat('http://zotero.org/groups/',$zotero2tei:groupid,'/items') @@ -645,6 +635,9 @@ return + {if($itemType != '') then + attribute type {$itemType} + else ()} {$tei-analytic} {$tei-monogr} {$tei-series} From 5a01e49aad762b1df8fca10bea370d13cc4fed3e Mon Sep 17 00:00:00 2001 From: Winona Salesky Date: Tue, 20 Aug 2024 15:08:25 -0400 Subject: [PATCH 2/4] Fix positioning in logo/nav --- resources/css/cbsc.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/css/cbsc.css b/resources/css/cbsc.css index f3a4059..be90535 100644 --- a/resources/css/cbsc.css +++ b/resources/css/cbsc.css @@ -25,6 +25,15 @@ margin-left:1em; margin-top:100px; } +.navbar-brand .cbsc-logo{ + display:inline-block; + margin-top:.5em; +} +.navbar-brand .banner-text { + display:inline-block; + margin-left:.5em; + margin-top:.5em; +} h1.cbsc-logo { margin-top:120px; padding-bottom:0; From 94feb0507cdf81bab205a92e9512b534544645ca Mon Sep 17 00:00:00 2001 From: Winona Salesky Date: Tue, 27 Aug 2024 16:33:11 -0400 Subject: [PATCH 3/4] Updates for CBSS search --- cbss/facet-def.xml | 2 +- modules/lib/data.xqm | 34 +++++++++++++++++----------------- modules/search/bibl-search.xqm | 12 ++++++------ resources/xsl/tei2html.xsl | 4 +++- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/cbss/facet-def.xml b/cbss/facet-def.xml index a3dc7b0..a49b0bb 100644 --- a/cbss/facet-def.xml +++ b/cbss/facet-def.xml @@ -24,7 +24,7 @@ --> - descendant::tei:relation[@type="subject"] + descendant::tei:relation[@ref="dc:subject"] 40 value diff --git a/modules/lib/data.xqm b/modules/lib/data.xqm index c2204d4..d0fc339 100644 --- a/modules/lib/data.xqm +++ b/modules/lib/data.xqm @@ -132,13 +132,13 @@ declare function data:get-records($collection as xs:string*, $element as xs:stri if(request:get-parameter('sort', '') != '') then request:get-parameter('sort', '') else if(request:get-parameter('sort-element', '') != '') then request:get-parameter('sort-element', '')[1] else () - let $hits := util:eval(data:build-collection-path($collection))[descendant::tei:body[ft:query(., (),sf:facet-query())]] + let $hits := util:eval(data:build-collection-path($collection))[ft:query(., (),sf:facet-query())] return if(request:get-parameter('view', '') = 'map') then $hits else if(request:get-parameter('view', '') = 'timeline') then $hits else if($collection = 'bibl') then for $hit in $hits - let $s := + let $s := if(contains($sort, 'author')) then ft:field($hit, "author")[1] else if(contains($sort, 'title') or contains($sort, 'headword')) then if(request:get-parameter('lang', '') = 'syr') then ft:field($hit, "titleSyriac")[1] @@ -155,8 +155,8 @@ declare function data:get-records($collection as xs:string*, $element as xs:stri else if(request:get-parameter('lang', '') = 'fr') then ft:field($hit, "titleFrench")[1] else if(request:get-parameter('lang', '') = 'en-x-gedsh') then ft:field($hit, "titleTransliteration")[1] else ft:field($hit, "author")[1] - order by $s[1] collation 'http://www.w3.org/2013/collation/UCA' - where + order by $s[1] collation 'http://www.w3.org/2013/collation/UCA' + where if(request:get-parameter('view', '') = 'A-Z') then (matches($s,'\p{IsBasicLatin}|\p{IsLatin-1Supplement}|\p{IsLatinExtended-A}|\p{IsLatinExtended-B}','i') and matches($s,global:get-alpha-filter())) else if(request:get-parameter('view', '') = 'ܐ-ܬ') then @@ -165,8 +165,8 @@ declare function data:get-records($collection as xs:string*, $element as xs:stri (matches($s,'\p{IsArabic}','i')) else if(request:get-parameter('view', '') = 'other') then not(matches(substring(global:build-sort-string($s,''),1,1),'\p{IsSyriac}|\p{IsArabic}|\p{IsBasicLatin}|\p{IsLatin-1Supplement}|\p{IsLatinExtended-A}|\p{IsLatinExtended-B}|\p{IsLatinExtendedAdditional}','i')) - else matches($s,global:get-alpha-filter()) - return $hit/ancestor-or-self::tei:TEI + else matches($s[1],global:get-alpha-filter()) + return $hit else if(request:get-parameter('alpha-filter', '') != '' and request:get-parameter('alpha-filter', '') != 'All' and request:get-parameter('alpha-filter', '') != 'ALL' @@ -238,7 +238,7 @@ declare function data:search($collection as xs:string*, $queryString as xs:strin if($params != '') then if($queryString != '') then if(ends-with($queryString,'//tei:body')) then () - else util:eval($queryString) + else util:eval($queryString)[ft:query(., (),sf:facet-query())] else if(data:create-query($collection) != '') then util:eval(concat(data:build-collection-path($collection), data:create-query($collection),slider:date-filter(()))) else () @@ -282,7 +282,7 @@ declare function data:apiSearch($collection as xs:string*, $element as xs:string return concat("/descendant::tei:",$element,"[ft:query(.,'",data:clean-string($queryString),"',data:search-options())]") else () let $eval-string := concat(data:build-collection-path($collection), $elementSearch) - let $hits := util:eval($eval-string) + let $hits := util:eval($eval-string)[ft:query(., (),sf:facet-query())] let $sort := if($sort-element != '') then $sort-element[1] else if(request:get-parameter('sort', '') != '') then @@ -501,9 +501,9 @@ declare function data:dynamic-paths($search-config as xs:string?){ if($p = 'keyword') then data:keyword-search() else if(string($config//input[@name = $p]/@element) = '.') then - concat("[ft:query(descendant-or-self::tei:body,'",data:clean-string(request:get-parameter($p, '')),"',sf:facet-query())]") + concat("[ft:query(descendant-or-self::tei:body,'",data:clean-string(request:get-parameter($p, '')),"')]") else if(string($config//input[@name = $p]/@element) != '') then - concat("[ft:query(descendant-or-self::",string($config//input[@name = $p]/@element),",'",data:clean-string(request:get-parameter($p, '')),"',sf:facet-query())]") + concat("[ft:query(descendant-or-self::",string($config//input[@name = $p]/@element),",'",data:clean-string(request:get-parameter($p, '')),"')]") else () else (),'') }; @@ -514,10 +514,10 @@ declare function data:dynamic-paths($search-config as xs:string?){ declare function data:keyword-search(){ if(request:get-parameter('keyword', '') != '') then for $query in request:get-parameter('keyword', '') - return concat("[ft:query(.,'",data:clean-string($query),"',sf:facet-query())]") + return concat("[ft:query(.,'",data:clean-string($query),"')]") else if(request:get-parameter('q', '') != '') then for $query in request:get-parameter('q', '') - return concat("[ft:query(.,'",data:clean-string($query),"',sf:facet-query())]") + return concat("[ft:query(.,'",data:clean-string($query),"')]") else () }; @@ -541,7 +541,7 @@ declare function data:uri() as xs:string? { let $q := request:get-parameter('uri', '') return concat(" - [ft:query(descendant::*,'"",$q,""',sf:facet-query()) or + [ft:query(descendant::*,'"",$q,""') or .//@passive[matches(.,'",$q,"(\W.*)?$')] or .//@mutual[matches(.,'",$q,"(\W.*)?$')] @@ -564,7 +564,7 @@ declare function data:element-search($element, $query){ if(exists($element) and $element != '') then if(request:get-parameter($element, '') != '') then for $e in $element - return concat("[ft:query(descendant-or-self::tei:",$element,",'",data:clean-string($query),"',sf:facet-query())]") + return concat("[ft:query(descendant-or-self::tei:",$element,",'",data:clean-string($query),"')]") else () else () }; @@ -600,7 +600,7 @@ declare function data:related-places() as xs:string?{ normalize-space($related-place) else string-join(distinct-values( - for $r in collection($config:data-root || '/places')//tei:place[ft:query(tei:placeName,$related-place,sf:facet-query())] + for $r in collection($config:data-root || '/places')//tei:place[ft:query(tei:placeName,$related-place)] let $id := $r//tei:idno[starts-with(.,'http://syriaca.org')] return $id),'|') return @@ -629,7 +629,7 @@ declare function data:related-persons() as xs:string?{ normalize-space($rel-person) else string-join(distinct-values( - for $r in collection($config:data-root || '/persons')//tei:person[ft:query(tei:persName,$rel-person,sf:facet-query())] + for $r in collection($config:data-root || '/persons')//tei:person[ft:query(tei:persName,$rel-person)] let $id := $r//tei:idno[starts-with(.,'http://syriaca.org')] return $id),'|') return @@ -650,6 +650,6 @@ declare function data:mentioned() as xs:string?{ let $id := normalize-space(request:get-parameter('mentioned', '')) return concat("[descendant::*[@ref[matches(.,'",$id,"(\W.*)?$')]]]") else - concat("[descendant::*[ft:query(tei:title,'",data:clean-string(request:get-parameter('mentioned', '')),"',sf:facet-query())]]") + concat("[descendant::*[ft:query(tei:title,'",data:clean-string(request:get-parameter('mentioned', '')),"')]]") else () }; \ No newline at end of file diff --git a/modules/search/bibl-search.xqm b/modules/search/bibl-search.xqm index a039704..c685267 100644 --- a/modules/search/bibl-search.xqm +++ b/modules/search/bibl-search.xqm @@ -24,12 +24,12 @@ declare variable $bibls:abstract {request:get-parameter('abstract', '')}; declare variable $bibls:keywordSearch {request:get-parameter('keywordSearch', '')}; declare function bibls:title() as xs:string? { - if($bibls:title != '') then concat("[ft:query(descendant::tei:title,'",data:clean-string($bibls:title),"',sf:facet-query())]") + if($bibls:title != '') then concat("[ft:query(descendant::tei:title,'",data:clean-string($bibls:title),"')]") else () }; declare function bibls:author() as xs:string? { - if($bibls:author != '') then concat("[ft:query(descendant::tei:author,'",data:clean-string($bibls:author),"',sf:facet-query()) or ft:query(descendant::tei:editor,'",data:clean-string($bibls:author),"',sf:facet-query())]") + if($bibls:author != '') then concat("[ft:query(descendant::tei:author,'",data:clean-string($bibls:author),"') or ft:query(descendant::tei:editor,'",data:clean-string($bibls:author),"')]") else () }; @@ -54,13 +54,13 @@ declare function bibls:idno() as xs:string? { declare function bibls:pub-place() as xs:string? { if($bibls:pub-place != '') then - concat("[descendant::tei:pubPlace[ft:query(.,'",data:clean-string($bibls:pub-place),"',sf:facet-query())]]") + concat("[descendant::tei:pubPlace[ft:query(.,'",data:clean-string($bibls:pub-place),"')]]") else () }; declare function bibls:publisher() as xs:string? { if($bibls:publisher != '') then - concat("[descendant::tei:publisher[ft:query(.,'",data:clean-string($bibls:publisher),"',sf:facet-query())]]") + concat("[descendant::tei:publisher[ft:query(.,'",data:clean-string($bibls:publisher),"')]]") else () }; @@ -84,13 +84,13 @@ declare function bibls:bibl() as xs:string?{ declare function bibls:abstract() as xs:string? { if($bibls:abstract != '') then - concat("[descendant::tei:note[ft:query(.,'",data:clean-string($bibls:abstract),"',sf:facet-query())][@type='abstract']]") + concat("[descendant::tei:note[ft:query(.,'",data:clean-string($bibls:abstract),"')][@type='abstract']]") else () }; declare function bibls:keywordSearch() as xs:string? { if($bibls:keywordSearch != '') then - concat("[descendant::tei:desc[ft:query(.,'",data:clean-string($bibls:keywordSearch),"',sf:facet-query())][parent::tei:relation]]") + concat("[descendant::tei:desc[ft:query(.,'",data:clean-string($bibls:keywordSearch),"')][parent::tei:relation]]") else () }; diff --git a/resources/xsl/tei2html.xsl b/resources/xsl/tei2html.xsl index d9fd493..e36202a 100644 --- a/resources/xsl/tei2html.xsl +++ b/resources/xsl/tei2html.xsl @@ -1369,7 +1369,8 @@ - + +
From 7d593f72f3d051210ae8df8e8dbbc6ead1abde75 Mon Sep 17 00:00:00 2001 From: Winona Salesky Date: Tue, 27 Aug 2024 16:38:52 -0400 Subject: [PATCH 4/4] Update browse and date slider. --- cbss/browse.html | 2 +- modules/lib/date-slider.xqm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cbss/browse.html b/cbss/browse.html index 2800272..d569887 100644 --- a/cbss/browse.html +++ b/cbss/browse.html @@ -2,7 +2,7 @@

-

Browse works cited by title

+

Browse works cited by author

diff --git a/modules/lib/date-slider.xqm b/modules/lib/date-slider.xqm index bbe7ff7..fd40999 100644 --- a/modules/lib/date-slider.xqm +++ b/modules/lib/date-slider.xqm @@ -161,8 +161,8 @@ if(not(empty($min)) and not(empty($max))) then else()}