Hyrax Stack Walkthrough - RepoCamp/connect2017 GitHub Wiki
This guide assumes you are staring 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 Commons
- is indexed in Solr
Prerequisites
- Install and configure Hyrax with at least one work type
- Set background jobs to run inline or start background workers
- Start Solr, Fedora, and Rails web server
HOST='0.0.0.0' rails hydra:server
Steps
-
Inspect an empty repository
You rarely see this in the real world...- User Interface: go to http://localhost:3000, click on the search icon
you should see a message like "No results found for your search" - Code: in a new window,
rails console
, then enterEtd.count
, thenCollection.count
both should return 0 - Fedora: go to http://localhost:8984/rest/
check the number of children - Solr: go to http://localhost:8983/solr/#/hydra-development
note the document counts under "Statistics"
- User Interface: go to http://localhost:3000, click on the search icon
-
Set up a user and create a work using the User Interface
- Go to go to http://localhost:3000, click on the Login link in the upper right hand corner
- If you haven't created a user yet, click the Sign up link just below the login button
- Enter your chosen e-mail and password
- If you're not already there, click on the Dashboard link to go to your user dashboard
- Click on the Create Work link
to add a new item to the repository
Notice the Requirements section in the SAVE WORK panel - Fill out the fields marked with blue
required
labels
Notice the Requirements section in the SAVE WORK panel - Click on the Files tab
- Click on the + Add Files button and select a file to upload
NOTE: there are sample files to use in yourtutorial/samples
folder
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 ETD!
-
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: check
Etd.count
, thenCollection.count
again
you now have 1 Etd and no collections - Fedora: go to http://localhost:8984/rest/ and you'll see a new child container.
Click on the link to http://localhost:8984/rest/dev and take a look
note the number of children in this container - Solr: go to http://localhost:8983/solr/#/hydra-development
check whether the document counts under "Statistics" has changed
- User Interface: go to http://localhost:3000, click on the search icon
-
Find a work by it's ID
- User Interface: go to http://localhost:3000/concerns/etds/**ID**
- Code:
e = Etd.find(id)
- Fedora: First find the work using the rails console, the get a link to it using
e.uri
- Solr: go to http://localhost:8983/solr/#/hydra-development
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.reload
method 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.
-
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
.save
method to make changes in memory permanent in 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 using the User Interface
- What changes in Fedora
-
Create an empty Collection using the User Interface
- Verify that
Collection.count
has 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 an ETD to your collection using the User Interface
- What does the etd 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 etd look like in Solr?
-
Attach and image to an ETD using the UI. Then look at FileSets (
#file_sets
) and Files (#files
) in the rails console- 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::ImageSchema https://github.com/projecthydra/hydra-works/blob/master/lib/hydra/works/characterization/schema/image_schema.rb