Hyrax Stack Walkthrough - RepoCamp/ohsu2018 GitHub Wiki
This guide assumes you are starting with a template-generated instance of Hyrax.
Goals:
- Understand the way an item in Hyrax
- is displayed in the User Interface,
- is represented in the application Code
- is stored in Fedora
- is indexed in Solr
Lesson Setup
- If you're running in a VM, change to the
/vagrantdirectory
cd /vagrant - Clone this repository and check out the lesson:
git clone -b walkthrough https://github.com/RepoCamp/ohsu2018.git && cd ohsu2018 - Update dependencies:
bundle install - Run migrations:
rails db:migrate - Start the development environment servers:
rails hydra:serverThis launches development instances of Solr, Fedora, and your web application server. You'll leave the servers running in this terminal window for the rest of this lesson. You can check back here to see output from the Rails server.
- Open a new terminal window -- yes, a second one! -- then login to the VM and change to the
ohsu2018directory
# in a new terminal window
vagrant ssh
cd /vagrant/ohsu2018 - Create the default Admin Set (an administrative collection -- every work instance deposited must belong to one and only one Admin Set):
rails hyrax:default_admin_set:create
Steps
-
Inspect an empty repository You rarely see this in the real world...
- User Interface: go to http://localhost:3000, click on the blue search button labeled
Goyou should see a message like "No results found for your search" - Code: in a new terminal window,
rails console, then enterWork.count, thenCollection.countboth should return 0 - Fedora: go to http://localhost:8984/rest/dev check the number of children - what does it look like they are?
- Solr: go to http://localhost:8983/solr/#/hydra-development note the document counts under "Statistics" - what shows up when you search Solr?
- User Interface: go to http://localhost:3000, click on the blue search button labeled
-
Set up a user and create a work using the User Interface
- Go to http://localhost:3000, click on the
Loginlink in the upper right-hand corner - If you haven't created a user yet, click the
Sign uplink just below the login button - Enter your chosen e-mail and password
- From your Dashboard, click on the
Workslink in the left-hand navigation bar - Click on the
Add new workbutton to add a new item to the repository Notice the Requirements section in the SAVE WORK panel - Fill out the fields marked with blue
requiredlabels Notice the Requirements section in the SAVE WORK panel - Click on the
Filestab - Click on the + Add Files button and select a file to upload
NOTE: if you copied files from a thumb-drive, there are sample files to use in your
tutorial/vagrant/samples-assetsfolder Notice the Requirements section in the SAVE WORK panel - Click the checkbox for the deposit agreement and click the SAVE button
- Wait a second and take a look at your new Work!
- Go to http://localhost:3000, click on the
-
Now that you have something in your repository, let's take a look at it
- User Interface: go to http://localhost:3000, click on the search icon you should see your new item listed in the results along with a facet list to the left
- Code: from the Rails console, check
Work.count, thenCollection.countagain you now have 1 work and no collections - Fedora: go to http://localhost:8984/rest/dev note the number of new children in this container - can you figure out what any of them are?
- Solr: go to http://localhost:8983/solr/#/hydra-development check whether the document counts under "Statistics" has changed
-
Find a work by its identifier Do a search from the user interface and click on your work, you can read the
idfrom the work's URL- User Interface: go to http://localhost:3000/concerns/works/IDENTIFIER
- Code:
w = Work.find(id) - Fedora: First find the work using the Rails console, the get a link to it using
w.uri - Solr: go to http://localhost:8983/solr/#/hydra-development/query enter
id:your_work_id_herein theqfield and click the "Execute Query" button
Exercises
-
Add an optional field using the User Interface
- Verify the change in the Code. HINT use the ID in the url and use it to find the item using the console.
You might need to use the
.reloadmethod on your work to refresh attributes in memory. - Verify the change in Fedora.
- Verify the change in Solr.
- Verify the change in the Code. HINT use the ID in the url and use it to find the item using the console.
You might need to use the
-
What other fields are available? Does what you see in the User Interface match the code at hyrax/basic_metadata.rb? Also see: https://github.com/no-reply/sufia-profile/blob/master/profile.md
-
What happens when you add multiple entries for a field?
-
What happens when you remove all the entries for a field?
-
Add a second description using the console. HINT you'll need to use the
.savemethod to make changes in memory persist to Solr and Fedora.- Verify the change in the User Interface.
- Verify the change in Fedora.
- Verify the change in Solr.
-
Find the access controls in Fedora
- Change the access control (visibility) using the User Interface
- What changes in Fedora
-
Create an empty Collection using the User Interface
- Verify that
Collection.counthas changed in the rails console - What does the collection look like in Code?
- What does the collection look like in Fedora?
- What does the collection look like in Solr?
- Verify that
-
Add a new Work to your collection using the User Interface
- What does the Work look like in CODE
- What does the collection look like now in Code?
- What does the collection look like now in Fedora?
- What does the collection look like now in Solr?
- What does the Work look like in Solr?
-
Attach and image to an Work using the UI. Then look at FileSets (
#file_sets) and Files (#files) in the Rails console (NOTE: the#filesmethod may be called on aFileSetinstance)- Find the original
file_name - Display the
width,height,color_space,profile_name,size,mime_type,fits_version - Inspect the content
- Show predicate mappings inherited from
Hydra::Works::Characterization::ImageSchemahttps://github.com/samvera/hydra-works/blob/master/lib/hydra/works/characterization/schema/image_schema.rb
- Find the original