Skip to content
MajoBerger edited this page Aug 2, 2022 · 26 revisions

Also checkout

Database

In order to connect to database, follow these steps:

  1. If run in docker, first exec into it like so: sudo docker exec -it dspacedb /bin/bash
  2. Then login to postgres with user dspace like so: psql -U dspace (You might need to locate psql. It can be placed in postgres installation folder or in its subfolder /bin )
    • As shell suggests, type help for help.
  3. Misc useful commands:
    • \dt to see all tables
    • \d tablename to describe table, e.g. \d eperson
    • select * from eperson; to see all entries in eperson. Note the ; here, which is missing in \d commands.

Code

Define autocomplete input field

In dspace/config/submission-forms.xml set input type to <input-type>autocomplete</input-type> and the values will be loaded from the appropriate metadata field.

Harvesting

How to harvest in the Docker

Related issue: https://github.com/dataquest-dev/dspace-angular/issues/48

  1. go to [dspace-angular] - in our case /opt/actions-runner-dq-1/_work/dspace-angular/dspace-angular Dataquest-access
  2. remove entrypoint in the docker/cli.yml
  3. connect to the docker-cli: docker-compose --env-file /opt/actions-runner-dq-1/_work/dspace-angular/dspace-angular/build-scripts/import/../run/envs/.default -p dq-d7 -f docker/cli.yml run -v $(pwd)/build-scripts/import/assets:/assets --rm dspace-cli /bin/bash
  4. create collection: ./dspace structure-builder -f /assets/test_community_collection.xml -o /assets/test_import_output.xml -e [email protected]
  5. prepare collection for harvesting: ./dspace harvest -s -c 123456789/2 -a http://lindat.mff.cuni.cz/repository/oai/request -i hdl_11234_3430 -m dc -t 1 -e [email protected]
  6. harvest to the collection: ./dspace harvest -r -c 123456789/2 -a http://lindat.mff.cuni.cz/repository/oai/request -i hdl_11234_3430 -m dc -t 1 -e [email protected]

Unresolved problems:

  • The script harvest.sh harvest the items to the collection 123456789/2 but it works only in the first run because database remember all historical collection ids.

Metadata

How to create a custom local metadata

By configuration

  1. Add the custom metadata to the local-types.xml
  2. Run mvn package in the [dspace-source]/dspace
  3. Run ant fresh_install in the [dspace-source]/dspace/targer/dspace-installer
  4. Run dspace database migrate force in the [dspace-source]/bin

By Admin UI

  1. Login as an Administrator
  2. In the side menu that appears, open the "Registries" menu. Click on "Metadata". This is where all your Metadata fields are defined
  3. Now, you'll see a list of all the metadata schema that DSpace is initialized with. click on the "local" schema to see its fields
  4. The "local" schema is empty by default, so no fields should appear. But, you can add a new field by minimally adding an Element & clicking Save. For example, to create "local.myfield", place the text "myfield" in the Element and click Save. To add a field named "local.myfield.other", add the text "myfield" in the Element and "other" in Qualifier and click Save.

By REST API

Updating a testEnvironment.zip

Some changes are not pushed to the testEnvironment.zip after command mvn package because:

  • '/target/' folder needs to be updated - run mvn clean package not just mvn package
  • After running the test, the 'testEnvironment.zip' is loaded from the .m2 and not created - remove it from the .m2.
Clone this wiki locally