rif-cs 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,906 @@
1
+ class PartyExample
2
+ require 'date'
3
+ include RIFCS::Party
4
+
5
+ attr_reader :party_key
6
+
7
+ def initialize(key='a key')
8
+ @party_key = key
9
+ end
10
+
11
+ def party_group
12
+ 'test group'
13
+ end
14
+
15
+ def party_originating_source
16
+ 'tomato'
17
+ end
18
+
19
+ def party_type
20
+ 'person'
21
+ end
22
+
23
+ def party_date_modified
24
+ Time.new(2012, 6, 14).utc
25
+ end
26
+
27
+ def party_identifiers
28
+ [
29
+ { value: 'http://example.com', type: 'uri' },
30
+ { value: '123', type: 'local' }
31
+ ]
32
+ end
33
+
34
+ def party_names
35
+ [
36
+ {
37
+ type: 'primary',
38
+ name_parts: [
39
+ { type: 'title', value: 'Dr' },
40
+ { type: 'given', value: 'John' },
41
+ { type: 'family', value: 'Doe' }
42
+ ]
43
+ },
44
+ ]
45
+ end
46
+
47
+ def party_related_info
48
+ [
49
+ {
50
+ type: 'website',
51
+ identifier: {
52
+ value: 'http://example.com/personalsites/foo',
53
+ type: 'uri'
54
+ },
55
+ title: 'This person\'s blog',
56
+ notes: 'Another blog'
57
+ },
58
+ {
59
+ type: 'publication',
60
+ identifier: {
61
+ value: '111',
62
+ type: 'isbn'
63
+ },
64
+ title: 'The Ordering of Things',
65
+ notes: 'Not available'
66
+ }
67
+ ]
68
+ end
69
+
70
+ def party_related_objects
71
+ {
72
+ has_association_with: [
73
+ {
74
+ key: 'b party',
75
+ relation: {
76
+ description: 'Supervisor'
77
+ }
78
+ }
79
+ ],
80
+ is_member_of: [
81
+ {
82
+ key: 'some group'
83
+ }
84
+ ]
85
+ }
86
+ end
87
+
88
+ def party_locations
89
+ [
90
+ {
91
+ date_from: Time.new(2012, 6, 14).utc,
92
+ addresses: [
93
+ {
94
+ electronic: [
95
+ {
96
+ type: 'email',
97
+ value: 'joe@example.com'
98
+ },
99
+ {
100
+ type: 'uri',
101
+ value: "http://example.com/people/#{@party_key}",
102
+ args: [
103
+ { value: 'placeholder', required: 'false' }
104
+ ]
105
+ }
106
+ ],
107
+ physical: [
108
+ {
109
+ type: 'postalAddress',
110
+ address_parts: [
111
+ {
112
+ type: 'country',
113
+ value: 'Austrlia'
114
+ },
115
+ ]
116
+ },
117
+ {
118
+ address_parts: [
119
+ {
120
+ type: 'telephoneNumber',
121
+ value: '+61 2 9123 4567'
122
+ }
123
+ ]
124
+ }
125
+ ]
126
+ }
127
+ ]
128
+ }
129
+ ]
130
+ end
131
+
132
+ def party_coverage
133
+ [
134
+ {
135
+ spatials: [
136
+ {
137
+ value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
138
+ type: 'gml'
139
+ }
140
+ ],
141
+ temporals: [
142
+ {
143
+ dates: [
144
+ {
145
+ value: Time.new(2012, 6, 14).utc,
146
+ date_format: 'UTC',
147
+ type: 'dateFrom'
148
+ },
149
+ {
150
+ value: Time.new(2013, 6, 14).utc,
151
+ date_format: 'UTC',
152
+ type: 'dateTo'
153
+ },
154
+ ],
155
+ text: ['Self destructs in 1 year']
156
+ }
157
+ ]
158
+ }
159
+ ]
160
+ end
161
+
162
+ def party_descriptions
163
+ [
164
+ {
165
+ value: 'A researcher',
166
+ type: 'brief',
167
+ 'xmllang' => nil
168
+ },
169
+ {
170
+ value: 'Not just any researcher',
171
+ type: 'full'
172
+ }
173
+ ]
174
+ end
175
+
176
+ def party_existence_dates
177
+ [
178
+ {
179
+ start_date: {
180
+ value: Time.new(2012, 6, 14).utc,
181
+ date_format: 'UTC'
182
+ },
183
+ end_date: {
184
+ value: Time.new(2013, 6, 14).utc,
185
+ date_format: 'UTC'
186
+ }
187
+ }
188
+ ]
189
+ end
190
+
191
+ def party_rights
192
+ [
193
+ {
194
+ rights_statement: {
195
+ rights_uri: 'http://www.intersect.org.au/policies',
196
+ value: 'Copyright 2012 Intersect Australia Ltd.'
197
+ },
198
+ licence: {
199
+ value: 'Attribution (CC BY)',
200
+ rights_uri: 'http://creativecommons.org/licenses/by/3.0',
201
+ type: ''
202
+ },
203
+ access_rights: {
204
+ value: 'Available to all without restriction'
205
+ }
206
+ }
207
+ ]
208
+ end
209
+
210
+ def party_subjects
211
+ [
212
+ {
213
+ value: '123456',
214
+ type: 'anzsrc-for'
215
+ }
216
+ ]
217
+ end
218
+
219
+ end
220
+
221
+ class ActivityExample
222
+ require 'date'
223
+ include RIFCS::Activity
224
+
225
+ attr_reader :activity_key
226
+
227
+ def initialize(key='a key')
228
+ @activity_key = key
229
+ end
230
+
231
+ def activity_group
232
+ 'test group'
233
+ end
234
+
235
+ def activity_originating_source
236
+ 'tomato'
237
+ end
238
+
239
+ def activity_type
240
+ 'program'
241
+ end
242
+
243
+ def activity_date_modified
244
+ Time.new(2012, 6, 14).utc
245
+ end
246
+
247
+ def activity_identifiers
248
+ [
249
+ { value: 'http://example.com', type: 'uri' },
250
+ { value: '123', type: 'local' }
251
+ ]
252
+ end
253
+
254
+ def activity_names
255
+ [
256
+ {
257
+ type: 'primary',
258
+ name_parts: [
259
+ { value: 'Testing of software' },
260
+ ]
261
+ },
262
+ ]
263
+ end
264
+
265
+ def activity_related_info
266
+ [
267
+ {
268
+ type: 'publication',
269
+ identifier: {
270
+ value: '111',
271
+ type: 'isbn'
272
+ },
273
+ title: 'The Ordering of Things',
274
+ notes: 'Not available'
275
+ }
276
+ ]
277
+ end
278
+
279
+ def activity_related_objects
280
+ {
281
+ has_association_with: [
282
+ {
283
+ key: 'b party',
284
+ relation: {
285
+ description: 'Supervisor'
286
+ }
287
+ }
288
+ ],
289
+ is_member_of: [
290
+ {
291
+ key: 'some group'
292
+ }
293
+ ]
294
+ }
295
+ end
296
+
297
+ def activity_locations
298
+ [
299
+ {
300
+ date_from: Time.new(2012, 6, 14).utc,
301
+ addresses: [
302
+ {
303
+ electronic: [
304
+ {
305
+ type: 'email',
306
+ value: 'joe@example.com'
307
+ },
308
+ {
309
+ type: 'uri',
310
+ value: "http://example.com/people/#{@activity_key}",
311
+ args: [
312
+ { value: 'placeholder', required: 'false' }
313
+ ]
314
+ }
315
+ ],
316
+ physical: [
317
+ {
318
+ type: 'postalAddress',
319
+ address_parts: [
320
+ {
321
+ type: 'country',
322
+ value: 'Austrlia'
323
+ },
324
+ ]
325
+ },
326
+ {
327
+ address_parts: [
328
+ {
329
+ type: 'telephoneNumber',
330
+ value: '+61 2 9123 4567'
331
+ }
332
+ ]
333
+ }
334
+ ]
335
+ }
336
+ ]
337
+ }
338
+ ]
339
+ end
340
+
341
+ def activity_coverage
342
+ [
343
+ {
344
+ spatials: [
345
+ {
346
+ value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
347
+ type: 'gml'
348
+ }
349
+ ],
350
+ temporals: [
351
+ {
352
+ dates: [
353
+ {
354
+ value: Time.new(2012, 6, 14).utc,
355
+ date_format: 'UTC',
356
+ type: 'dateFrom'
357
+ },
358
+ {
359
+ value: Time.new(2013, 6, 14).utc,
360
+ date_format: 'UTC',
361
+ type: 'dateTo'
362
+ },
363
+ ],
364
+ text: ['Self destructs in 1 year']
365
+ }
366
+ ]
367
+ }
368
+ ]
369
+ end
370
+
371
+ def activity_descriptions
372
+ [
373
+ {
374
+ value: 'An activity',
375
+ type: 'brief',
376
+ 'xmllang' => nil
377
+ },
378
+ {
379
+ value: 'Not just any activity',
380
+ type: 'full'
381
+ }
382
+ ]
383
+ end
384
+
385
+ def activity_existence_dates
386
+ [
387
+ {
388
+ start_date: {
389
+ value: Time.new(2012, 6, 14).utc,
390
+ date_format: 'UTC'
391
+ },
392
+ end_date: {
393
+ value: Time.new(2013, 6, 14).utc,
394
+ date_format: 'UTC'
395
+ }
396
+ }
397
+ ]
398
+ end
399
+
400
+ def activity_rights
401
+ [
402
+ {
403
+ rights_statement: {
404
+ rights_uri: 'http://www.intersect.org.au/policies',
405
+ value: 'Copyright 2012 Intersect Australia Ltd.'
406
+ },
407
+ licence: {
408
+ value: 'Attribution (CC BY)',
409
+ rights_uri: 'http://creativecommons.org/licenses/by/3.0',
410
+ type: ''
411
+ },
412
+ access_rights: {
413
+ value: 'Available to all without restriction'
414
+ }
415
+ }
416
+ ]
417
+ end
418
+
419
+ def activity_subjects
420
+ [
421
+ {
422
+ value: '123456',
423
+ type: 'anzsrc-for'
424
+ }
425
+ ]
426
+ end
427
+
428
+ end
429
+
430
+ class CollectionExample
431
+ require 'date'
432
+ include RIFCS::Collection
433
+
434
+ attr_reader :collection_key
435
+
436
+ def initialize(key='a key')
437
+ @collection_key = key
438
+ end
439
+
440
+ def collection_date_accessioned
441
+ Time.new(2012, 6, 14).utc
442
+ end
443
+
444
+ def collection_group
445
+ 'test group'
446
+ end
447
+
448
+ def collection_originating_source
449
+ 'tomato'
450
+ end
451
+
452
+ def collection_type
453
+ 'dataset'
454
+ end
455
+
456
+ def collection_date_modified
457
+ Time.new(2012, 6, 14).utc
458
+ end
459
+
460
+ def collection_identifiers
461
+ [
462
+ { value: 'http://example.com', type: 'uri' },
463
+ { value: '123', type: 'local' }
464
+ ]
465
+ end
466
+
467
+ def collection_names
468
+ [
469
+ {
470
+ type: 'primary',
471
+ name_parts: [
472
+ { type: 'title', value: 'Dr' },
473
+ { type: 'given', value: 'John' },
474
+ { type: 'family', value: 'Doe' }
475
+ ]
476
+ },
477
+ ]
478
+ end
479
+
480
+ def collection_related_info
481
+ [
482
+ {
483
+ type: 'website',
484
+ identifier: {
485
+ value: 'http://example.com/personalsites/foo',
486
+ type: 'uri'
487
+ },
488
+ title: 'This person\'s blog',
489
+ notes: 'Another blog'
490
+ },
491
+ {
492
+ type: 'publication',
493
+ identifier: {
494
+ value: '111',
495
+ type: 'isbn'
496
+ },
497
+ title: 'The Ordering of Things',
498
+ notes: 'Not available'
499
+ }
500
+ ]
501
+ end
502
+
503
+ def collection_related_objects
504
+ {
505
+ has_association_with: [
506
+ {
507
+ key: 'b party',
508
+ relation: {
509
+ description: 'owner'
510
+ }
511
+ }
512
+ ],
513
+ is_member_of: [
514
+ {
515
+ key: 'some group'
516
+ }
517
+ ]
518
+ }
519
+ end
520
+
521
+ def collection_locations
522
+ [
523
+ {
524
+ date_from: Time.new(2012, 6, 14).utc,
525
+ addresses: [
526
+ {
527
+ electronic: [
528
+ {
529
+ type: 'email',
530
+ value: 'joe@example.com'
531
+ },
532
+ {
533
+ type: 'uri',
534
+ value: "http://example.com/people/#{@collection_key}",
535
+ args: [
536
+ { value: 'placeholder', required: 'false' }
537
+ ]
538
+ }
539
+ ],
540
+ physical: [
541
+ {
542
+ type: 'postalAddress',
543
+ address_parts: [
544
+ {
545
+ type: 'country',
546
+ value: 'Austrlia'
547
+ },
548
+ ]
549
+ },
550
+ {
551
+ address_parts: [
552
+ {
553
+ type: 'telephoneNumber',
554
+ value: '+61 2 9123 4567'
555
+ }
556
+ ]
557
+ }
558
+ ]
559
+ }
560
+ ]
561
+ }
562
+ ]
563
+ end
564
+
565
+ def collection_coverage
566
+ [
567
+ {
568
+ spatials: [
569
+ {
570
+ value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
571
+ type: 'gml'
572
+ }
573
+ ],
574
+ temporals: [
575
+ {
576
+ dates: [
577
+ {
578
+ value: Time.new(2012, 6, 14).utc,
579
+ date_format: 'UTC',
580
+ type: 'dateFrom'
581
+ },
582
+ {
583
+ value: Time.new(2013, 6, 14).utc,
584
+ date_format: 'UTC',
585
+ type: 'dateTo'
586
+ },
587
+ ],
588
+ text: ['Self destructs in 1 year']
589
+ }
590
+ ]
591
+ }
592
+ ]
593
+ end
594
+
595
+ def collection_descriptions
596
+ [
597
+ {
598
+ value: 'A researcher',
599
+ type: 'brief',
600
+ 'xmllang' => nil
601
+ },
602
+ {
603
+ value: 'Not just any researcher',
604
+ type: 'full'
605
+ }
606
+ ]
607
+ end
608
+
609
+ def collection_existence_dates
610
+ [
611
+ {
612
+ start_date: {
613
+ value: Time.new(2012, 6, 14).utc,
614
+ date_format: 'UTC'
615
+ },
616
+ end_date: {
617
+ value: Time.new(2013, 6, 14).utc,
618
+ date_format: 'UTC'
619
+ }
620
+ }
621
+ ]
622
+ end
623
+
624
+ def collection_rights
625
+ [
626
+ {
627
+ rights_statement: {
628
+ rights_uri: 'http://www.intersect.org.au/policies',
629
+ value: 'Copyright 2012 Intersect Australia Ltd.'
630
+ },
631
+ licence: {
632
+ value: 'Attribution (CC BY)',
633
+ rights_uri: 'http://creativecommons.org/licenses/by/3.0',
634
+ type: ''
635
+ },
636
+ access_rights: {
637
+ value: 'Available to all without restriction'
638
+ }
639
+ }
640
+ ]
641
+ end
642
+
643
+ def collection_subjects
644
+ [
645
+ {
646
+ value: '123456',
647
+ type: 'anzsrc-for'
648
+ }
649
+ ]
650
+ end
651
+
652
+ def collection_citation_info
653
+ [
654
+ {
655
+ full_citation: {
656
+ style: 'Harvard',
657
+ value: 'Australian Bureau of Agricultural and Resource Economics 2001, Aquaculture development in Australia: a review of key economic issues, ABARE, Canberra.'
658
+ },
659
+ citation_metadata: {
660
+ identifier: {
661
+ type: 'isbn',
662
+ value: '1234'
663
+ },
664
+ contributor: [
665
+ {
666
+ name_parts: [
667
+ { type: 'title', value: 'Dr' },
668
+ { type: 'given', value: 'Jane' },
669
+ { type: 'family', value: 'Doe' }
670
+ ]
671
+ }
672
+ ],
673
+ title: 'Aquaculture development in Australia: a review of key economic issues',
674
+ edition: '1st',
675
+ publisher: 'ABARE',
676
+ place_published: 'Canberra',
677
+ date: [
678
+ {
679
+ value: '2012-06-14',
680
+ type: 'publicationDate'
681
+ }
682
+ ],
683
+ url: 'http://example.com',
684
+ context: 'local'
685
+ }
686
+ }
687
+ ]
688
+ end
689
+
690
+ end
691
+
692
+ class ServiceExample
693
+ include RIFCS::Service
694
+
695
+ attr_reader :service_key, :service_group
696
+
697
+ def initialize(key='service key')
698
+ @service_key = key
699
+ @service_group = 'Intersect Australia'
700
+ end
701
+
702
+ def service_originating_source
703
+ 'http://www.intersect.org.au'
704
+ end
705
+
706
+ def service_root
707
+ {
708
+ date_modified: Time.new(2012, 6, 14).utc,
709
+ type: 'create'
710
+ }
711
+ end
712
+
713
+ def service_identifiers
714
+ [
715
+ {
716
+ type: 'local',
717
+ value: 'hdl:1959.4/004_311'
718
+ }
719
+ ]
720
+ end
721
+
722
+ def service_names
723
+ [
724
+ {
725
+ :date_from => Time.new(2012, 6, 14),
726
+ :date_to => Time.new(2013, 6, 14),
727
+ :type => 'create',
728
+ :name_parts => [
729
+ {
730
+ :type => nil,
731
+ :value => 'Autolab PGSTAT 12 Potentiostat'
732
+ }
733
+ ]
734
+ }
735
+ ]
736
+ end
737
+
738
+ def service_locations
739
+ [
740
+ {
741
+ addresses: [
742
+ {
743
+ electronic: [
744
+ {
745
+ type: 'email',
746
+ value: 'joe@example.com'
747
+ },
748
+ ],
749
+ physical: [
750
+ {
751
+ type: 'postalAddress',
752
+ address_parts: [
753
+ {
754
+ type: 'country',
755
+ value: 'Austrlia'
756
+ },
757
+ ]
758
+ },
759
+ {
760
+ address_parts: [
761
+ {
762
+ type: 'telephoneNumber',
763
+ value: '+61 2 9123 4567'
764
+ }
765
+ ]
766
+ }
767
+ ]
768
+ }
769
+ ],
770
+ spatials: [
771
+ {
772
+ value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
773
+ type: 'gml'
774
+ }
775
+ ]
776
+ }
777
+ ]
778
+ end
779
+
780
+ def service_coverage
781
+ [
782
+ {
783
+ spatials: [
784
+ {
785
+ value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
786
+ type: 'gml'
787
+ }
788
+ ],
789
+ temporals: [
790
+ {
791
+ dates: [
792
+ {
793
+ value: Time.new(2012,6,14).utc,
794
+ date_format: 'UTC',
795
+ type: 'dateFrom'
796
+ },
797
+ {
798
+ value: Time.new(2013,6,14).utc,
799
+ date_format: 'UTC',
800
+ type: 'dateTo'
801
+ },
802
+ ],
803
+ text: ['Self destructs in 1 year']
804
+ }
805
+ ]
806
+ }
807
+ ]
808
+ end
809
+
810
+ def service_related_objects
811
+ {
812
+ has_association_with: [
813
+ {
814
+ key: 'http://nla.gov.au/nla.party-593921',
815
+ }
816
+ ],
817
+ is_presented_by: [
818
+ {
819
+ key: 'some group'
820
+ }
821
+ ]
822
+ }
823
+ end
824
+
825
+ def service_subjects
826
+ [
827
+ ]
828
+ end
829
+
830
+ def service_descriptions
831
+ [
832
+ {
833
+ type: 'deliverymethod',
834
+ value: 'offline'
835
+ },
836
+ {
837
+ type: 'full',
838
+ value: 'General-purpose potentiostat.'
839
+ }
840
+ ]
841
+ end
842
+
843
+ def service_access_policies
844
+ [
845
+ { value: 'http://example.com/policy' }
846
+ ]
847
+ end
848
+
849
+ def service_rights
850
+ [
851
+ {
852
+ rights_statement: {
853
+ rights_uri: 'http://www.intersect.org.au/policies',
854
+ value: 'Copyright 2012 Intersect Australia Ltd.'
855
+ },
856
+ licence: {
857
+ value: 'Attribution (CC BY)',
858
+ rights_uri: 'http://creativecommons.org/licenses/by/3.0',
859
+ type: ''
860
+ },
861
+ access_rights: {
862
+ value: 'Available to all without restriction'
863
+ }
864
+ }
865
+ ]
866
+ end
867
+
868
+ def service_existence_dates
869
+ [
870
+ {
871
+ start_date: {
872
+ value: Time.new(2012, 6, 14).utc,
873
+ date_format: 'UTC'
874
+ },
875
+ end_date: {
876
+ value: Time.new(2013, 6, 14).utc,
877
+ date_format: 'UTC'
878
+ }
879
+ }
880
+ ]
881
+ end
882
+
883
+ def service_related_info
884
+ [
885
+ {
886
+ type: 'website',
887
+ identifier: {
888
+ value: 'http://example.com/personalsites/foo',
889
+ type: 'uri'
890
+ },
891
+ title: 'This person\'s blog',
892
+ notes: 'Another blog'
893
+ },
894
+ {
895
+ type: 'publication',
896
+ identifier: {
897
+ value: '111',
898
+ type: 'isbn'
899
+ },
900
+ title: 'The Ordering of Things',
901
+ notes: 'Not available'
902
+ }
903
+ ]
904
+ end
905
+
906
+ end