DAY 3
Add Metadata to search results and facets
- Write a high level feature test first but don't make any changes so it still passes. (write a behavior that already exists
Continent
GIS data
DAY 1 | DAY 2 |
- Hyrax Stack Walkthrough
- RailsBridge Intro To Rails
- Run Test Suite
- New Metadata Field
- Add Field to Views & Index
- Search & Browse a Field
- Collaborative Development
- Team Development
- Preparation & Logistics
- Common Tasks
- Daily Standup
- Building from Scratch
- Additional Resources
- Building from Scratch
Initial Docker Setup Hyrax Stack Walkthrough
$ docker-comnpose run web rails db:setup
Fedora - http://localhost:8983/solr/#/ http://localhost:8984 SOLR - http://localhost:8984/rest/dev
http://localhost:3000/concern/images/gq67jr16q
c = Image.find('gq67jr16q')
c.uri
=> #<RDF::URI:0x2af187ad24f8 URI:http://fedora:8080/rest/dev/gq/67/jr/16/gq67jr16q>
http://localhost:8984/rest/dev/gq/67/jr/16/gq67jr16q
Created at 2019-09-09T18:41:05.385Z by bypassAdmin Last Modified at 2019-09-09T19:08:45.199Z by bypassAdmin Children 8 http://localhost:8984/rest/dev/e0/4a/70/09/e04a7009-24a1-46f8-869b-516f0fe41ae5 http://localhost:8984/rest/dev/gq/67/jr/16/gq67jr16q http://localhost:8984/rest/dev/qv/33/rw/64/qv33rw64w http://localhost:8984/rest/dev/e6/ba/55/bc/e6ba55bc-8166-4f1b-9257-ea99c79cb71e http://localhost:8984/rest/dev/0k/22/5b/04/0k225b04p http://localhost:8984/rest/dev/ad/mi/n_/se/admin_set/default http://localhost:8984/rest/dev/ed/07/26/38/ed072638-220d-49fe-9ae2-091e76bb597d http://localhost:8984/rest/dev/28/5b/a3/ae/285ba3ae-bedb-4647-8d53-e017564690b3
: =
constructing SOLR query - https://www.google.com/search?q=construct+solr+query&rlz=1C5CHFA_enUS818US818&oq=construct+solr+query&aqs=chrome..69i57.7550j0j0&sourceid=chrome&ie=UTF-8
id:work_id = id:38741827384
i.file_sets.first.files.first
OCFL - Oxford Common File Layout
admin set - administrative grouping of thing - every Object in a Samvera repo must belong to an admin set and can only have one. default permission scheme the workflow creation It has two part one in the software and one in the database.
The console in Rails is nothing more than an irb (see Section 2.4, “irb”) built around the Rails environment. Rails Console Shortcuts, Tips, and Tricks
Work.count
Collection.count
i = Image.find('')
i.uri
`i.file_sets.first.files.first`
HydaAccessControl- controlls access
The Rails Command Line The Rails Console - Ruby on Rails Books Active Record Team Treehouse https://medium.com/@lfv89/rails-console-magic-tricks-da1fdd657d32
characterization
https://github.com/RepoCamp/ucla2019/wiki/Hyrax-Stack-Walkthrough#exercises
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
Show predicate mappings inherited from Hydra::Works::Characterization::ImageSchema
https://github.com/samvera/hydra-works/blob/master/lib/hydra/works/characterization/schema/image_schema.rb
https://github.com/RepoCamp/ucla2019/wiki/Run-Test-Suite
- Compare the structure of our
/spec
directory to our/app
directory - What is a rake task?
- Rake allows you to write tasks in the Ruby language and execute them on the command line.
- It is a Domain Specific Language (DSL), which means you can only use it for things related to Ruby.
- Rake is a task runner.
- It runs small tasks.
- It is a software task management and build automation tool.
- It allows the user to specify tasks and describe dependencies as well as to group tasks in a namespace.
- There are rake tasks natively built into Ruby and Rails that perform common functions such as
rake db:migrate
- To view your local rake tasks: $
rake --tasks
- Rake Tutorials + https://www.rubyguides.com/2019/02/ruby-rake/ + https://lukaszwrobel.pl/blog/rake-tutorial/ + https://web.archive.org/web/20071024171055/http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial
- What kinds of jobs make good tasks?
- Making a backup of your database
- Running your tests
- Gathering & reporting stats
- What are the advantages of having the CI task launch Solr and Fedora test instances vs. leaving them running? + CI - Continuously runs your test suite when an event happens in your repo.
- What does "pending" mean in the context of our test suite?
- The test is not running. It is just a sketch.
- What does that Randomized with seed line mean? What are we randomizing and why?
rspec spec --seed 1234
In the default configuration, RSpec runs its tests a random order. This is actually a good practice because tests should be independent of each other. Running them in a random order helps to find tests that only pass when they are run in a specific order and fail in another order.
But the problem is: If RSpec runs the test in a random order and then fails, how can you re-run the test in the same order again to debug the issue? That can be done by telling RSpec to use the same seed for its randomness as it was using before.
https://github.com/RepoCamp/ucla2019/wiki/Add-a-metadata-field,-with-feature-and-unit-tests
semantic web - linked data - predicate
hyrax_images_controller.rb
Active Record is the M in MVC - the model - which is the layer of the system responsible for representing business data and logic. Active Record facilitates the creation and use of business objects whose data requires persistent storage to a database. https://www.rubydoc.info/gems/solrizer/4.1.0
Active Fedora Association looks like an Array i.description = ["cat", "llama] NOT i.description.push("cat")
models/ucla_metadata.rb
property :author, predicate: ::RDF::URI.intern('http://id.loc.gov/vocabulary/relators/aut') do |index|
index.as :stored_searchable
end
Bisect - help fixing flaky tests
Bess recommended this.
Ask Bess and Mark about: Test matrix - Build Matrix