Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. ## Hyrax Models
  2.  
  3. * Collection
  4. * Work
  5. * FileSet
  6. * File
  7.  
  8. ### These are currently created by including...
  9.  
  10. * CollectionBehavior
  11. * WorkBehavior
  12. * FileSetBehavior
  13. * _not sure about Files_
  14.  
  15. ## Relationships
  16.  
  17. ### Currently relationships are setup as...
  18.  
  19. * Collection memberOf Collection
  20. * Work isPartOf Collection
  21. * Work hasMember Work (used to enforce ordering)
  22. * Work hasMember FileSet
  23. * FileSet hasFile File
  24.  
  25. ### Proposed relationships
  26.  
  27. I recommend storing the model more explicitely in Valkyrie.
  28.  
  29. ```
  30. # on Collection
  31. attribute :parent_collection_ids, ::Valkyrie::Types::Set.of(::Valkyrie::Types::ID)
  32.  
  33. # on Work
  34. attribute :parent_collection_ids, ::Valkyrie::Types::Set.of(::Valkyrie::Types::ID)
  35. attribute :child_work_ids, ::Valkyrie::Types::Array.of(::Valkyrie::Types::ID).meta(ordered: true)
  36. attribute :child_fileset_ids, ::Valkyrie::Types::Array.of(::Valkyrie::Types::ID).meta(ordered: true)
  37.  
  38. # on Filesets
  39. attribute :file_ids, ::Valkyrie::Types::Set.of(::Valkyrie::Types::ID)
  40. ```
  41.  
  42. If we are going to maintain the ability to produce RDF, I would recommend creating a method that returns the appropriate predicate.
  43. Then the methods above combined with the predicate methods can be used to generate RDF.
  44.  
  45. ## Getter/Setter methods
  46.  
  47. ### Current methods
  48.  
  49. The current methods for getting and setting relationships are all over the board and do not follow a consistent pattern.
  50.  
  51. ### Proposed methods...
  52.  
  53. #### COL m..m COL (validation to avoid circular relationship chain)
  54. * parent_collection.add_collections [col1, col2]
  55. * parent_collection.add_collections_by_id [col1.id, col2.id]
  56. * child_collection.add_in_collections [col1, col2]
  57. * child_collection.add_in_collections_by_id [col1.id, col2.id]
  58.  
  59. * parent_collection.child_collections
  60. * child_collection.parent_collections
  61.  
  62. #### COL m..m WORK
  63. * collection.add_works [work1, work2]
  64. * collection.add_works_by_id [work1.id, work2.id]
  65. * work.add_in_collections [col1, col2]
  66. * work.add_in_collections_by_id [col1.id, col2.id]
  67.  
  68. * parent_collection.child_works
  69. * child_work.parent_collections
  70.  
  71. #### WORK m..m WORK (validation to avoid circular relationship chain)
  72. * parent_work.add_works [work1, work2]
  73. * parent_work.add_works_by_id [work1.id, work2.id]
  74. * child_work.add_in_works [work1, work2]
  75. * child_work.add_in_works_by_id [work1.id, work2.id]
  76.  
  77. * parent_work.child_works
  78. * child_work.parent_works
  79.  
  80. #### WORK 1..m FILESET
  81. * parent_work.add_filesets [fs1, fs2]
  82. * parent_work.add_filesets_by_id [fs1.id, fs2.id]
  83. * child_fileset.add_in_work work1
  84. * child_fileset.add_in_work_by_id work1.id
  85.  
  86. * parent_work.child_filesets
  87. * child_fileset.parent_work
  88.  
  89. #### FILESET 1..m FILE
  90. * parent_fileset.add_files [file1, file2]
  91. * parent_fileset.add_files_by_id [file1.id, file2.id]
  92. * child_file.add_in_filesets [fs1, fs2]
  93. * child_file.add_in_filesets_by_id [fs1.id, fs2.id]
  94.  
  95. * parent_fileset.child_files
  96. * child_file.parent_fileset
  97.  
  98.  
  99. Notes:
  100. * Method names should be consistent and represent the relationships.
  101. * Methods should go in both directions even if we only store one direction with the persisted object.
  102. * The non-stored direction will be less efficient if going against the datastore.
  103. * The non-stored direction could be stored in SOLR for faster retrieval.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement