Skip to content

Commit

Permalink
fix outdated ':=' notation in map expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Aug 6, 2019
1 parent a0c986a commit 61f5d6c
Show file tree
Hide file tree
Showing 19 changed files with 580 additions and 580 deletions.
10 changes: 5 additions & 5 deletions controller.xql
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ declare variable $exist:prefix external;

let $lang := config:guess-language(())
let $exist-vars := map {
'exist:path' := $exist:path,
'exist:resource' := $exist:resource,
'exist:controller' := $exist:controller,
'exist:prefix' := $exist:prefix,
'lang' := $lang
'exist:path' : $exist:path,
'exist:resource' : $exist:resource,
'exist:controller' : $exist:controller,
'exist:prefix' : $exist:prefix,
'lang' : $lang
}

return (
Expand Down
24 changes: 12 additions & 12 deletions modules/api.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ declare function api:documents($model as map()) as map()* {
(:http://localhost:8080/exist/apps/WeGA-WebApp/dev/api.xql?works=A020062&fromDate=1798-10-10&toDate=1982-06-08&func=facets&format=json&facet=persons&docID=indices&docType=writings:)
(:http://localhost:8080/exist/apps/WeGA-WebApp/dev/api.xql?&fromDate=1801-01-15&toDate=1982-06-08&func=facets&format=json&facet=places&docID=A002068&docType=writings:)
(:declare function api:facets($model as map()) {
let $search := search:results(<span/>, map { 'docID' := $model('docID') }, tokenize($model(exist:resource), '/')[last() -2])
let $search := search:results(<span/>, map { 'docID' : $model('docID') }, tokenize($model(exist:resource), '/')[last() -2])
return
facets:facets($search?search-results, $model('facet'), -1, 'de')
};
Expand Down Expand Up @@ -182,7 +182,7 @@ declare function api:ant-deleteResources($model as map()) {
if($old) then update replace $old with $entry
else update insert $entry into $config:svn-change-history-file/dictionary
)
else map {'code' := 400, 'message' := 'could not parse XML fragment', 'fields' := 'invalid format'}
else map {'code' : 400, 'message' : 'could not parse XML fragment', 'fields' : 'invalid format'}
};
:)

Expand Down Expand Up @@ -221,10 +221,10 @@ declare %private function api:document($documents as document-node()*, $model as
let $supportsHTML := $docType = ('letters', 'persons', 'diaries', 'writings', 'news', 'documents', 'thematicCommentaries')
return
map {
'uri' := $scheme || '://' || $host || substring-before($basePath, 'api') || $id,
'docID' := $id,
'docType' := $docType,
'title' := wdt:lookup($docType, $doc)('title')('txt')
'uri' : $scheme || '://' || $host || substring-before($basePath, 'api') || $id,
'docID' : $id,
'docType' : $docType,
'title' : wdt:lookup($docType, $doc)('title')('txt')
}
};

Expand All @@ -240,9 +240,9 @@ declare function api:codeSample($nodes as node()*, $model as map()) as map()* {
let $docID := $node/root()/*/data(@xml:id)
return
map {
'uri' := $scheme || '://' || $host || substring-before($basePath, 'api') || $docID,
'docID' := $docID,
'codeSample' := serialize(functx:change-element-ns-deep(wega-util:process-xml-for-display($node), '', ''))
'uri' : $scheme || '://' || $host || substring-before($basePath, 'api') || $docID,
'docID' : $docID,
'codeSample' : serialize(functx:change-element-ns-deep(wega-util:process-xml-for-display($node), '', ''))
}
};

Expand Down Expand Up @@ -288,7 +288,7 @@ declare function api:validate-element($model as map()) as map()? {
~:)
declare function api:validate-namespace($model as map()) as map()? {
if(xmldb:decode-uri($model('namespace')) castable as xs:anyURI and matches(xmldb:decode-uri($model('namespace')), '^[-\.:#+/a-zA-Z0-9]+$')) then
map { 'namespace' := xmldb:decode-uri($model?namespace) }
map { 'namespace' : xmldb:decode-uri($model?namespace) }
else
error($api:INVALID_PARAMETER, 'Unsupported namespace notation: "' || $model('namespace') || '".
The namespace should be castable to an xs:anyURI, e.g. "http://www.tei-c.org/ns/1.0" und must not contain some special characters.'
Expand Down Expand Up @@ -332,15 +332,15 @@ declare function api:validate-toDate($model as map()) as map()? {
~:)
declare function api:validate-docID($model as map()) as map()? {
(: Nothing to do here but decoding, IDs will be checked within api:findByID() :)
map { 'docID' := xmldb:decode-uri($model?docID) }
map { 'docID' : xmldb:decode-uri($model?docID) }
};

(:~
: Check parameter authorID
~:)
declare function api:validate-authorID($model as map()) as map()? {
(: Nothing to do here but decoding, IDs will be checked within api:findByID() :)
map { 'authorID' := xmldb:decode-uri($model?authorID) }
map { 'authorID' : xmldb:decode-uri($model?authorID) }
};

(:~
Expand Down
Loading

0 comments on commit 61f5d6c

Please sign in to comment.