glossarist 2.0.1 → 2.0.2
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.
- checksums.yaml +4 -4
- data/README.adoc +319 -2
- data/lib/glossarist/managed_concept_collection.rb +2 -0
- data/lib/glossarist/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 550f2f9abb0af4adf53b54b99bb00eb40b7bac9b1a3dfb96971a2819f524d0af
|
4
|
+
data.tar.gz: 58f56b76ae70724248439a06ed2bd45d851cb1e3a135c4e6488efc2c918c7e88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3d0e053d7da22e44b70ca26bddfc20981cc03d62a13584d17e1f8883cd072f46ec172c46808437e4d73956a2faf4d61adb51b61a486772d52a6e2339030b400
|
7
|
+
data.tar.gz: 1ea25c4c4ffcc7171cc60e58ba3a4e478d4e0b734037faafcc29790176a1bc72758d79323fa3c5b8365de270f5672a02f4d55c8e5275c0361610f6e2850bfea0
|
data/README.adoc
CHANGED
@@ -1,11 +1,328 @@
|
|
1
|
+
:glossarist_model_url: https://github.com/glossarist/concept-model/tree/main
|
2
|
+
:glossarist_model_v2_schema_url: https://github.com/glossarist/concept-model/tree/main/yaml_schemas
|
3
|
+
|
1
4
|
= Glossarist
|
2
5
|
|
6
|
+
Glossarist gem implements the {glossarist_model_url}[Glossarist model] in ruby. All the entities in the model are available as classes and all the attributes are available as methods of those classes.
|
7
|
+
This gem also allows you to read/write data to concept dataset or create your own collection and save that to glossarist model V2 dataset.
|
8
|
+
|
9
|
+
== Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
[,ruby]
|
14
|
+
----
|
15
|
+
gem 'glossarist'
|
16
|
+
----
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
[,bash]
|
20
|
+
----
|
21
|
+
bundle install
|
22
|
+
----
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
[,bash]
|
26
|
+
----
|
27
|
+
gem install glossarist
|
28
|
+
----
|
29
|
+
|
30
|
+
== Usage
|
31
|
+
|
32
|
+
=== Reading a Glossarist model V2 from files
|
33
|
+
|
34
|
+
To load the glossarist model V2 dataset
|
35
|
+
|
36
|
+
[,ruby]
|
37
|
+
----
|
38
|
+
collection = Glossarist::ManagedConceptCollection.new
|
39
|
+
collection.load_from_files("path/to/glossarist-v2-dataset")
|
40
|
+
----
|
41
|
+
|
42
|
+
=== Writing a Glossarist model V2 to files
|
43
|
+
|
44
|
+
To wite the glossarist model V2 dataset to files
|
45
|
+
|
46
|
+
[,ruby]
|
47
|
+
----
|
48
|
+
collection = Glossarist::ManagedConceptCollection.new
|
49
|
+
collection.load_from_files("path/to/glossarist-v2-dataset")
|
50
|
+
|
51
|
+
# ... Update the collection ...
|
52
|
+
|
53
|
+
collection.save_to_files("path/to/glossarist-v2-dataset")
|
54
|
+
----
|
55
|
+
|
56
|
+
=== ManagedConceptCollection
|
57
|
+
|
58
|
+
This is a collection for <<managed-concept,managed concepts>>. It includes the ruby 'Enumerable' module.
|
59
|
+
|
60
|
+
[,ruby]
|
61
|
+
----
|
62
|
+
collection = Glossarist::ManagedConceptCollection.new
|
63
|
+
----
|
64
|
+
|
65
|
+
[[id,managed-concept]]
|
66
|
+
=== ManagedConcept
|
67
|
+
|
68
|
+
Following fields are available for ManagedConcept:
|
69
|
+
|
70
|
+
id:: String identifier for the concept
|
71
|
+
uuid:: UUID for the concept
|
72
|
+
related:: Array of <<related-concept,RelatedConcept>>
|
73
|
+
status:: Enum for the normative status of the term.
|
74
|
+
dates:: Array of <<concept-date,ConceptDate>>
|
75
|
+
localized_concepts:: Hash of all localizations where keys are language codes and values are uuid of the localized concept.
|
76
|
+
groups:: Array of groups in string format
|
77
|
+
localizations:: Hash of all localizations for this concept where keys are language codes and values are instances of <<localized-concept,LocalizedConcept>>.
|
78
|
+
|
79
|
+
There are two ways to initialize and populate a managed concept
|
80
|
+
|
81
|
+
1. Setting the fields by using a hash while initializing
|
82
|
+
+
|
83
|
+
[,ruby]
|
84
|
+
----
|
85
|
+
concept = Glossarist::ManagedConcept.new({
|
86
|
+
"data" => {
|
87
|
+
"id" => "123",
|
88
|
+
"localized_concepts" => {
|
89
|
+
"ara" => "<uuid>",
|
90
|
+
"eng" => "<uuid>"
|
91
|
+
},
|
92
|
+
"localizations" => <Array of localized concepts or localized concept hashes>,
|
93
|
+
"groups" => [
|
94
|
+
"foo",
|
95
|
+
"bar",
|
96
|
+
],
|
97
|
+
},
|
98
|
+
})
|
99
|
+
----
|
100
|
+
|
101
|
+
2. Setting the fields after creating an object
|
102
|
+
+
|
103
|
+
[,ruby]
|
104
|
+
----
|
105
|
+
concept = Glossarist::ManagedConcept.new
|
106
|
+
concept.id = "123"
|
107
|
+
concept.groups = ["foo", "bar"]
|
108
|
+
concept.localizations = <Array of localized concepts or localized concept hashes>
|
109
|
+
----
|
110
|
+
|
111
|
+
[[id,localized-concept]]
|
112
|
+
=== LocalizedConcept
|
113
|
+
|
114
|
+
Localizations of the term to different languages.
|
115
|
+
|
116
|
+
Localized concept has the following fields
|
117
|
+
|
118
|
+
id:: An optional identifier for the term, to be used in cross-references.
|
119
|
+
uuid:: UUID for the concept
|
120
|
+
designations:: Array of <<designation,Designations>> under which the term being defined is known. This method will also accept an array of hashes for designation and will convert them to their respective classes.
|
121
|
+
domain:: An optional semantic domain for the term being defined, in case the term is ambiguous between several semantic domains.
|
122
|
+
subject:: Subject of the term.
|
123
|
+
definition:: Array of <<detailed-definition,Detailed Definition>> of the term.
|
124
|
+
non_verb_rep:: Array of <<non-verbal,non-verbal>> representations used to help define the term.
|
125
|
+
notes:: Zero or more notes about the term. A note is in <<detailed-definition,Detailed Definition>> format.
|
126
|
+
examples:: Zero or more examples of how the term is to be used in <<detailed-definition,Detailed Definition>> format.
|
127
|
+
language_code:: The language of the localization, as an ISO-639 3-letter code.
|
128
|
+
entry_status:: Entry status of the concept. Must be one of the following: +notValid+, +valid+, +superseded+, +retired+.
|
129
|
+
classification:: Classification of the concept. Must be one of the following: +preferred+, +admitted+, +deprecated+.
|
130
|
+
|
131
|
+
[[id,designation]]
|
132
|
+
=== Designation::Base
|
133
|
+
|
134
|
+
A name under which a managed term is known.
|
135
|
+
|
136
|
+
Methods::
|
137
|
+
`from_h(options)`::: Creates a new designation instance based on the specified type.
|
138
|
+
|
139
|
+
Parameters::
|
140
|
+
* options (Hash) - The options for creating the designation.
|
141
|
+
* "type" (String) - The type of designation (expression, symbol, abbreviation, graphical_symbol, letter_symbol). Note: type key should be string and not a symbol so { type: "expression" } will not work.
|
142
|
+
* Additional options depend on the specific designation type.
|
143
|
+
|
144
|
+
Returns::
|
145
|
+
Designation::{type}::: A new instance of specified type. e.g `Glossarist::Designation::Base.from_h("type" => "expression")` will return `Glossarist::Designation::Expression`
|
146
|
+
|
147
|
+
Example
|
148
|
+
[,ruby]
|
149
|
+
----
|
150
|
+
# Example usage of Designation::Base class
|
151
|
+
|
152
|
+
attributes_for_expression = { designation: "foobar", geographical_area: "abc", normative_status: "status" }
|
153
|
+
designation_expression = Designation::Base.from_h({ "type" => "expression" }.merge(attributes_for_expression))
|
154
|
+
|
155
|
+
attributes_for_abbreviation = { designation: "foobar", geographical_area: "abc", normative_status: "status", international: true }
|
156
|
+
designation_abbreviation = Designation::Base.from_h({ "type" => "abbreviation" }.merge(attributes_for_abbreviation))
|
157
|
+
|
158
|
+
----
|
159
|
+
|
160
|
+
[[id,related-concept]]
|
161
|
+
=== RelatedConcept
|
162
|
+
|
163
|
+
A term related to the current term.
|
164
|
+
|
165
|
+
Following fields are available for the Related Concept
|
166
|
+
|
167
|
+
type:: An enum to denote the relation of the term to the current term.
|
168
|
+
content:: The designation of the related term.
|
169
|
+
ref:: A <<citation, citation>> of the related term, in a Termbase.
|
170
|
+
|
171
|
+
There are two ways to initialize and populate a related concept
|
172
|
+
|
173
|
+
1. Setting the fields by using a hash while initializing
|
174
|
+
+
|
175
|
+
[,ruby]
|
176
|
+
----
|
177
|
+
related_concept = Glossarist::RelatedConcept.new({
|
178
|
+
content: "Test content",
|
179
|
+
type: :supersedes,
|
180
|
+
ref: <concept citation>
|
181
|
+
})
|
182
|
+
----
|
183
|
+
|
184
|
+
2. Setting the fields after creating an object
|
185
|
+
+
|
186
|
+
[,ruby]
|
187
|
+
----
|
188
|
+
related_concept = Glossarist::RelatedConcept.new
|
189
|
+
related_concept.type = "supersedes"
|
190
|
+
related_concept.content = "designation of the related concept"
|
191
|
+
related_concept.ref = <Citation object>
|
192
|
+
----
|
193
|
+
|
194
|
+
[[id,concept-date]]
|
195
|
+
=== Concept Date
|
196
|
+
|
197
|
+
A date relevant to the lifecycle of the managed term.
|
198
|
+
|
199
|
+
Following fields are available for the Concept Date
|
200
|
+
|
201
|
+
- date: The date associated with the managed term in Iso8601Date format.
|
202
|
+
- type: An enum to denote the event which occured on the given date and associated with the lifecycle of the managed term.
|
203
|
+
|
204
|
+
There are two ways to initialize and populate a concept date
|
205
|
+
|
206
|
+
1. Setting the fields by using a hash while initializing
|
207
|
+
+
|
208
|
+
[,ruby]
|
209
|
+
----
|
210
|
+
concept_date = Glossarist::ConceptDate.new({
|
211
|
+
date: "2010-11-01T00:00:00.000Z",
|
212
|
+
type: :accepted,
|
213
|
+
})
|
214
|
+
----
|
215
|
+
|
216
|
+
2. Setting the fields after creating an object
|
217
|
+
+
|
218
|
+
[,ruby]
|
219
|
+
----
|
220
|
+
concept_date = Glossarist::ConceptDate.new
|
221
|
+
concept_date.type = :accepted
|
222
|
+
concept_date.date = "2010-11-01T00:00:00.000Z"
|
223
|
+
----
|
224
|
+
|
225
|
+
[[id,detailed-definition]]
|
226
|
+
=== DetailedDefinition
|
227
|
+
|
228
|
+
A definition of the managed term.
|
229
|
+
|
230
|
+
It has the following attributes:
|
231
|
+
|
232
|
+
content:: The text of the definition of the managed term.
|
233
|
+
sources:: List of Bibliographic references(<<citation,Citation>>) for this particular definition of the managed term.
|
234
|
+
|
235
|
+
There are two ways to initialize and populate a detailed definition
|
236
|
+
|
237
|
+
1. Setting the fields by using a hash while initializing
|
238
|
+
+
|
239
|
+
[,ruby]
|
240
|
+
----
|
241
|
+
detailed_definition = Glossarist::DetailedDefinition.new({
|
242
|
+
content: "plain text reference",
|
243
|
+
sources: [<list of citations>],
|
244
|
+
})
|
245
|
+
----
|
246
|
+
|
247
|
+
2. Setting the fields after creating an object
|
248
|
+
+
|
249
|
+
[,ruby]
|
250
|
+
----
|
251
|
+
detailed_definition = Glossarist::DetailedDefinition.new
|
252
|
+
detailed_definition.content = "plain text reference",
|
253
|
+
detailed_definition.sources = [<list of citations>]
|
254
|
+
----
|
255
|
+
|
256
|
+
[[id,citation]]
|
257
|
+
=== Citation
|
258
|
+
|
259
|
+
Citation can be either structured or unstructured. A citation is structured if its reference contains one or all of the following keys `{ id: "id", source: "source", version: "version"}` and is unstructured if its reference is plain text. This also has 2 methods `structured?` and `plain?` to check if citation is structured or not.
|
260
|
+
|
261
|
+
Citation has the following attributes.
|
262
|
+
|
263
|
+
ref:: A hash or string based on type of citation. Hash if citation is structured or string if citation is plain.
|
264
|
+
clause:: Referred clause of the document.
|
265
|
+
link:: Link to document.
|
266
|
+
|
267
|
+
There are two ways to initialize and populate a Citation
|
268
|
+
|
269
|
+
1. Setting the fields by using a hash while initializing
|
270
|
+
+
|
271
|
+
[,ruby]
|
272
|
+
----
|
273
|
+
# Unstructured Citation
|
274
|
+
citation = Glossarist::Citation.new({
|
275
|
+
ref: "plain text reference",
|
276
|
+
clause: "clause",
|
277
|
+
link: "link",
|
278
|
+
})
|
279
|
+
|
280
|
+
# Structured Citation
|
281
|
+
citation = Glossarist::Citation.new({
|
282
|
+
ref: { id: "123", source: "source", version: "1.1" },
|
283
|
+
clause: "clause",
|
284
|
+
link: "link",
|
285
|
+
})
|
286
|
+
----
|
287
|
+
|
288
|
+
2. Setting the fields after creating an object
|
289
|
+
+
|
290
|
+
[,ruby]
|
291
|
+
----
|
292
|
+
citation = Glossarist::Citation.new
|
293
|
+
citation.ref = <plain or structured ref>
|
294
|
+
citation.clause = "some clause"
|
295
|
+
----
|
296
|
+
|
297
|
+
=== NonVerbRep
|
298
|
+
|
299
|
+
Non-verbal Representation have the following fields
|
300
|
+
|
301
|
+
image:: An image used to help define a term.
|
302
|
+
table:: A table used to help define a term.
|
303
|
+
formula:: A formula used to help define a term.
|
304
|
+
sources:: Bibliographic <<concept-source,concept source>> for the non-verbal representation of the term.
|
305
|
+
|
306
|
+
[[id,concept-source]]
|
307
|
+
=== ConceptSource
|
308
|
+
|
309
|
+
Concept Source has the following fields
|
310
|
+
|
311
|
+
status:: The status of the managed term in the present context, relative to the term as found in the bibliographic source.
|
312
|
+
type:: The type of the managed term in the present context.
|
313
|
+
origin:: The bibliographic <<citation,citation>> for the managed term. This is also aliased as `ref`.
|
314
|
+
modification:: A description of the modification to the cited definition of the term, if any, as it is to be applied in the present context.
|
315
|
+
|
316
|
+
|
3
317
|
== Commands
|
4
318
|
|
5
|
-
`generate_latex
|
319
|
+
`generate_latex`:: Convert Concepts to Latex format
|
6
320
|
|
7
321
|
=== Usage:
|
8
|
-
|
322
|
+
[,bash]
|
323
|
+
----
|
324
|
+
glossarist generate_latex p, --concepts-path=CONCEPTS_PATH
|
325
|
+
----
|
9
326
|
|
10
327
|
=== Options:
|
11
328
|
[cols="1,1"]
|
data/lib/glossarist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glossarist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: relaton
|