OregonDigital / OD2

Next generation of Oregon Digital ( https://oregondigital.org ) digital collections platform, built on Samvera Hyrax ( https://github.com/samvera/hyrax/ )
18 stars 1 forks source link

Setup Triplestore adapter objects in OD2 to connect to the triplestore adapter interface and test. #70

Closed straleyb closed 5 years ago

straleyb commented 5 years ago

Descriptive summary

Now that the triplestore is configured and working, an implementation will need to be set up using what the triplestore-adapter gem provides. There are a few objects to go over that are necessary for interfacing with the triplestore-adapter gem and OD2. This is as follows.

https://github.com/osulp/Scholars-Archive/pull/564/files#diff-bb09ca9f30a2b172310eccb148cc9305 This file is an object that allows for error reporting when it comes to a triplestore error. We can add any number of objects here which relate to a given error. In this example, we have a triplestore error and a uri error.

https://github.com/osulp/Scholars-Archive/pull/564/files#diff-3060a384590884beda894babeef0d38d This object is a validator that ensures that a uri was provided in the form. This is to make sure that we can report both on the backend and frontend whether improper data is being entered and report that to the user. This object can implement the previous file by using that error class and handling the error properly.

https://github.com/osulp/Scholars-Archive/pull/564/files#diff-a844811c81255eafffe8ac2675fcf679 This next file is a large file which essentially overrides a lot of what simple_form is doing to create a specific type of input. SimpleForm is a gem that allows for the easy generation of forms in rails. It is what generates the HTML behind the scenes and builds out the form fields so you dont have to. We need a type of form field that isnt provided by SimpleForm so we have to override some of its internals to generate our own.

https://github.com/osulp/Scholars-Archive/pull/564/files#diff-4f7e4485def77b80f9ac52e01751c8a6 This next file is essentially an adherence to a pattern used quite a lot in hyrax. We have extracted out the TriplePoweredForm "behavior" which enables a form object to become "TriplePowered" meaning it can interface with the triplestore backend.

https://github.com/osulp/Scholars-Archive/pull/564/files#diff-0873f7ce9796373e62c89c5bd909211b This is the file that actually uses the triplestore code to make the calls to store data into the backend.

https://github.com/osulp/Scholars-Archive/pull/564/files#diff-9210982b7fa445e3d7ec8ac5077f1aa4 This file is the same as the other file that adheres to the pattern used a lot in hyrax. We have extracted this code into a "behavior" which allows a work to know that it is triple powered. It knows that it has a specific field that should be expecting a uri. It knows how to grab uris from the backend, it knows how to translate a uri to a label and many other different things. This needs to be included on a work if that work has a controlled vocabulary field.

https://github.com/osulp/Scholars-Archive/pull/564/files#diff-77a5be6b83ee75a4553eed5e0f781748 This file is an indexer. Indexers know how to take the data and translate it into a format that can be indexed. Here it is looking at which field is controlled and indexing its labels and other data.

https://github.com/osulp/Scholars-Archive/pull/564/files#diff-e11bdaf9116be3911e9557b69e242370 We need to make sure to include the triplestore-adapter code in our app.

Expected behavior

The tests pass.

vantuyls commented 5 years ago

@straleyb does this require any QA?

straleyb commented 5 years ago

Not really. No QA possible outside of code review. Next work cycle, this code will most likely be used in refinement of the linked data.