glossarist 2.6.5 → 2.6.7

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.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +1 -4
  3. data/.rubocop_todo.yml +53 -2
  4. data/CLAUDE.md +27 -2
  5. data/README.adoc +532 -56
  6. data/config.yml +68 -1
  7. data/glossarist.gemspec +2 -0
  8. data/lib/glossarist/citation.rb +26 -123
  9. data/lib/glossarist/cli/compare_command.rb +106 -0
  10. data/lib/glossarist/cli/export_command.rb +11 -14
  11. data/lib/glossarist/cli/validate_command.rb +111 -20
  12. data/lib/glossarist/cli.rb +18 -0
  13. data/lib/glossarist/collections/bibliography_collection.rb +4 -2
  14. data/lib/glossarist/collections/localization_collection.rb +2 -0
  15. data/lib/glossarist/comparison_result.rb +35 -0
  16. data/lib/glossarist/concept.rb +1 -1
  17. data/lib/glossarist/concept_collector.rb +44 -0
  18. data/lib/glossarist/concept_comparator.rb +72 -0
  19. data/lib/glossarist/concept_data.rb +20 -0
  20. data/lib/glossarist/concept_diff.rb +15 -0
  21. data/lib/glossarist/concept_document.rb +11 -0
  22. data/lib/glossarist/concept_manager.rb +19 -5
  23. data/lib/glossarist/concept_ref.rb +13 -0
  24. data/lib/glossarist/concept_reference.rb +12 -19
  25. data/lib/glossarist/concept_validator.rb +6 -1
  26. data/lib/glossarist/context_configuration.rb +90 -0
  27. data/lib/glossarist/dataset_validator.rb +8 -4
  28. data/lib/glossarist/designation/abbreviation.rb +0 -2
  29. data/lib/glossarist/designation/base.rb +21 -1
  30. data/lib/glossarist/designation/expression.rb +3 -0
  31. data/lib/glossarist/designation/letter_symbol.rb +0 -4
  32. data/lib/glossarist/designation/prefix.rb +17 -0
  33. data/lib/glossarist/designation/suffix.rb +17 -0
  34. data/lib/glossarist/designation/symbol.rb +0 -2
  35. data/lib/glossarist/gcr_metadata.rb +7 -14
  36. data/lib/glossarist/gcr_package.rb +35 -23
  37. data/lib/glossarist/gcr_validator.rb +38 -17
  38. data/lib/glossarist/glossary_definition.rb +5 -0
  39. data/lib/glossarist/localized_concept.rb +8 -0
  40. data/lib/glossarist/managed_concept.rb +39 -6
  41. data/lib/glossarist/managed_concept_data.rb +22 -2
  42. data/lib/glossarist/non_verb_rep.rb +21 -6
  43. data/lib/glossarist/pronunciation.rb +32 -0
  44. data/lib/glossarist/rdf/ext/jsonld_transform_ext.rb +208 -0
  45. data/lib/glossarist/rdf/ext/mapping_ext.rb +37 -0
  46. data/lib/glossarist/rdf/ext/mapping_rule_ext.rb +27 -0
  47. data/lib/glossarist/rdf/ext/member_rule_ext.rb +34 -0
  48. data/lib/glossarist/rdf/ext/turtle_transform_ext.rb +222 -0
  49. data/lib/glossarist/rdf/ext.rb +39 -0
  50. data/lib/glossarist/rdf/gloss_citation.rb +36 -0
  51. data/lib/glossarist/rdf/gloss_concept.rb +58 -0
  52. data/lib/glossarist/rdf/gloss_concept_date.rb +24 -0
  53. data/lib/glossarist/rdf/gloss_concept_reference.rb +29 -0
  54. data/lib/glossarist/rdf/gloss_concept_source.rb +37 -0
  55. data/lib/glossarist/rdf/gloss_designation.rb +146 -0
  56. data/lib/glossarist/rdf/gloss_detailed_definition.rb +24 -0
  57. data/lib/glossarist/rdf/gloss_grammar_info.rb +57 -0
  58. data/lib/glossarist/rdf/gloss_locality.rb +25 -0
  59. data/lib/glossarist/rdf/gloss_localized_concept.rb +67 -0
  60. data/lib/glossarist/rdf/gloss_non_verbal_rep.rb +31 -0
  61. data/lib/glossarist/rdf/gloss_pronunciation.rb +32 -0
  62. data/lib/glossarist/rdf/gloss_reference.rb +55 -0
  63. data/lib/glossarist/rdf/namespaces/glossarist_namespace.rb +12 -0
  64. data/lib/glossarist/rdf/namespaces/iso_thes_namespace.rb +12 -0
  65. data/lib/glossarist/rdf/namespaces/owl_namespace.rb +12 -0
  66. data/lib/glossarist/rdf/namespaces/prov_namespace.rb +12 -0
  67. data/lib/glossarist/rdf/namespaces/rdf_namespace.rb +12 -0
  68. data/lib/glossarist/rdf/namespaces/skosxl_namespace.rb +12 -0
  69. data/lib/glossarist/rdf/namespaces.rb +8 -2
  70. data/lib/glossarist/rdf/relationships.rb +19 -0
  71. data/lib/glossarist/rdf/v3/configuration.rb +15 -0
  72. data/lib/glossarist/rdf/v3.rb +79 -0
  73. data/lib/glossarist/rdf.rb +22 -2
  74. data/lib/glossarist/reference_extractor.rb +15 -24
  75. data/lib/glossarist/reference_resolver.rb +3 -3
  76. data/lib/glossarist/related_concept.rb +2 -10
  77. data/lib/glossarist/schema_migration.rb +39 -0
  78. data/lib/glossarist/sts/term_mapper.rb +2 -2
  79. data/lib/glossarist/transforms/concept_to_gloss_transform.rb +355 -0
  80. data/lib/glossarist/transforms.rb +2 -2
  81. data/lib/glossarist/urn_resolver.rb +13 -1
  82. data/lib/glossarist/v1/concept.rb +18 -11
  83. data/lib/glossarist/v2/citation.rb +36 -0
  84. data/lib/glossarist/v2/concept_data.rb +46 -0
  85. data/lib/glossarist/v2/concept_document.rb +18 -0
  86. data/lib/glossarist/v2/concept_ref.rb +8 -0
  87. data/lib/glossarist/v2/concept_source.rb +16 -0
  88. data/lib/glossarist/v2/configuration.rb +13 -0
  89. data/lib/glossarist/v2/detailed_definition.rb +14 -0
  90. data/lib/glossarist/v2/localized_concept.rb +9 -0
  91. data/lib/glossarist/v2/managed_concept.rb +25 -0
  92. data/lib/glossarist/v2/managed_concept_data.rb +49 -0
  93. data/lib/glossarist/v2/related_concept.rb +15 -0
  94. data/lib/glossarist/v2.rb +28 -0
  95. data/lib/glossarist/v3/bibliography_entry.rb +19 -0
  96. data/lib/glossarist/v3/bibliography_file.rb +27 -0
  97. data/lib/glossarist/v3/citation.rb +30 -0
  98. data/lib/glossarist/v3/concept_data.rb +46 -0
  99. data/lib/glossarist/v3/concept_document.rb +18 -0
  100. data/lib/glossarist/v3/concept_ref.rb +8 -0
  101. data/lib/glossarist/v3/concept_source.rb +16 -0
  102. data/lib/glossarist/v3/configuration.rb +13 -0
  103. data/lib/glossarist/v3/detailed_definition.rb +14 -0
  104. data/lib/glossarist/v3/image_entry.rb +21 -0
  105. data/lib/glossarist/v3/image_file.rb +31 -0
  106. data/lib/glossarist/v3/localized_concept.rb +9 -0
  107. data/lib/glossarist/v3/managed_concept.rb +26 -0
  108. data/lib/glossarist/v3/managed_concept_data.rb +34 -0
  109. data/lib/glossarist/v3/related_concept.rb +15 -0
  110. data/lib/glossarist/v3.rb +36 -0
  111. data/lib/glossarist/validation/asset_index.rb +4 -3
  112. data/lib/glossarist/validation/bibliography_index.rb +61 -30
  113. data/lib/glossarist/validation/rules/asciidoc_xref_rule.rb +2 -15
  114. data/lib/glossarist/validation/rules/authoritative_source_rule.rb +2 -15
  115. data/lib/glossarist/validation/rules/base.rb +5 -0
  116. data/lib/glossarist/validation/rules/bibliography_yaml_rule.rb +2 -3
  117. data/lib/glossarist/validation/rules/citation_completeness_rule.rb +5 -27
  118. data/lib/glossarist/validation/rules/dataset_context.rb +8 -3
  119. data/lib/glossarist/validation/rules/date_validity_rule.rb +1 -1
  120. data/lib/glossarist/validation/rules/designation_status_rule.rb +0 -1
  121. data/lib/glossarist/validation/rules/designation_type_rule.rb +1 -5
  122. data/lib/glossarist/validation/rules/domain_ref_rule.rb +37 -0
  123. data/lib/glossarist/validation/rules/domain_target_rule.rb +56 -0
  124. data/lib/glossarist/validation/rules/gcr_context.rb +12 -13
  125. data/lib/glossarist/validation/rules/image_reference_rule.rb +2 -17
  126. data/lib/glossarist/validation/rules/locality_completeness_rule.rb +58 -0
  127. data/lib/glossarist/validation/rules/localization_consistency_rule.rb +72 -0
  128. data/lib/glossarist/validation/rules/localization_presence_rule.rb +1 -1
  129. data/lib/glossarist/validation/rules/model_validity_rule.rb +71 -0
  130. data/lib/glossarist/validation/rules/orphaned_bibliography_rule.rb +1 -13
  131. data/lib/glossarist/validation/rules/orphaned_images_rule.rb +16 -11
  132. data/lib/glossarist/validation/rules/ref_shape_rule.rb +68 -0
  133. data/lib/glossarist/validation/rules/related_concept_cycle_rule.rb +1 -3
  134. data/lib/glossarist/validation/rules/related_concept_symmetry_rule.rb +1 -3
  135. data/lib/glossarist/validation/rules/related_concept_target_rule.rb +64 -0
  136. data/lib/glossarist/validation/rules/schema_version_rule.rb +41 -0
  137. data/lib/glossarist/validation/rules/source_type_rule.rb +1 -15
  138. data/lib/glossarist/validation/rules/source_urn_format_rule.rb +65 -0
  139. data/lib/glossarist/validation/rules/uuid_format_rule.rb +33 -0
  140. data/lib/glossarist/validation/rules.rb +10 -43
  141. data/lib/glossarist/validation/validation_issue.rb +14 -11
  142. data/lib/glossarist/validation_result.rb +12 -22
  143. data/lib/glossarist/version.rb +1 -1
  144. data/lib/glossarist.rb +10 -0
  145. data/memory/project-status.md +43 -0
  146. data/scripts/migrate_dataset.rb +180 -0
  147. data/scripts/migrate_isotc204_to_v3.rb +134 -0
  148. data/scripts/migrate_isotc211_to_v3.rb +153 -0
  149. data/scripts/migrate_osgeo_to_v3.rb +155 -0
  150. data/scripts/upgrade_dataset_to_v3.rb +47 -0
  151. metadata +112 -6
  152. data/TODO.integration/01-gcr-package-cli.md +0 -180
  153. data/lib/glossarist/rdf/skos_concept.rb +0 -43
  154. data/lib/glossarist/rdf/skos_vocabulary.rb +0 -25
  155. data/lib/glossarist/transforms/concept_to_skos_transform.rb +0 -131
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ class GlossConceptReference < Lutaml::Model::Serializable
8
+ attribute :term, :string
9
+ attribute :concept_id, :string
10
+ attribute :source, :string
11
+ attribute :ref_type, :string
12
+ attribute :urn, :string
13
+ attribute :parent_id, :string
14
+
15
+ rdf do
16
+ namespace Namespaces::GlossaristNamespace
17
+
18
+ subject { |r| "concept/#{r.parent_id}/ref/#{r.concept_id || r.urn}" }
19
+
20
+ types "gloss:ConceptReference"
21
+
22
+ predicate :refType, namespace: Namespaces::GlossaristNamespace, to: :ref_type
23
+ predicate :conceptId, namespace: Namespaces::GlossaristNamespace, to: :concept_id
24
+ predicate :sourceUri, namespace: Namespaces::GlossaristNamespace, to: :source
25
+ predicate :urn, namespace: Namespaces::GlossaristNamespace, to: :urn
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ class GlossConceptSource < Lutaml::Model::Serializable
8
+ attribute :status, :string
9
+ attribute :type, :string
10
+ attribute :modification, :string
11
+ attribute :origin, GlossCitation
12
+
13
+ rdf do
14
+ namespace Namespaces::GlossaristNamespace
15
+
16
+ subject { |s| "source/#{GlossConceptSource.deterministic_id(s)}" }
17
+
18
+ types "gloss:ConceptSource"
19
+
20
+ predicate :sourceStatus, namespace: Namespaces::GlossaristNamespace, to: :status, as: :uri
21
+ predicate :sourceType, namespace: Namespaces::GlossaristNamespace, to: :type, as: :uri
22
+ predicate :modification, namespace: Namespaces::GlossaristNamespace, to: :modification
23
+
24
+ members :origin, link: "gloss:sourceOrigin"
25
+ end
26
+
27
+ def self.deterministic_id(source)
28
+ parts = [source.status, source.type, source.modification]
29
+ origin = source.origin
30
+ if origin
31
+ parts << origin.source << origin.id << origin.version << origin.link
32
+ end
33
+ Digest::MD5.hexdigest(parts.compact.join("|"))[0..11]
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,146 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ COMMON_DESIGNATION_PREDICATES = lambda { |dsl|
8
+ dsl.predicate :literalForm, namespace: Namespaces::SkosxlNamespace, to: :designation
9
+ dsl.predicate :normativeStatus, namespace: Namespaces::GlossaristNamespace, to: :normative_status, as: :uri
10
+ dsl.predicate :hasTermType, namespace: Namespaces::GlossaristNamespace, to: :term_type, as: :uri
11
+ dsl.predicate :isInternational, namespace: Namespaces::GlossaristNamespace, to: :international
12
+ dsl.predicate :isAbsent, namespace: Namespaces::GlossaristNamespace, to: :absent
13
+ dsl.predicate :geographicalArea, namespace: Namespaces::GlossaristNamespace, to: :language
14
+ dsl.predicate :language, namespace: Namespaces::DctermsNamespace, to: :lang_code
15
+ dsl.predicate :script, namespace: Namespaces::GlossaristNamespace, to: :script
16
+ dsl.predicate :conversionSystem, namespace: Namespaces::GlossaristNamespace, to: :system
17
+ dsl.members :pronunciations, link: "gloss:hasPronunciation"
18
+ dsl.members :sources
19
+ }.freeze
20
+
21
+ DESIGNATION_NAMESPACES = [
22
+ Namespaces::GlossaristNamespace,
23
+ Namespaces::SkosxlNamespace,
24
+ Namespaces::SkosNamespace,
25
+ Namespaces::DctermsNamespace,
26
+ Namespaces::IsoThesNamespace,
27
+ ].freeze
28
+
29
+ class GlossDesignation < Lutaml::Model::Serializable
30
+ include Relationships
31
+
32
+ attribute :designation, :string
33
+ attribute :normative_status, :string
34
+ attribute :type, :string
35
+ attribute :language, :string
36
+ attribute :script, :string
37
+ attribute :system, :string
38
+ attribute :international, :boolean
39
+ attribute :absent, :boolean
40
+ attribute :term_type, :string
41
+ attribute :concept_id, :string
42
+ attribute :lang_code, :string
43
+ attribute :index, :string
44
+ attribute :pronunciations, GlossPronunciation, collection: true
45
+ attribute :sources, GlossConceptSource, collection: true
46
+
47
+ rdf do
48
+ namespace(*DESIGNATION_NAMESPACES)
49
+
50
+ subject { |d| "concept/#{d.concept_id}/#{d.lang_code}/designation/#{d.index}" }
51
+
52
+ types "gloss:Designation", "skosxl:Label"
53
+
54
+ COMMON_DESIGNATION_PREDICATES.call(self)
55
+ end
56
+ end
57
+
58
+ class GlossExpression < GlossDesignation
59
+ attribute :prefix, :string
60
+ attribute :usage_info, :string
61
+ attribute :field_of_application, :string
62
+ attribute :grammar_info, GlossGrammarInfo, collection: true
63
+
64
+ rdf do
65
+ namespace(*DESIGNATION_NAMESPACES)
66
+
67
+ subject { |d| "concept/#{d.concept_id}/#{d.lang_code}/designation/#{d.index}" }
68
+
69
+ types "gloss:Expression", "skosxl:Label"
70
+
71
+ COMMON_DESIGNATION_PREDICATES.call(self)
72
+ predicate :prefix, namespace: Namespaces::GlossaristNamespace, to: :prefix
73
+ predicate :usageInfo, namespace: Namespaces::GlossaristNamespace, to: :usage_info
74
+ predicate :fieldOfApplication, namespace: Namespaces::GlossaristNamespace, to: :field_of_application
75
+ members :grammar_info, link: "gloss:hasGrammarInfo"
76
+ end
77
+ end
78
+
79
+ class GlossAbbreviation < GlossExpression
80
+ attribute :acronym, :boolean
81
+ attribute :initialism, :boolean
82
+ attribute :truncation, :boolean
83
+
84
+ rdf do
85
+ namespace(*DESIGNATION_NAMESPACES)
86
+
87
+ subject { |d| "concept/#{d.concept_id}/#{d.lang_code}/designation/#{d.index}" }
88
+
89
+ types "gloss:Abbreviation", "skosxl:Label"
90
+
91
+ COMMON_DESIGNATION_PREDICATES.call(self)
92
+ predicate :prefix, namespace: Namespaces::GlossaristNamespace, to: :prefix
93
+ predicate :usageInfo, namespace: Namespaces::GlossaristNamespace, to: :usage_info
94
+ predicate :fieldOfApplication, namespace: Namespaces::GlossaristNamespace, to: :field_of_application
95
+ members :grammar_info, link: "gloss:hasGrammarInfo"
96
+ predicate :isAcronym, namespace: Namespaces::GlossaristNamespace, to: :acronym
97
+ predicate :isInitialism, namespace: Namespaces::GlossaristNamespace, to: :initialism
98
+ predicate :isTruncation, namespace: Namespaces::GlossaristNamespace, to: :truncation
99
+ end
100
+ end
101
+
102
+ class GlossSymbol < GlossDesignation
103
+ rdf do
104
+ namespace(*DESIGNATION_NAMESPACES)
105
+
106
+ subject { |d| "concept/#{d.concept_id}/#{d.lang_code}/designation/#{d.index}" }
107
+
108
+ types "gloss:Symbol", "skosxl:Label"
109
+
110
+ COMMON_DESIGNATION_PREDICATES.call(self)
111
+ end
112
+ end
113
+
114
+ class GlossLetterSymbol < GlossSymbol
115
+ attribute :text, :string
116
+
117
+ rdf do
118
+ namespace(*DESIGNATION_NAMESPACES)
119
+
120
+ subject { |d| "concept/#{d.concept_id}/#{d.lang_code}/designation/#{d.index}" }
121
+
122
+ types "gloss:LetterSymbol", "skosxl:Label"
123
+
124
+ COMMON_DESIGNATION_PREDICATES.call(self)
125
+ predicate :text, namespace: Namespaces::GlossaristNamespace, to: :text
126
+ end
127
+ end
128
+
129
+ class GlossGraphicalSymbol < GlossSymbol
130
+ attribute :text, :string
131
+ attribute :image, :string
132
+
133
+ rdf do
134
+ namespace(*DESIGNATION_NAMESPACES)
135
+
136
+ subject { |d| "concept/#{d.concept_id}/#{d.lang_code}/designation/#{d.index}" }
137
+
138
+ types "gloss:GraphicalSymbol", "skosxl:Label"
139
+
140
+ COMMON_DESIGNATION_PREDICATES.call(self)
141
+ predicate :text, namespace: Namespaces::GlossaristNamespace, to: :text
142
+ predicate :image, namespace: Namespaces::GlossaristNamespace, to: :image
143
+ end
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ class GlossDetailedDefinition < Lutaml::Model::Serializable
8
+ attribute :content, :string
9
+ attribute :sources, GlossConceptSource, collection: true
10
+
11
+ rdf do
12
+ namespace Namespaces::GlossaristNamespace, Namespaces::RdfNamespace
13
+
14
+ subject { |d| "definition/#{d.content.hash.abs}" }
15
+
16
+ types "gloss:DetailedDefinition"
17
+
18
+ predicate :value, namespace: Namespaces::RdfNamespace, to: :content
19
+
20
+ members :sources
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ class GlossGrammarInfo < Lutaml::Model::Serializable
8
+ attribute :gender, :string, collection: true
9
+ attribute :number, :string, collection: true
10
+ attribute :part_of_speech, :string
11
+ attribute :concept_id, :string
12
+ attribute :lang_code, :string
13
+ attribute :index, :string
14
+
15
+ rdf do
16
+ namespace Namespaces::GlossaristNamespace
17
+
18
+ subject { |g| "concept/#{g.concept_id}/#{g.lang_code}/designation/#{g.index}/grammar" }
19
+
20
+ types "gloss:GrammarInfo"
21
+
22
+ predicate :gender, namespace: Namespaces::GlossaristNamespace, to: :gender, as: :uri
23
+ predicate :number, namespace: Namespaces::GlossaristNamespace, to: :number, as: :uri
24
+ predicate :isNoun, namespace: Namespaces::GlossaristNamespace, to: :noun?
25
+ predicate :isVerb, namespace: Namespaces::GlossaristNamespace, to: :verb?
26
+ predicate :isAdjective, namespace: Namespaces::GlossaristNamespace, to: :adjective?
27
+ predicate :isAdverb, namespace: Namespaces::GlossaristNamespace, to: :adverb?
28
+ predicate :isPreposition, namespace: Namespaces::GlossaristNamespace, to: :preposition?
29
+ predicate :isParticiple, namespace: Namespaces::GlossaristNamespace, to: :participle?
30
+ end
31
+
32
+ def noun?
33
+ part_of_speech == "noun"
34
+ end
35
+
36
+ def verb?
37
+ part_of_speech == "verb"
38
+ end
39
+
40
+ def adjective?
41
+ part_of_speech == "adjective"
42
+ end
43
+
44
+ def adverb?
45
+ part_of_speech == "adverb"
46
+ end
47
+
48
+ def preposition?
49
+ part_of_speech == "preposition"
50
+ end
51
+
52
+ def participle?
53
+ part_of_speech == "participle"
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ class GlossLocality < Lutaml::Model::Serializable
8
+ attribute :locality_type, :string
9
+ attribute :reference_from, :string
10
+ attribute :reference_to, :string
11
+
12
+ rdf do
13
+ namespace Namespaces::GlossaristNamespace
14
+
15
+ subject { |l| "locality/#{l.locality_type}/#{l.reference_from}" }
16
+
17
+ types "gloss:Locality"
18
+
19
+ predicate :localityType, namespace: Namespaces::GlossaristNamespace, to: :locality_type
20
+ predicate :referenceFrom, namespace: Namespaces::GlossaristNamespace, to: :reference_from
21
+ predicate :referenceTo, namespace: Namespaces::GlossaristNamespace, to: :reference_to
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ class GlossLocalizedConcept < Lutaml::Model::Serializable
8
+ attribute :concept_id, :string
9
+ attribute :language_code, :string
10
+ attribute :domain, :string
11
+ attribute :entry_status, :string
12
+ attribute :release, :string
13
+ attribute :lineage_similarity, :integer
14
+ attribute :script, :string
15
+ attribute :system, :string
16
+ attribute :designations, GlossDesignation, collection: true
17
+ attribute :definitions, GlossDetailedDefinition, collection: true
18
+ attribute :notes, GlossDetailedDefinition, collection: true
19
+ attribute :examples, GlossDetailedDefinition, collection: true
20
+ attribute :sources, GlossConceptSource, collection: true
21
+ attribute :non_verb_reps, GlossNonVerbalRep, collection: true
22
+
23
+ rdf do
24
+ namespace Namespaces::GlossaristNamespace,
25
+ Namespaces::SkosNamespace,
26
+ Namespaces::SkosxlNamespace,
27
+ Namespaces::DctermsNamespace,
28
+ Namespaces::IsoThesNamespace,
29
+ Namespaces::RdfNamespace
30
+
31
+ subject { |l| "concept/#{l.concept_id}/#{l.language_code}" }
32
+
33
+ types "gloss:LocalizedConcept", "skos:Concept"
34
+
35
+ predicate :language, namespace: Namespaces::DctermsNamespace, to: :language_code
36
+ predicate :hasEntryStatus, namespace: Namespaces::GlossaristNamespace, to: :entry_status, as: :uri
37
+ predicate :domain, namespace: Namespaces::GlossaristNamespace, to: :domain
38
+ predicate :release, namespace: Namespaces::GlossaristNamespace, to: :release
39
+ predicate :lineageSimilarity, namespace: Namespaces::GlossaristNamespace, to: :lineage_similarity
40
+ predicate :script, namespace: Namespaces::GlossaristNamespace, to: :script
41
+ predicate :conversionSystem, namespace: Namespaces::GlossaristNamespace, to: :system
42
+
43
+ members :designations,
44
+ link: ->(d) { GlossLocalizedConcept.skosxl_label_for(d) }
45
+ members :definitions,
46
+ link: "gloss:hasDefinition"
47
+ members :notes,
48
+ link: "gloss:hasNote"
49
+ members :examples,
50
+ link: "gloss:hasExample"
51
+ members :sources,
52
+ link: "gloss:hasSource"
53
+ members :non_verb_reps,
54
+ link: "gloss:hasNonVerbalRep"
55
+ end
56
+
57
+ def self.skosxl_label_for(designation)
58
+ status = designation.normative_status.to_s.split("/").last
59
+ case status
60
+ when "preferred" then "skosxl:prefLabel"
61
+ when "deprecated" then "skosxl:hiddenLabel"
62
+ else "skosxl:altLabel"
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ class GlossNonVerbalRep < Lutaml::Model::Serializable
8
+ attribute :representation_type, :string
9
+ attribute :representation_ref, :string
10
+ attribute :representation_text, :string
11
+ attribute :sources, GlossConceptSource, collection: true
12
+ attribute :concept_id, :string
13
+ attribute :lang_code, :string
14
+ attribute :index, :string
15
+
16
+ rdf do
17
+ namespace Namespaces::GlossaristNamespace
18
+
19
+ subject { |n| "concept/#{n.concept_id}/#{n.lang_code}/nonverbal/#{n.index}" }
20
+
21
+ types "gloss:NonVerbalRepresentation"
22
+
23
+ predicate :representationType, namespace: Namespaces::GlossaristNamespace, to: :representation_type
24
+ predicate :representationRef, namespace: Namespaces::GlossaristNamespace, to: :representation_ref
25
+ predicate :representationText, namespace: Namespaces::GlossaristNamespace, to: :representation_text
26
+
27
+ members :sources
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ class GlossPronunciation < Lutaml::Model::Serializable
8
+ attribute :content, :string
9
+ attribute :language, :string
10
+ attribute :script, :string
11
+ attribute :country, :string
12
+ attribute :system, :string
13
+ attribute :concept_id, :string
14
+ attribute :lang_code, :string
15
+ attribute :index, :string
16
+
17
+ rdf do
18
+ namespace Namespaces::GlossaristNamespace
19
+
20
+ subject { |p| "concept/#{p.concept_id}/#{p.lang_code}/pronunciation/#{p.index}" }
21
+
22
+ types "gloss:Pronunciation"
23
+
24
+ predicate :pronunciationContent, namespace: Namespaces::GlossaristNamespace, to: :content
25
+ predicate :pronunciationLanguage, namespace: Namespaces::GlossaristNamespace, to: :language
26
+ predicate :pronunciationScript, namespace: Namespaces::GlossaristNamespace, to: :script
27
+ predicate :pronunciationCountry, namespace: Namespaces::GlossaristNamespace, to: :country
28
+ predicate :pronunciationSystem, namespace: Namespaces::GlossaristNamespace, to: :system
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+ require "digest"
5
+
6
+ module Glossarist
7
+ module Rdf
8
+ # Unified RDF view for bibliographic citations and concept references.
9
+ #
10
+ # Replaces the former GlossCitation and GlossConceptReference classes.
11
+ # Both model "a reference to an item within a collection":
12
+ # - Citation: collection=document series, item=document, position=clause
13
+ # - ConceptReference: collection=termbase, item=concept
14
+ class GlossReference < Lutaml::Model::Serializable
15
+ attribute :text, :string
16
+ attribute :source, :string
17
+ attribute :id, :string
18
+ attribute :version, :string
19
+ attribute :link, :string
20
+ attribute :locality, GlossLocality
21
+ attribute :ref_type, :string
22
+ attribute :urn, :string
23
+ attribute :term, :string
24
+ attribute :parent_id, :string
25
+
26
+ rdf do
27
+ namespace Namespaces::GlossaristNamespace
28
+
29
+ subject { |r| GlossReference.slug(r) }
30
+
31
+ types "gloss:Reference"
32
+
33
+ predicate :citationText, namespace: Namespaces::GlossaristNamespace, to: :text
34
+ predicate :source, namespace: Namespaces::GlossaristNamespace, to: :source
35
+ predicate :refId, namespace: Namespaces::GlossaristNamespace, to: :id
36
+ predicate :version, namespace: Namespaces::GlossaristNamespace, to: :version
37
+ predicate :link, namespace: Namespaces::GlossaristNamespace, to: :link
38
+ predicate :refType, namespace: Namespaces::GlossaristNamespace, to: :ref_type
39
+ predicate :urn, namespace: Namespaces::GlossaristNamespace, to: :urn
40
+ predicate :term, namespace: Namespaces::GlossaristNamespace, to: :term
41
+ members :locality, link: "gloss:hasLocality"
42
+ end
43
+
44
+ def self.slug(ref)
45
+ slug = [ref.source, ref.id].compact.join("/")
46
+ slug = Digest::MD5.hexdigest(ref.text || "")[0..11] if slug.empty?
47
+ slug
48
+ end
49
+ end
50
+
51
+ # Backward-compatible aliases
52
+ GlossCitation = GlossReference
53
+ GlossConceptReference = GlossReference
54
+ end
55
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module Rdf
5
+ module Namespaces
6
+ class GlossaristNamespace < Lutaml::Rdf::Namespace
7
+ uri "https://www.glossarist.org/ontologies/"
8
+ prefix "gloss"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module Rdf
5
+ module Namespaces
6
+ class IsoThesNamespace < Lutaml::Rdf::Namespace
7
+ uri "http://purl.org/iso25964/skos-thes#"
8
+ prefix "iso-thes"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module Rdf
5
+ module Namespaces
6
+ class OwlNamespace < Lutaml::Rdf::Namespace
7
+ uri "http://www.w3.org/2002/07/owl#"
8
+ prefix "owl"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module Rdf
5
+ module Namespaces
6
+ class ProvNamespace < Lutaml::Rdf::Namespace
7
+ uri "http://www.w3.org/ns/prov#"
8
+ prefix "prov"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module Rdf
5
+ module Namespaces
6
+ class RdfNamespace < Lutaml::Rdf::Namespace
7
+ uri "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ prefix "rdf"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module Rdf
5
+ module Namespaces
6
+ class SkosxlNamespace < Lutaml::Rdf::Namespace
7
+ uri "http://www.w3.org/2008/05/skos-xl#"
8
+ prefix "skosxl"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -3,8 +3,14 @@
3
3
  module Glossarist
4
4
  module Rdf
5
5
  module Namespaces
6
- autoload :SkosNamespace, "#{__dir__}/namespaces/skos_namespace"
7
- autoload :DctermsNamespace, "#{__dir__}/namespaces/dcterms_namespace"
6
+ autoload :DctermsNamespace, "#{__dir__}/namespaces/dcterms_namespace"
7
+ autoload :GlossaristNamespace, "#{__dir__}/namespaces/glossarist_namespace"
8
+ autoload :IsoThesNamespace, "#{__dir__}/namespaces/iso_thes_namespace"
9
+ autoload :OwlNamespace, "#{__dir__}/namespaces/owl_namespace"
10
+ autoload :RdfNamespace, "#{__dir__}/namespaces/rdf_namespace"
11
+ autoload :ProvNamespace, "#{__dir__}/namespaces/prov_namespace"
12
+ autoload :SkosNamespace, "#{__dir__}/namespaces/skos_namespace"
13
+ autoload :SkosxlNamespace, "#{__dir__}/namespaces/skosxl_namespace"
8
14
  end
9
15
  end
10
16
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Glossarist
4
+ module Rdf
5
+ # Included by RDF view classes that carry variable-predicate relationships.
6
+ #
7
+ # Standard SKOS/iso-thes relationships (broader, exactMatch, etc.) and
8
+ # glossarist-specific relationships (deprecates, compares, etc.) are
9
+ # emitted as direct triples with the predicate determined at runtime
10
+ # from REL_PROPERTY_MAP.
11
+ module Relationships
12
+ attr_reader :relationship_triples
13
+
14
+ def relationship_triples=(pairs)
15
+ @relationship_triples = Array(pairs)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../../context_configuration"
4
+
5
+ module Glossarist
6
+ module Rdf
7
+ module V3
8
+ module Configuration
9
+ extend Glossarist::ContextConfiguration
10
+
11
+ CONTEXT_ID = :glossarist_rdf_v3
12
+ end
13
+ end
14
+ end
15
+ end