-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add methods to get and set judgment jurisdiction
The General Regulatory Chamber has a number of Jurisdictions (or 'sub-tribunals' as we sometimes call them). These are different to the separate Lists we see within eg the Chancery Division - Lists are an administrative distinction, decided on by the court themselves, whereas Jurisdictions are a statutory one, decided in law. Neither jurisdiction nor list affects the NCN of the judgment, but they're stored differently in the XML - Lists are represented in the court code in the uk:court element, whereas judgments are represented with the uk:jurisdiction element in addition to the uk:court. This PR provides accessors for the jurisdiction data, both in isolation, and combined with the court as a slash-separated string, following the convention established in the courts metedata in ds-caselaw-utils. This will allow us to display the jurisdiction in the PUI (and allow editors to correct it in EUI) with minimal changes
- Loading branch information
1 parent
46cafbd
commit 491958d
Showing
7 changed files
with
201 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
xquery version "1.0-ml"; | ||
|
||
declare namespace akn = "http://docs.oasis-open.org/legaldocml/ns/akn/3.0"; | ||
declare namespace uk = "https://caselaw.nationalarchives.gov.uk/akn"; | ||
|
||
declare variable $uri as xs:string external; | ||
declare variable $content as xs:string external; | ||
declare variable $proprietary-node := document($uri)/akn:akomaNtoso/akn:*/akn:meta/akn:proprietary; | ||
declare variable $jurisdiction-node := $proprietary-node/uk:jurisdiction; | ||
|
||
declare function local:delete($uri) | ||
{ | ||
xdmp:node-delete($jurisdiction-node) | ||
}; | ||
|
||
declare function local:edit($uri, $content) | ||
{ | ||
xdmp:node-replace( | ||
$jurisdiction-node, | ||
<uk:jurisdiction>{$content}</uk:jurisdiction> | ||
) | ||
}; | ||
|
||
declare function local:add($uri, $content) | ||
{ | ||
xdmp:node-insert-child( | ||
$proprietary-node, | ||
<uk:jurisdiction>{$content}</uk:jurisdiction> | ||
) | ||
}; | ||
|
||
if (fn:boolean( | ||
cts:search(doc($uri), | ||
cts:element-query(xs:QName('uk:jurisdiction'),cts:and-query(()))))) then | ||
if ($content = "") then local:delete($uri) else local:edit($uri, $content) | ||
else | ||
local:add($uri, $content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters