citeproc-rb 0.0.1
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.
- data/README +93 -0
- data/Rakefile +73 -0
- data/TODO +25 -0
- data/VERSION +1 -0
- data/data/locales/locales_en.xml +89 -0
- data/data/locales/locales_nl.xml +96 -0
- data/data/styles/ama.csl +184 -0
- data/data/styles/apa.csl +230 -0
- data/data/styles/apsa.csl +175 -0
- data/data/styles/asa.csl +215 -0
- data/data/styles/chicago-author-date.csl +361 -0
- data/data/styles/chicago-fullnote-bibliography.csl +665 -0
- data/data/styles/chicago-note-bibliography.csl +437 -0
- data/data/styles/chicago-note.csl +383 -0
- data/data/styles/harvard.csl +185 -0
- data/data/styles/ieee.csl +111 -0
- data/data/styles/mhra.csl +317 -0
- data/data/styles/mla.csl +173 -0
- data/data/styles/nature.csl +87 -0
- data/data/styles/nlm.csl +118 -0
- data/examples/citeproc_driver.rb +174 -0
- data/lib/citeproc.rb +28 -0
- data/lib/citeproc/csl.rb +647 -0
- data/lib/citeproc/csl_parser.rb +479 -0
- data/lib/citeproc/csl_processor.rb +485 -0
- data/lib/citeproc/csl_reference.rb +228 -0
- data/lib/citeproc/filters/bibo/bibo.rb +635 -0
- data/lib/citeproc/filters/bibo/bibo_input_filter.rb +242 -0
- data/lib/citeproc/filters/bibo/bibo_utils.rb +75 -0
- data/lib/citeproc/filters/csl_citation/csl_citation.rb +137 -0
- data/lib/citeproc/filters/csl_citation/csl_citation_input_filter.rb +274 -0
- data/lib/citeproc/formatters/base_formatter.rb +115 -0
- data/lib/citeproc/formatters/xhtml_formatter.rb +144 -0
- data/lib/citeproc/input_filter.rb +97 -0
- data/test/fixtures/bibo_test_data.n3 +191 -0
- data/test/fixtures/bibo_test_data.yaml +96 -0
- data/test/fixtures/bibo_test_how_to_cook.n3 +63 -0
- data/test/fixtures/bibo_test_zotero.rdf +129 -0
- data/test/fixtures/csl_test_data.json +62 -0
- data/test/fixtures/csl_test_data.yaml +8 -0
- data/test/fixtures/locales/test_locale_en.xml +89 -0
- data/test/fixtures/styles/test_csl_parse.csl +230 -0
- data/test/fixtures/styles/test_groups.csl +32 -0
- data/test/fixtures/styles/test_names.csl +46 -0
- data/test/fixtures/styles/test_sort.csl +125 -0
- data/test/fixtures/styles/test_text_terms.csl +40 -0
- data/test/test_all.rb +14 -0
- data/test/test_bibo.rb +20 -0
- data/test/test_csl.rb +136 -0
- data/test/test_csl_parser.rb +222 -0
- data/test/test_sample_bibo.rb +82 -0
- metadata +101 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# == Synopsis
|
|
2
|
+
#
|
|
3
|
+
# Declarations of CSL constants (see http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/csl/schema/trunk/csl.rnc?view=markup)
|
|
4
|
+
#
|
|
5
|
+
# == Author
|
|
6
|
+
#
|
|
7
|
+
# Liam Magee
|
|
8
|
+
#
|
|
9
|
+
# == Copyright
|
|
10
|
+
#
|
|
11
|
+
# Copyright (c) 2007, Liam Magee.
|
|
12
|
+
# Licensed under the same terms as Ruby - see http://www.ruby-lang.org/en/LICENSE.txt.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
module Citeproc
|
|
16
|
+
INFO_FIELDS = [
|
|
17
|
+
"anthropology", "biology", "botany", "chemistry", "engineering",
|
|
18
|
+
"generic-base", "geography", "geology", "history", "literature",
|
|
19
|
+
"philosophy", "psychology", "sociology", "political_science", "zoology"
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
INFO_CLASSES = [
|
|
23
|
+
"author-date" , "numeric" , "label" , "note" , "in-text"
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
TERMS = [
|
|
27
|
+
"accessed",
|
|
28
|
+
"anonymous",
|
|
29
|
+
"and",
|
|
30
|
+
"and others",
|
|
31
|
+
"at",
|
|
32
|
+
"et-al",
|
|
33
|
+
"forthcoming",
|
|
34
|
+
"from",
|
|
35
|
+
"in press",
|
|
36
|
+
"ibid",
|
|
37
|
+
"in",
|
|
38
|
+
"no date",
|
|
39
|
+
"references",
|
|
40
|
+
"retrieved",
|
|
41
|
+
|
|
42
|
+
## Roles
|
|
43
|
+
"editor",
|
|
44
|
+
"translator",
|
|
45
|
+
|
|
46
|
+
## Months
|
|
47
|
+
"month-01",
|
|
48
|
+
"month-02",
|
|
49
|
+
"month-03",
|
|
50
|
+
"month-04",
|
|
51
|
+
"month-05",
|
|
52
|
+
"month-06",
|
|
53
|
+
"month-07",
|
|
54
|
+
"month-08",
|
|
55
|
+
"month-09",
|
|
56
|
+
"month-10",
|
|
57
|
+
"month-11",
|
|
58
|
+
"month-12"
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
LOCATOR_TERMS = [
|
|
62
|
+
"book",
|
|
63
|
+
"chapter",
|
|
64
|
+
"column",
|
|
65
|
+
"figure",
|
|
66
|
+
"folio",
|
|
67
|
+
"issue",
|
|
68
|
+
"line", "note",
|
|
69
|
+
"opus",
|
|
70
|
+
"page",
|
|
71
|
+
"paragraph",
|
|
72
|
+
"part",
|
|
73
|
+
"section",
|
|
74
|
+
"volume",
|
|
75
|
+
"verse"
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
NAMES = [
|
|
79
|
+
"author",
|
|
80
|
+
"editor",
|
|
81
|
+
"translator",
|
|
82
|
+
"recipient",
|
|
83
|
+
"interviewer",
|
|
84
|
+
"publisher",
|
|
85
|
+
"original-author",
|
|
86
|
+
"original-publisher"
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
VARIABLES = [
|
|
90
|
+
|
|
91
|
+
## the primary title for the cited item
|
|
92
|
+
"title",
|
|
93
|
+
|
|
94
|
+
## the secondary title for the cited item; for a book chapter, this
|
|
95
|
+
## would be a book title, for an article the journal title, etc.
|
|
96
|
+
"container-title",
|
|
97
|
+
|
|
98
|
+
## the tertiary title for the cited item; for example, a series title
|
|
99
|
+
"collection-title",
|
|
100
|
+
|
|
101
|
+
## title of a related original version; often useful in cases of translation
|
|
102
|
+
"original-title",
|
|
103
|
+
|
|
104
|
+
## the name of the publisher
|
|
105
|
+
"publisher",
|
|
106
|
+
|
|
107
|
+
## the location of the publisher
|
|
108
|
+
"publisher-place",
|
|
109
|
+
|
|
110
|
+
## the name of the archive
|
|
111
|
+
"archive",
|
|
112
|
+
|
|
113
|
+
## the location of the archive
|
|
114
|
+
"archive-place",
|
|
115
|
+
|
|
116
|
+
## the location within an archival collection (for example, box and folder)
|
|
117
|
+
"archive_location",
|
|
118
|
+
|
|
119
|
+
## the name or title of a related event such as a conference or hearing
|
|
120
|
+
"event",
|
|
121
|
+
|
|
122
|
+
## the location or place for the related event
|
|
123
|
+
"event-place",
|
|
124
|
+
|
|
125
|
+
##
|
|
126
|
+
"page",
|
|
127
|
+
|
|
128
|
+
## a description to locate an item within some larger container or
|
|
129
|
+
## collection; a volume or issue number is a kind of locator, for example.
|
|
130
|
+
"locator",
|
|
131
|
+
|
|
132
|
+
## version description
|
|
133
|
+
"version",
|
|
134
|
+
|
|
135
|
+
## volume number for the container periodical
|
|
136
|
+
"volume",
|
|
137
|
+
|
|
138
|
+
## refers to the number of items in multi-volume books and such
|
|
139
|
+
"number-of-volumes",
|
|
140
|
+
|
|
141
|
+
## the issue number for the container publication
|
|
142
|
+
"issue",
|
|
143
|
+
|
|
144
|
+
##
|
|
145
|
+
"chapter-number",
|
|
146
|
+
|
|
147
|
+
## medium description (DVD, CD, etc.)
|
|
148
|
+
"medium",
|
|
149
|
+
|
|
150
|
+
## the (typically publication) status of an item; for example "forthcoming"
|
|
151
|
+
"status",
|
|
152
|
+
|
|
153
|
+
## an edition description
|
|
154
|
+
"edition",
|
|
155
|
+
|
|
156
|
+
##
|
|
157
|
+
"genre",
|
|
158
|
+
|
|
159
|
+
## a short inline note, often used to refer to additional details of the resource
|
|
160
|
+
"note",
|
|
161
|
+
|
|
162
|
+
## notes made by a reader about the content of the resource
|
|
163
|
+
"annote",
|
|
164
|
+
|
|
165
|
+
##
|
|
166
|
+
"abstract",
|
|
167
|
+
|
|
168
|
+
##
|
|
169
|
+
"keyword",
|
|
170
|
+
|
|
171
|
+
## a document number; useful for reports and such
|
|
172
|
+
"number",
|
|
173
|
+
|
|
174
|
+
##
|
|
175
|
+
"URL",
|
|
176
|
+
|
|
177
|
+
##
|
|
178
|
+
"DOI",
|
|
179
|
+
|
|
180
|
+
##
|
|
181
|
+
"ISBN",
|
|
182
|
+
|
|
183
|
+
## the number used for the in-text citation mark in numeric styles
|
|
184
|
+
"citation-number",
|
|
185
|
+
|
|
186
|
+
## the label used for the in-text citation mark in label styles
|
|
187
|
+
"citation-label"
|
|
188
|
+
]
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
TYPES = [
|
|
192
|
+
"article",
|
|
193
|
+
"article-magazine",
|
|
194
|
+
"article-newspaper",
|
|
195
|
+
"article-journal",
|
|
196
|
+
"bill",
|
|
197
|
+
"book",
|
|
198
|
+
"chapter",
|
|
199
|
+
"entry",
|
|
200
|
+
"entry-dictionary",
|
|
201
|
+
"entry-encylopedia",
|
|
202
|
+
"figure",
|
|
203
|
+
"graphic",
|
|
204
|
+
"interview",
|
|
205
|
+
"legislation",
|
|
206
|
+
"legal_case",
|
|
207
|
+
"manuscript",
|
|
208
|
+
"map",
|
|
209
|
+
"motion_picture",
|
|
210
|
+
"musical_score",
|
|
211
|
+
"pamphlet",
|
|
212
|
+
"paper-conference",
|
|
213
|
+
"patent",
|
|
214
|
+
"post",
|
|
215
|
+
"post-weblog",
|
|
216
|
+
"personal_communication",
|
|
217
|
+
"report",
|
|
218
|
+
"review",
|
|
219
|
+
"review-book",
|
|
220
|
+
"song",
|
|
221
|
+
"speech",
|
|
222
|
+
"thesis",
|
|
223
|
+
"treaty",
|
|
224
|
+
"webpage"
|
|
225
|
+
]
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
end
|
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
# == Synopsis
|
|
2
|
+
#
|
|
3
|
+
# Models the Bibliographic Ontology in Ruby.
|
|
4
|
+
# See http://wiki.bibliontology.com/index.php/Ontology_Working_Draft for further details.
|
|
5
|
+
#
|
|
6
|
+
# Several liberties have been taken, based on Ruby idioms and conventions.
|
|
7
|
+
# In particular, in several cases classes have been modelled as modules, to permit
|
|
8
|
+
# multiple inheritance which is a feature of RDF/OWL. This is less than satisfactory
|
|
9
|
+
# in the case of the Collection module especially, and there may be a preferable means
|
|
10
|
+
# of handling this use case.
|
|
11
|
+
#
|
|
12
|
+
# Comments and order have been kept as close to the Bibliographic Ontology as possible,
|
|
13
|
+
# for easy reference and maintenance.
|
|
14
|
+
#
|
|
15
|
+
# == Author
|
|
16
|
+
#
|
|
17
|
+
# Liam Magee
|
|
18
|
+
#
|
|
19
|
+
# == Copyright
|
|
20
|
+
#
|
|
21
|
+
# Copyright (c) 2007, Liam Magee.
|
|
22
|
+
# Licensed under the same terms as Ruby - see http://www.ruby-lang.org/en/LICENSE.txt.
|
|
23
|
+
#
|
|
24
|
+
|
|
25
|
+
module Bibo
|
|
26
|
+
# ---------- Modules -----------
|
|
27
|
+
|
|
28
|
+
# ---------------------------------------
|
|
29
|
+
# -------- External Ontologies ----------
|
|
30
|
+
# ---------------------------------------
|
|
31
|
+
|
|
32
|
+
# Note: these classes and properties, from other ontologies, are re-used
|
|
33
|
+
# and preffered by The Bibliographic Ontology. The Bibliographic Ontology
|
|
34
|
+
# is extended by their use, but is not limited to them.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# ---------- General (RDFS) Classes -------------
|
|
38
|
+
module Generic
|
|
39
|
+
class Resource
|
|
40
|
+
attr_accessor :short_title
|
|
41
|
+
# -------- DCTERMS ----------
|
|
42
|
+
# Note: unchecked for the moment - not clear how this would be done
|
|
43
|
+
attr_accessor :date, :format, :identifier, :language, :rights, :subject, :title, :part_of, :publisher
|
|
44
|
+
|
|
45
|
+
def initialize(title = nil)
|
|
46
|
+
@title = title
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Includes the Generic (RDFS) module
|
|
53
|
+
include Generic
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# --------- wgs84_pos -------------
|
|
57
|
+
#
|
|
58
|
+
# See http://www.w3.org/2003/01/geo/wgs84_pos
|
|
59
|
+
#
|
|
60
|
+
module Wgs84_pos
|
|
61
|
+
class SpatialThing
|
|
62
|
+
attr_accessor :name # NB: Not from bibliontology
|
|
63
|
+
|
|
64
|
+
# Probably should be some datatype?
|
|
65
|
+
attr_accessor :latitude, :longitude, :altitude
|
|
66
|
+
attr_accessor :based_near
|
|
67
|
+
|
|
68
|
+
def initialize(latitude, longitude, altitude)
|
|
69
|
+
@latitude = latitude
|
|
70
|
+
@longitude = longitude
|
|
71
|
+
@altitude = altitude
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def initialize(name = nil)
|
|
75
|
+
@name = name
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def based_near=(value)
|
|
79
|
+
if !value.kind_of?(SpatialThing)
|
|
80
|
+
raise(ArgumentError, "based_near #{value} isn't an SpatialThing")
|
|
81
|
+
end
|
|
82
|
+
@based_near = value
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# For completeness' sake
|
|
87
|
+
class Point
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Includes the Wgs84_pos module
|
|
93
|
+
include Wgs84_pos
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# --------- Time -------------
|
|
97
|
+
#
|
|
98
|
+
# See http://www.w3.org/2006/time
|
|
99
|
+
#
|
|
100
|
+
# Modelled very simply - Interval has a a start and end Time, Instant only one time
|
|
101
|
+
#
|
|
102
|
+
module Times
|
|
103
|
+
class TemporalEntity
|
|
104
|
+
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
class Interval < TemporalEntity
|
|
108
|
+
attr_accessor :start, :end
|
|
109
|
+
|
|
110
|
+
def initialize(s, e)
|
|
111
|
+
@start = s
|
|
112
|
+
@end = e
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def start=(value)
|
|
116
|
+
if !value.kind_of?(Time)
|
|
117
|
+
raise(ArgumentError, "start time #{value} isn't a Time")
|
|
118
|
+
end
|
|
119
|
+
@start = value
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def end=(value)
|
|
123
|
+
if !value.kind_of?(Time)
|
|
124
|
+
raise(ArgumentError, "end time #{value} isn't a Time")
|
|
125
|
+
end
|
|
126
|
+
@end = value
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
class Instant < TemporalEntity
|
|
131
|
+
attr_accessor :point_in_time
|
|
132
|
+
|
|
133
|
+
def initialize(point_in_time)
|
|
134
|
+
@point_in_time = point_in_time
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def point_in_time=(value)
|
|
138
|
+
if !value.kind_of?(Time)
|
|
139
|
+
raise(ArgumentError, "point in time #{value} isn't a Time")
|
|
140
|
+
end
|
|
141
|
+
@point_in_time = value
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Includes the time module
|
|
148
|
+
include Times
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# --------- FOAF -------------
|
|
152
|
+
#
|
|
153
|
+
# See http://xmlns.com/foaf/spec/
|
|
154
|
+
#
|
|
155
|
+
module FOAF
|
|
156
|
+
|
|
157
|
+
class Agent
|
|
158
|
+
# Defined by FOAF (just the basics - see http://xmlns.com/foaf/spec/)
|
|
159
|
+
attr_accessor :name, :nick, :title, :homepage, :mbox, :mbox_sha1sum, :img, :depiction
|
|
160
|
+
# Not sure what to do with these? :surname, :family_name, :givenname, :firstName
|
|
161
|
+
# Defined by Bibliographic Ontology
|
|
162
|
+
attr_accessor :given_name, :family_name, :prefix_name, :suffix_name
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
class Person < Agent
|
|
166
|
+
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
class Organisation < Agent
|
|
170
|
+
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Includes the FOAF module
|
|
175
|
+
include FOAF
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
# ------- Event ---------
|
|
180
|
+
#
|
|
181
|
+
# See http://purl.org/NET/c4dm/event.owl#
|
|
182
|
+
#
|
|
183
|
+
module Events
|
|
184
|
+
class Event
|
|
185
|
+
attr_accessor :name # NB: Not from bibliontology
|
|
186
|
+
attr_accessor :agent, :product, :sub_event, :time, :place
|
|
187
|
+
|
|
188
|
+
def agent=(value)
|
|
189
|
+
if !value.kind_of?(FOAF::Agent)
|
|
190
|
+
raise(ArgumentError, "agent #{value} isn't an Agent")
|
|
191
|
+
end
|
|
192
|
+
@agent = value
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def sub_event=(value)
|
|
196
|
+
if !value.kind_of?(Event)
|
|
197
|
+
raise(ArgumentError, "sub-event #{value} isn't an Event")
|
|
198
|
+
end
|
|
199
|
+
@sub_event = value
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def time=(value)
|
|
203
|
+
if !value.kind_of?(Times::TemporalEntity)
|
|
204
|
+
raise(ArgumentError, "time #{value} isn't an TemporalEntity")
|
|
205
|
+
end
|
|
206
|
+
@time = value
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def place=(value)
|
|
210
|
+
if !value.kind_of?(Wgs84_pos::SpatialThing)
|
|
211
|
+
raise(ArgumentError, "place #{value} isn't an SpatialThing")
|
|
212
|
+
end
|
|
213
|
+
@place = value
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Includes the Event module
|
|
219
|
+
include Events
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
# Note: Pseudo-classes, designed as modules to permit Ruby mixins
|
|
223
|
+
|
|
224
|
+
module PersonalCommunication
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
module Collection
|
|
229
|
+
attr_accessor :documents
|
|
230
|
+
# ------ Document Identifier Type -----------
|
|
231
|
+
attr_accessor :identifier, :isbn10, :isbn13, :asin, :coden, :uri, :doi
|
|
232
|
+
attr_accessor :oclcnum, :issn, :eissn, :sici, :lccn, :eanucc13, :upc, :gtin14
|
|
233
|
+
|
|
234
|
+
def initialize
|
|
235
|
+
@documents = []
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def add_document(doc)
|
|
239
|
+
@documents << doc
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
# ---------- Classes -----------
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
# ---------- Document -----------
|
|
251
|
+
|
|
252
|
+
class Document < Resource
|
|
253
|
+
# How to represent rdfs:Resource for review_of and transcript_of relations?
|
|
254
|
+
# ---------- Relations --------------
|
|
255
|
+
attr_accessor :translation_of, :review_of, :transcript_of, :content, :presented_at
|
|
256
|
+
# --------- numbers ----------------
|
|
257
|
+
attr_accessor :locator, :page_start, :page_end, :pages, :volume, :issue, :number
|
|
258
|
+
# ----------- status ------------------
|
|
259
|
+
attr_accessor :status
|
|
260
|
+
# ----------- Editions ----------------
|
|
261
|
+
attr_accessor :edition, :language
|
|
262
|
+
# ------ Document Identifier Type -----------
|
|
263
|
+
attr_accessor :identifier, :isbn10, :isbn13, :asin, :coden, :uri, :doi, :pmid
|
|
264
|
+
attr_accessor :oclcnum, :issn, :eissn, :sici, :lccn, :eanucc13, :upc, :gtin14
|
|
265
|
+
# ----- contribution properties ----
|
|
266
|
+
attr_accessor :contributions
|
|
267
|
+
|
|
268
|
+
# NB: Not from bibliontology
|
|
269
|
+
# ----- general properties ----
|
|
270
|
+
attr_accessor :abstract, :keyword, :place, :version, :genre, :note, :annote # NB: Not from bibliontology
|
|
271
|
+
# ----- locator properties ----
|
|
272
|
+
attr_accessor :locator_type, :accessed
|
|
273
|
+
# ----- collection properties ----
|
|
274
|
+
attr_accessor :belongs_to # NB: Not from bibliontology
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def initialize(title = nil)
|
|
278
|
+
super(title)
|
|
279
|
+
@contributions = []
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def translation_of=(value)
|
|
283
|
+
if !value.kind_of?(Document)
|
|
284
|
+
raise(ArgumentError, "Translaion of #{value} isn't a Document")
|
|
285
|
+
end
|
|
286
|
+
@translation_of = value
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def review_of=(value)
|
|
290
|
+
if !value.kind_of?(Generic::Resource)
|
|
291
|
+
raise(ArgumentError, "Review of #{value} isn't a Resource")
|
|
292
|
+
end
|
|
293
|
+
@review_of = value
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def transcript_of=(value)
|
|
297
|
+
if !value.kind_of?(Generic::Resource)
|
|
298
|
+
raise(ArgumentError, "Transcript of #{value} isn't a Resource")
|
|
299
|
+
end
|
|
300
|
+
@transcript_of = value
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
def presented_at=(value)
|
|
304
|
+
if !value.kind_of?(Events::Event)
|
|
305
|
+
raise(ArgumentError, "Presented at #{value} isn't an Event")
|
|
306
|
+
end
|
|
307
|
+
@presented_at = value
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
def status=(value)
|
|
311
|
+
if !value.kind_of?(DocumentStatus)
|
|
312
|
+
raise(ArgumentError, "Status #{value} isn't a DocumentStatus")
|
|
313
|
+
end
|
|
314
|
+
@status = value
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def add_contribution(contribution)
|
|
318
|
+
if !contribution.kind_of?(Contribution)
|
|
319
|
+
raise(ArgumentError, "#{contribution} isn't a Contribution")
|
|
320
|
+
end
|
|
321
|
+
@contributions << contribution
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
def each_contribution(&block)
|
|
325
|
+
@contributions.each(&block)
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
# Find some way to simultate MI on the Collection class here
|
|
331
|
+
class CollectedDocument < Document
|
|
332
|
+
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
class PersonalCommunicationDocument < Document
|
|
336
|
+
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
# ---------- Roles -------------
|
|
341
|
+
|
|
342
|
+
class Role
|
|
343
|
+
attr_accessor :name # NB: Not from bibliontology
|
|
344
|
+
|
|
345
|
+
def initialize(name)
|
|
346
|
+
@name = name
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
class ContributionRole < Role
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
# ------- Thesis Degrees -------
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
class ThesisDegree
|
|
358
|
+
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
# Note: see individuals (artifact) file for a list of "Contribution Roles".
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
# ---------- Events Types -------------
|
|
365
|
+
|
|
366
|
+
# Note: see individuals (artifact) file for a list of "event types".
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
# ---------- Status -------------
|
|
370
|
+
|
|
371
|
+
class DocumentStatus
|
|
372
|
+
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# Note: see individuals (artifact) file for a list of "status".
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
# ---------- Collections -----------
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
class Series
|
|
383
|
+
# Needs to explicitly mixin Collection
|
|
384
|
+
include Collection
|
|
385
|
+
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
class Periodical
|
|
390
|
+
# Needs to explicitly mixin Collection
|
|
391
|
+
include Collection
|
|
392
|
+
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
# Note: all parts must be Articles
|
|
397
|
+
class Journal < Periodical
|
|
398
|
+
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
# Note: Can only have 1 part
|
|
403
|
+
class Newspaper < Periodical
|
|
404
|
+
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
# Note: all parts must be Articles
|
|
409
|
+
class Magazine < Periodical
|
|
410
|
+
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
class Article < Document
|
|
415
|
+
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
# Note: all parts must be LegalDocuments
|
|
420
|
+
class CourtReporter < Periodical
|
|
421
|
+
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
# Note: all parts must be Legislation
|
|
426
|
+
class Code < Periodical
|
|
427
|
+
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
class LegalDocument < Document
|
|
432
|
+
# ---------- Relations --------------
|
|
433
|
+
attr_accessor :court
|
|
434
|
+
# ----------- Editions ----------------
|
|
435
|
+
attr_accessor :argued
|
|
436
|
+
|
|
437
|
+
def court=(value)
|
|
438
|
+
if !value.kind_of?(FOAF::Organisation)
|
|
439
|
+
raise(ArgumentError, "Court #{value} isn't an Organisation")
|
|
440
|
+
end
|
|
441
|
+
@court = value
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
def argued=(value)
|
|
445
|
+
if !value.kind_of?(Time)
|
|
446
|
+
raise(ArgumentError, "The argued value: #{value} isn't an instance of Time")
|
|
447
|
+
end
|
|
448
|
+
@court = value
|
|
449
|
+
end
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
class Manuscript < Document
|
|
454
|
+
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
class Book < Document
|
|
459
|
+
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
class AudioDocument < Document
|
|
464
|
+
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
class AudioVisualDocument < Document
|
|
469
|
+
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
class EditedBook < CollectedDocument
|
|
474
|
+
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
class Manual < Document
|
|
479
|
+
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
class Legislation < LegalDocument
|
|
484
|
+
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
class Patent < Document
|
|
489
|
+
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
class Report < Document
|
|
494
|
+
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
class Thesis < Document
|
|
499
|
+
# ----------- degree ------------------
|
|
500
|
+
attr_accessor :degree
|
|
501
|
+
|
|
502
|
+
def degree=(value)
|
|
503
|
+
if !value.kind_of?(ThesisDegree)
|
|
504
|
+
raise(ArgumentError, "Degree #{value} isn't an Degree")
|
|
505
|
+
end
|
|
506
|
+
@degree = value
|
|
507
|
+
end
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
class Bill < Legislation
|
|
512
|
+
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
class Statute < Legislation
|
|
517
|
+
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
class Brief < LegalDocument
|
|
522
|
+
|
|
523
|
+
end
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
class Decision < LegalDocument
|
|
527
|
+
|
|
528
|
+
end
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
class Transcript < Document
|
|
532
|
+
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
# doesn't distinguish an interview from how it's manifest; e.g.
|
|
537
|
+
# what about radio or tv or podcost interviews?
|
|
538
|
+
class Interview < Transcript
|
|
539
|
+
|
|
540
|
+
end
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
class Dissertation < Thesis
|
|
544
|
+
|
|
545
|
+
end
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
class Letter < PersonalCommunicationDocument
|
|
549
|
+
|
|
550
|
+
end
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
class Proceedings
|
|
554
|
+
include Collection
|
|
555
|
+
|
|
556
|
+
end
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
# ---- a Contribution ----
|
|
560
|
+
class Contribution
|
|
561
|
+
attr_accessor :contributor, :role, :position
|
|
562
|
+
|
|
563
|
+
def initialize(contributor = nil, role = nil, position = 1)
|
|
564
|
+
@contributor = contributor
|
|
565
|
+
@role = role
|
|
566
|
+
@position = position
|
|
567
|
+
end
|
|
568
|
+
|
|
569
|
+
def contributor=(value)
|
|
570
|
+
if !value.kind_of?(Agent)
|
|
571
|
+
raise(ArgumentError, "Contributor #{value} isn't an Agent")
|
|
572
|
+
end
|
|
573
|
+
@contributor = value
|
|
574
|
+
end
|
|
575
|
+
|
|
576
|
+
def role=(value)
|
|
577
|
+
if !value.kind_of?(Role)
|
|
578
|
+
raise(ArgumentError, "Role #{value} isn't a Role")
|
|
579
|
+
end
|
|
580
|
+
@role = value
|
|
581
|
+
end
|
|
582
|
+
|
|
583
|
+
def position=(value)
|
|
584
|
+
if !value.kind_of?(Integer)
|
|
585
|
+
raise(ArgumentError, "Position #{value} isn't an Integer")
|
|
586
|
+
end
|
|
587
|
+
@position = value
|
|
588
|
+
end
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
# ------------- Individuals -------------
|
|
594
|
+
|
|
595
|
+
# ------- Event Types ---------
|
|
596
|
+
|
|
597
|
+
# Perhaps need a separate EventType class for these?
|
|
598
|
+
CONFERENCE = Event.new
|
|
599
|
+
HEARING = Event.new
|
|
600
|
+
WORKSHOP = Event.new
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
# ------- Document Status --------
|
|
604
|
+
|
|
605
|
+
PUBLISHED = DocumentStatus.new
|
|
606
|
+
UNPUBLISHED = DocumentStatus.new
|
|
607
|
+
DRAFT = DocumentStatus.new
|
|
608
|
+
FORTHCOMING = DocumentStatus.new
|
|
609
|
+
PEER_REVIEWED = DocumentStatus.new
|
|
610
|
+
NON_PEER_REVIEWED = DocumentStatus.new
|
|
611
|
+
REJECTED = DocumentStatus.new
|
|
612
|
+
ACCEPTED = DocumentStatus.new
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
# ------- Role Types --------
|
|
616
|
+
|
|
617
|
+
CONTRIBUTOR = ContributionRole.new("contributor")
|
|
618
|
+
AUTHOR = ContributionRole.new("author")
|
|
619
|
+
EDITOR = ContributionRole.new("editor")
|
|
620
|
+
TRANSLATOR = ContributionRole.new("translator")
|
|
621
|
+
INTERVIEWER = ContributionRole.new("interviewer")
|
|
622
|
+
INTERVIEWEE = ContributionRole.new("interviewee")
|
|
623
|
+
RECIPIENT = ContributionRole.new("recipient")
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
# ------ Thesis Degree Type -----------
|
|
627
|
+
|
|
628
|
+
MASTER = ThesisDegree.new
|
|
629
|
+
PHD = ThesisDegree.new
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
end
|
|
635
|
+
|