Dette repoet inneholder kode for å lage PID til språkressurser. (Scroll down for English)
Det enkleste er å installere uv, og kjøre
uv syncfor å installere riktig versjon av python og avhengigheter.
Eventuelt lag et virtuelt miljø manuelt og installer med pip slik:
python3 -m venv .venv
. ./venv/bin/activate
pip install .Spør en kollega om brukernavn, passord og handle-prefiks til .env
Se .env-example for hvordan .env-fila skal se ut (lag en kopi, kall den .env og fyll inn brukernavn, passord og HANDLE_PREFIX)
Scriptet har foreløpig to kommandoer, create og list:
Denne funksjonen lager en liste over alle PIDer registrert på handle-prefikset og henter ut URLene disse peker til.
uv run main.py listFørste kolonne er PID, andre kolonne er PID-type (stort sett alltid URL), og tredje kolonne URLen som PIDen peker til.
F.eks.:
'76', 'URL', 'https://www.nb.no/sprakbanken/ressurskatalog/oai-nb-no-sbr-76/'
'77', 'URL', 'https://www.nb.no/sprakbanken/ressurskatalog/oai-nb-no-sbr-77/'
'78', 'URL', 'https://www.nb.no/sprakbanken/ressurskatalog/oai-nb-no-sbr-78/'Denne funksjonen lar deg opprette eller endre en gitt PID:
uv run main.py create {PID} --url [URL-for-ressurs}hvor PID er IDen som skal være permanent (f.eks. en UUID) og url er URLen PIDen skal peke til.
F.eks:
uv run main.py create 23b9ce9d-14b9-4f7c-9b25-f305e3e7ca6a --url https://www.nb.noDette vil lage en PID for ressursen, som kan resolves via: https://hdl.handle.net/{HANDLE_PREFIX}/23b9ce9d-14b9-4f7c-9b25-f305e3e7ca6a
Hvis PIDen allerede eksisterer, vil man få beskjed om det. Hvis man ønsker å endre URLen som den eksisterende PIDen viser til, kan man bruke parameteret --update.
uv run main.py create 23b9ce9d-14b9-4f7c-9b25-f305e3e7ca6a --url https://www.nb.no --updateThis repository contains code for creating PIDs for language resources.
The easiest way is to install uv, and run:
uv syncto install the correct version of Python and dependencies.
Alternatively, create a virtual environment manually and install with pip like this:
python3 -m venv .venv
. ./venv/bin/activate
pip install .Ask a colleague for the username, password, and handle prefix for .env
See .env-example for how the .env file should look (make a copy, call it .env, and fill in username, password, and HANDLE_PREFIX)
The script currently has two commands, create and list:
This function creates a list of all PIDs registered on the handle prefix and retrieves the URLs they point to.
uv run main.py listThe first column is the PID, the second column is the PID type (usually always URL), and the third column is the URL that the PID points to.
For example:
'76', 'URL', 'https://www.nb.no/sprakbanken/ressurskatalog/oai-nb-no-sbr-76/'
'77', 'URL', 'https://www.nb.no/sprakbanken/ressurskatalog/oai-nb-no-sbr-77/'
'78', 'URL', 'https://www.nb.no/sprakbanken/ressurskatalog/oai-nb-no-sbr-78/'This function allows you to create or modify a given PID:
uv run main.py create {PID} --url [URL-for-resource]where PID is the ID that should be permanent (e.g., a UUID) and url is the URL the PID should point to.
For example:
uv run main.py create 23b9ce9d-14b9-4f7c-9b25-f305e3e7ca6a --url https://www.nb.noThis will create a PID for the resource, which can be resolved via: https://hdl.handle.net/{HANDLE_PREFIX}/23b9ce9d-14b9-4f7c-9b25-f305e3e7ca6a
If the PID already exists, you will be notified. If you want to change the URL that the existing PID points to, you can use the --update parameter.
uv run main.py create 23b9ce9d-14b9-4f7c-9b25-f305e3e7ca6a --url https://www.nb.no --update