Skip to content

Commit d7c3ba0

Browse files
committed
Final fixes to refactor.
1 parent cfceafe commit d7c3ba0

10 files changed

Lines changed: 100 additions & 63 deletions

File tree

documentation/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" data-template="templates:surround" data-template-with="templates/page.html" data-template-at="content">
2-
<h1 class="banner indent top-padding bhse">Digital Syriac Corpus Documentation</h1>
2+
<xi:include href="../banner.html"/>
3+
<h1 class="banner indent bhse">Digital Syriac Corpus Documentation</h1>
34
<div class="container documentation">
45
<div class="row">
56
<div class="col-md-4 col-md-offset-2">

documentation/wiki.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" data-template="templates:surround" data-template-with="templates/page.html" data-template-at="content">
2-
<h1 class="banner indent top-padding bhse">Digital Syriac Corpus Documentation</h1>
2+
<xi:include href="../banner.html"/>
3+
<h1 class="banner indent bhse">Digital Syriac Corpus Documentation</h1>
34
<div class="container">
45
<div class="container">
56
<div data-template="app:get-wiki">

expath-pkg.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<package xmlns="http://expath.org/ns/pkg" name="http://syriac-corpus.org/syriac-corpus" abbrev="syriac-corpus" version="3.00" spec="1.0">
2+
<package xmlns="http://expath.org/ns/pkg" name="http://syriac-corpus.org/syriac-corpus" abbrev="syriac-corpus" version="3.15" spec="1.0">
33
<title>Digital Syriac Corpus</title>
44
<!-- TEI data -->
55
<dependency package="http://syriac-corpus.org/syriaca-corpus-data"/>
6-
<!-- eXist shared resources -->
7-
<dependency package="http://exist-db.org/apps/shared"/>
8-
<!-- JSON Parser and Serializer for XQuery -->
9-
<dependency package="http://xqilla.sourceforge.net/pkg/xqjson"/>
10-
<!-- Functx -->
11-
<dependency package="http://www.functx.com"/>
126
</package>

modules/content-negotiation/tei2html.xqm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,10 @@ declare function tei2html:summary-view-generic($nodes as node()*, $id as xs:stri
386386
<span class="results-list-desc uri"><span class="srp-label">URI: </span><a href="{replace($id,$config:base-uri,$config:nav-base)}">{$id}</a></span>
387387
else()
388388
}
389-
</div>
389+
</div>
390390
};
391391

392+
392393
declare function tei2html:summary-view-bibl($nodes as node()*, $id as xs:string?) as item()* {
393394
let $title := if($nodes/descendant-or-self::tei:title[@syriaca-tags='#syriaca-headword'][@xml:lang='en']) then
394395
$nodes/descendant-or-self::tei:title[@syriaca-tags='#syriaca-headword'][@xml:lang='en'][1]/text()

modules/lib/facet.xqm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ return
276276
if($facet:fq) then concat('fq=',$facet:fq,$facet-query)
277277
else concat('fq=',normalize-space($facet-query))
278278
let $active := if(contains($facet:fq,concat(';fq-',string($f/@name),':',string($key/@value)))) then 'active' else ()
279-
return <a href="?{$new-fq}{facet:url-params()}" class="facet-label btn btn-default {$active}">{string($key/@label)} <span class="count"> ({string($key/@count)})</span></a>
279+
return <a href="?{$new-fq}{facet:url-params()}" class="facet-label btn btn-default {$active}">{string($key/@label)} <span class="count" dir="ltr"> ({string($key/@count)})</span></a>
280280
}
281281
</div>
282282
<div class="facet-list collapse" id="{concat('show',replace(string($f/@name),' ',''))}">{
@@ -285,7 +285,7 @@ return
285285
let $new-fq :=
286286
if($facet:fq) then concat('fq=',$facet:fq,$facet-query)
287287
else concat('fq=',$facet-query)
288-
return <a href="?{$new-fq}{facet:url-params()}" class="facet-label btn btn-default">{string($key/@label)} <span class="count"> ({string($key/@count)})</span></a>
288+
return <a href="?{$new-fq}{facet:url-params()}" class="facet-label btn btn-default">{string($key/@label)} <span class="count" dir="ltr"> ({string($key/@count)})</span></a>
289289
}
290290
</div>
291291
{if($count gt ($f/@show - 1)) then

modules/search/search.xqm

Lines changed: 66 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ declare namespace tei="http://www.tei-c.org/ns/1.0";
2323
(: Variables:)
2424
declare variable $search:start {request:get-parameter('start', 1) cast as xs:integer};
2525
declare variable $search:perpage {request:get-parameter('perpage', 20) cast as xs:integer};
26+
declare variable $search:q {request:get-parameter('q', '') cast as xs:string};
27+
declare variable $search:persName {request:get-parameter('persName', '') cast as xs:string};
28+
declare variable $search:placeName {request:get-parameter('placeName', '') cast as xs:string};
29+
declare variable $search:title {request:get-parameter('title', '') cast as xs:string};
30+
declare variable $search:bibl {request:get-parameter('bibl', '') cast as xs:string};
31+
declare variable $search:idno {request:get-parameter('uri', '') cast as xs:string};
32+
declare variable $search:sort-element {request:get-parameter('sort-element', '') cast as xs:string};
33+
declare variable $search:collection {request:get-parameter('collection', '') cast as xs:string};
2634

2735
(:~
2836
: Builds search result, saves to model("hits") for use in HTML display
@@ -32,7 +40,7 @@ declare variable $search:perpage {request:get-parameter('perpage', 20) cast as x
3240
: Search results stored in map for use by other HTML display functions
3341
data:search($collection)
3442
:)
35-
declare %templates:wrap function search:search-data($node as node(), $model as map(*), $collection as xs:string?){
43+
declare %templates:wrap function search:search-data($node as node(), $model as map(*), $collection as xs:string?, $view as xs:string?){
3644
let $coll := if($search:collection != '') then $search:collection else $collection
3745
let $keyword-query := data:keyword-search()
3846
let $eval-string := concat(search:query-string($collection),facet:facet-filter(global:facet-definition-file($collection)))
@@ -62,7 +70,7 @@ declare %templates:wrap function search:search-data($node as node(), $model as m
6270
: Builds general search string from main syriaca.org page and search api.
6371
:)
6472
declare function search:query-string($collection as xs:string?) as xs:string?{
65-
concat("collection('",$global:data-root,"')//tei:TEI",
73+
concat("collection('",$config:data-root,"')//tei:TEI",
6674
data:keyword-search(),
6775
data:element-search('author',request:get-parameter('author', '')),
6876
data:element-search('title',request:get-parameter('title', '')),
@@ -114,7 +122,7 @@ declare function search:bibl(){
114122
normalize-space($search:bibl)
115123
else
116124
string-join(distinct-values(
117-
for $r in collection($global:data-root || '/bibl')//tei:body[ft:query(.,$terms, data:search-options())]/ancestor::tei:TEI/descendant::tei:publicationStmt/tei:idno[starts-with(.,'http://syriaca.org')][1]
125+
for $r in collection($config:data-root || '/bibl')//tei:body[ft:query(.,$terms, data:search-options())]/ancestor::tei:TEI/descendant::tei:publicationStmt/tei:idno[starts-with(.,'http://syriaca.org')][1]
118126
return concat(substring-before($r,'/tei'),'(\s|$)')),'|')
119127
return concat("[descendant::tei:bibl/tei:ptr[@target[matches(.,'",$ids,"')]]]")
120128
else ()
@@ -129,7 +137,7 @@ declare function search:idno(){
129137
};
130138

131139
declare function search:catalog-limit(){
132-
for $r in collection($global:data-root)//tei:titleStmt/tei:title[@level="s"]
140+
for $r in collection($config:data-root)//tei:titleStmt/tei:title[@level="s"]
133141
group by $group := $r/@ref
134142
order by global:build-sort-string($r[1]/text(),'')
135143
return <option value="{concat(';fq-Catalog:',$group)}">{$r[1]/text()}</option>
@@ -161,11 +169,11 @@ function search:show-hits($node as node()*, $model as map(*), $collection as xs:
161169
</div>
162170
<div class="col-md-9" xml:lang="en">
163171
{(tei2html:summary-view($hit, (), $id[1])) }
164-
{(:
172+
{
165173
if($expanded//exist:match) then
166174
tei2html:output-kwic($expanded, $id)
167175
else ()
168-
:)()}
176+
}
169177
</div>
170178
</div>
171179
</div>
@@ -252,6 +260,7 @@ declare function search:build-form($search-config) {
252260
</form>
253261
};
254262

263+
255264
(:~
256265
: Simple default search form to us if not search-config.xml file is present. Can be customized.
257266
:)
@@ -293,30 +302,59 @@ declare function search:default-search-form() {
293302
</div>
294303
</div>
295304
</div>
296-
<!-- Title-->
297-
<div class="form-group">
298-
<label for="title" class="col-sm-2 col-md-3 control-label">Title: </label>
299-
<div class="col-sm-10 col-md-9 ">
300-
<div class="input-group">
301-
<input type="text" id="title" name="title" class="form-control keyboard"/>
302-
<div class="input-group-btn">
303-
{global:keyboard-select-menu('title')}
304-
</div>
305-
</div>
306-
</div>
305+
<!-- Author-->
306+
<div class="form-group">
307+
<label for="author" class="col-sm-2 col-md-3 control-label">Author: </label>
308+
<div class="col-sm-10 col-md-9 ">
309+
<div class="input-group">
310+
<input type="text" id="author" name="author" class="form-control keyboard"/>
311+
<div class="input-group-btn">
312+
{global:keyboard-select-menu('author')}
313+
</div>
314+
</div>
307315
</div>
308-
<!-- Place Name-->
309-
<div class="form-group">
310-
<label for="placeName" class="col-sm-2 col-md-3 control-label">Place Name: </label>
311-
<div class="col-sm-10 col-md-9 ">
312-
<div class="input-group">
313-
<input type="text" id="placeName" name="placeName" class="form-control keyboard"/>
314-
<div class="input-group-btn">
315-
{global:keyboard-select-menu('placeName')}
316-
</div>
317-
</div>
318-
</div>
316+
</div>
317+
<div class="form-group">
318+
<label for="title" class="col-sm-2 col-md-3 control-label">Title: </label>
319+
<div class="col-sm-10 col-md-9">
320+
<div class="input-group">
321+
<input type="text" id="title" name="title" class="form-control keyboard"/>
322+
<div class="input-group-btn">
323+
{global:keyboard-select-menu('title')}
324+
</div>
325+
<div class="input-group-btn" style="width:50%;">
326+
<select name="fq" class="form-control">
327+
<option value=""> -- Limit by Catalog -- </option>
328+
{search:catalog-limit()}
329+
</select>
330+
</div>
331+
</div>
332+
</div>
333+
</div>
334+
<div class="form-group">
335+
<label for="section" class="col-sm-2 col-md-3 control-label">Section number: </label>
336+
<div class="col-sm-10 col-md-9 ">
337+
<input type="text" id="section" name="section" class="form-control"/>
338+
</div>
339+
</div>
340+
<div class="form-group">
341+
<label for="corpus-uri" class="col-sm-2 col-md-3 control-label">Corpus URI: </label>
342+
<div class="col-sm-10 col-md-9 ">
343+
<input type="text" id="corpus-uri" name="corpus-uri" class="form-control"/>
344+
</div>
345+
</div>
346+
<div class="form-group">
347+
<label for="syriaca-uri" class="col-sm-2 col-md-3 control-label">Syriaca URI: </label>
348+
<div class="col-sm-10 col-md-9 ">
349+
<input type="text" id="syriaca-uri" name="syriaca-uri" class="form-control"/>
350+
</div>
351+
</div>
352+
<div class="form-group">
353+
<label for="text-id" class="col-sm-2 col-md-3 control-label">Text ID Number: </label>
354+
<div class="col-sm-10 col-md-9 ">
355+
<input type="text" id="text-id" name="text-id" class="form-control"/>
319356
</div>
357+
</div>
320358
<!-- end col -->
321359
</div>
322360
<!-- end row -->

modules/sparql-requests.xql

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
xquery version "3.0";
1+
xquery version "3.1";
22

33
import module namespace http="http://expath.org/ns/http-client";
4-
5-
(:
6-
: Take posted SPARQL query and send it to Syriaca.org sparql endpoint
4+
(:~
5+
: Take posted SPARQL query and send it to the Syriaca.org SPARQL endpoint
76
: Returns JSON
8-
: This will hopefully get around the javascript issues with http/https and same origin.
97
:)
10-
let $query := if(request:get-parameter('query', '')) then request:get-parameter('query', '')
11-
else if(not(empty(request:get-data()))) then request:get-data()
12-
else ()
13-
let $subject-sparql-results :=
8+
let $query :=
9+
if(request:get-parameter('query', '')) then request:get-parameter('query', '')
10+
else if(not(empty(request:get-data()))) then request:get-data()
11+
else ()
12+
let $results :=
1413
try{
15-
util:base64-decode(http:send-request(<http:request href="http://wwwb.library.vanderbilt.edu/exist/apps/srophe/api/sparql?format=json&amp;query={fn:encode-for-uri($query)}" method="get"/>)[2])
16-
} catch * {<error>Caught error {$err:code}: {$err:description}</error>}
17-
18-
return (response:set-header("Content-Type", "application/json"),$subject-sparql-results)
14+
if($query != '') then
15+
util:base64-decode(http:send-request(<http:request href="http://wwwb.library.vanderbilt.edu/exist/apps/srophe/api/sparql?format=json&amp;query={fn:encode-for-uri($query)}" method="get"/>)[2])
16+
else <message>No query data</message>
17+
} catch * {
18+
<error>Caught error {$err:code}: {$err:description}</error>
19+
}
20+
return (response:set-header("Content-Type", "application/json"), $results)
1921

repo-config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<!-- Web Site URL -->
2323
<url>http://syriac-corpus.org/</url>
2424
<!-- Root of app for building dynamic links. Default is eXist app root -->
25-
<nav-base>/exist/apps/syriac-corpus</nav-base>
25+
<nav-base></nav-base>
2626
<!-- eXist app root for app deployment-->
2727
<app-root>syriac-corpus</app-root>
2828
<!-- eXist data app root for gazetteer data -->

resources/css/main.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ h3.syr{
245245
}
246246

247247
h4 {font-size: 1em; margin-top:1em;}
248-
h5 {margin: 1em 0 0 0;}
248+
h5 {margin: 1em 0 0 0; font-weight:600;}
249249

250-
.h5-inline {font-size: 1em; font-weight:500;}
250+
.h5-inline {font-size: 1em; font-weight:600;}
251251

252252
.hi {background-color:yellow;}
253253

@@ -861,7 +861,7 @@ pre {
861861
}
862862
.tei-footnote {display:none; font-size:x-small;}
863863
.tei-footnote.display {display:inline;}
864-
.text-number.display {display:inline;}
864+
/*.text-number.display {display:inline;}*/
865865

866866
/* Table of Contents */
867867
.toc {display:block; margin-left:.75em;}

search.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
<div class="container">
55
<!-- To do -->
66
<div class="col-md-12">
7-
<div data-template="search:show-form"/>
8-
<div data-template="search:get-results" class="search-results">
7+
<div data-template="search:search-form"/>
8+
<div data-template="search:search-data" class="search-results">
99
<!-- Calls paging and search parameters string -->
10-
<div data-template="search:pageination" data-template-sort-options="relevance,title"/>
10+
<div data-template="app:pageination" data-template-sort-options="relevance,title"/>
1111
<!-- Prints search results -->
1212
<div class="row">
1313
<div class="col-md-4">
14-
<div data-template="search:display-facets"/>
14+
<div data-template="app:display-facets"/>
1515
</div>
1616
<div class="col-md-8">
17-
<div data-template="search:build-page"/>
17+
<div data-template="search:show-hits"/>
1818
</div>
1919
</div>
2020
<div class="page-bottom">
21-
<div data-template="search:pageination" data-template-sort-options="relevance,title"/>
21+
<div data-template="app:pageination" data-template-sort-options="relevance,title"/>
2222
</div>
2323
</div>
2424
</div>

0 commit comments

Comments
 (0)