tbx 0.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.
- checksums.yaml +7 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +29 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/.rubocop.yml +17 -0
- data/.rubocop_todo.yml +16 -0
- data/CHANGELOG.md +5 -0
- data/CLAUDE.md +124 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/Gemfile +15 -0
- data/README.adoc +156 -0
- data/Rakefile +12 -0
- data/lib/tbx/admin.rb +35 -0
- data/lib/tbx/admin_grp.rb +25 -0
- data/lib/tbx/admin_note.rb +25 -0
- data/lib/tbx/back.rb +17 -0
- data/lib/tbx/body.rb +17 -0
- data/lib/tbx/change.rb +19 -0
- data/lib/tbx/concept_entry.rb +33 -0
- data/lib/tbx/date.rb +16 -0
- data/lib/tbx/descrip.rb +35 -0
- data/lib/tbx/descrip_grp.rb +31 -0
- data/lib/tbx/descrip_note.rb +25 -0
- data/lib/tbx/document.rb +23 -0
- data/lib/tbx/ec.rb +28 -0
- data/lib/tbx/encoding_desc.rb +17 -0
- data/lib/tbx/file_desc.rb +21 -0
- data/lib/tbx/foreign.rb +29 -0
- data/lib/tbx/hi.rb +19 -0
- data/lib/tbx/item.rb +29 -0
- data/lib/tbx/item_grp.rb +29 -0
- data/lib/tbx/item_set.rb +21 -0
- data/lib/tbx/lang_sec.rb +33 -0
- data/lib/tbx/namespaces.rb +9 -0
- data/lib/tbx/note.rb +29 -0
- data/lib/tbx/p.rb +31 -0
- data/lib/tbx/ph.rb +14 -0
- data/lib/tbx/publication_stmt.rb +17 -0
- data/lib/tbx/ref.rb +25 -0
- data/lib/tbx/ref_object.rb +21 -0
- data/lib/tbx/ref_object_sec.rb +19 -0
- data/lib/tbx/revision_desc.rb +19 -0
- data/lib/tbx/sc.rb +22 -0
- data/lib/tbx/source_desc.rb +19 -0
- data/lib/tbx/tbx_header.rb +21 -0
- data/lib/tbx/term.rb +19 -0
- data/lib/tbx/term_note.rb +35 -0
- data/lib/tbx/term_note_grp.rb +29 -0
- data/lib/tbx/term_sec.rb +37 -0
- data/lib/tbx/text_element.rb +19 -0
- data/lib/tbx/title.rb +19 -0
- data/lib/tbx/title_stmt.rb +21 -0
- data/lib/tbx/transac.rb +25 -0
- data/lib/tbx/transac_grp.rb +27 -0
- data/lib/tbx/transac_note.rb +25 -0
- data/lib/tbx/version.rb +5 -0
- data/lib/tbx/xref.rb +21 -0
- data/lib/tbx.rb +67 -0
- data/reference-docs/schemas/TBX-Basic_DCA.sch +142 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/DCA/Example_Astronomy_DCA_VALID.tbx +4032 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/DCA/TBX-Basic_DCA.sch +142 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/DCT/Example_Astronomy_DCT_VALID.tbx +4021 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/DCT/TBX-Basic.nvdl +33 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/DCT/TBX-Basic_DCT.sch +48 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_basic_module/Basic Module Definition.docx +0 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_basic_module/Basic Module Definition.pdf +0 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_basic_module/Basic.rng +164 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_basic_module/Basic.sch +60 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_basic_module/Basic.tbxmd +125 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_min_module/Min Module Definition.docx +0 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_min_module/Min Module Definition.pdf +0 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_min_module/Min.rng +77 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_min_module/Min.sch +24 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/Modules/TBX_min_module/Min.tbxmd +42 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/TBX-Basic Definition.docx +0 -0
- data/reference-docs/schemas/TBX-Basic_dialect_v1/TBX-Basic Definition.pdf +0 -0
- data/reference-docs/schemas/TBX_core.xsd +534 -0
- data/reference-docs/schemas/TBXcoreStructV03.rng +713 -0
- data/tbx.gemspec +35 -0
- metadata +140 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c3a53cd7d9e2bdb108893a0320b4ede11f7b7cdd4d7e2ae3b7727ebe78359286
|
|
4
|
+
data.tar.gz: 0ca4e4c95c6d837a9583b50e76a31727f3130757a80e706ff1f848d00f6075e7
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: bf955090ad2cb8e77516ab3e466cf9637eac9e8537b2f69ff8ec2553d71aef5cb35bc56cb7ce25b2c10cee2441b1a9c22e2cad64ca4d672a4186f34cdbea19d4
|
|
7
|
+
data.tar.gz: d3ac55aabfbc8ea882098eaa1a0a69d7b0028bf39aba78f7c77dfe749182b9e926164638e7b6a57381318826f9845fc85216b5e4cd343a4ba4e4c4bfdbd935ca
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
name: rake
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [ master, main ]
|
|
8
|
+
tags: [ v* ]
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
rake:
|
|
13
|
+
uses: metanorma/ci/.github/workflows/generic-rake.yml@main
|
|
14
|
+
secrets:
|
|
15
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
name: release
|
|
4
|
+
|
|
5
|
+
permissions:
|
|
6
|
+
contents: write
|
|
7
|
+
packages: write
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
inputs:
|
|
13
|
+
next_version:
|
|
14
|
+
description: |
|
|
15
|
+
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
|
16
|
+
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
|
17
|
+
required: true
|
|
18
|
+
default: 'skip'
|
|
19
|
+
repository_dispatch:
|
|
20
|
+
types: [ do-release ]
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
release:
|
|
24
|
+
uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
|
|
25
|
+
with:
|
|
26
|
+
next_version: ${{ github.event.inputs.next_version }}
|
|
27
|
+
secrets:
|
|
28
|
+
rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
|
|
29
|
+
pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
inherit_from:
|
|
2
|
+
- .rubocop_todo.yml
|
|
3
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
|
4
|
+
|
|
5
|
+
# local repo-specific modifications
|
|
6
|
+
|
|
7
|
+
AllCops:
|
|
8
|
+
TargetRubyVersion: 3.2
|
|
9
|
+
NewCops: enable
|
|
10
|
+
SuggestExtensions: false
|
|
11
|
+
|
|
12
|
+
Style/Documentation:
|
|
13
|
+
Enabled: false
|
|
14
|
+
|
|
15
|
+
Metrics/BlockLength:
|
|
16
|
+
Exclude:
|
|
17
|
+
- "spec/**/*"
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2026-05-05 13:10:07 UTC using RuboCop version 1.86.1.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 7
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
12
|
+
# URISchemes: http, https
|
|
13
|
+
Layout/LineLength:
|
|
14
|
+
Exclude:
|
|
15
|
+
- 'spec/tbx/document_spec.rb'
|
|
16
|
+
- 'tbx.gemspec'
|
data/CHANGELOG.md
ADDED
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Build, Test, and Development Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install dependencies
|
|
9
|
+
bundle install
|
|
10
|
+
|
|
11
|
+
# Run tests
|
|
12
|
+
bundle exec rspec
|
|
13
|
+
|
|
14
|
+
# Run a single test file
|
|
15
|
+
bundle exec rspec spec/tbx/document_spec.rb
|
|
16
|
+
|
|
17
|
+
# Run linting
|
|
18
|
+
bundle exec rubocop
|
|
19
|
+
|
|
20
|
+
# Run both (default task)
|
|
21
|
+
bundle exec rake
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Architecture
|
|
25
|
+
|
|
26
|
+
This is a Ruby gem for parsing and serializing TBX (Termbase Exchange) documents per ISO 30042:2019. It uses `lutaml-model` for XML serialization/deserialization.
|
|
27
|
+
|
|
28
|
+
### Namespace Structure
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Tbx
|
|
32
|
+
├── Document # Root element (<tbx>)
|
|
33
|
+
├── TbxHeader # <tbxHeader>
|
|
34
|
+
├── FileDesc # <fileDesc>
|
|
35
|
+
├── PublicationStmt # <publicationStmt>
|
|
36
|
+
├── TitleStmt # <titleStmt>
|
|
37
|
+
├── SourceDesc # <sourceDesc>
|
|
38
|
+
├── EncodingDesc # <encodingDesc>
|
|
39
|
+
├── RevisionDesc # <revisionDesc>
|
|
40
|
+
├── Change # <change>
|
|
41
|
+
├── TextElement # <text>
|
|
42
|
+
├── Body # <body>
|
|
43
|
+
├── Back # <back>
|
|
44
|
+
├── ConceptEntry # <conceptEntry>
|
|
45
|
+
├── LangSec # <langSec>
|
|
46
|
+
├── TermSec # <termSec>
|
|
47
|
+
├── Term # <term>
|
|
48
|
+
├── TermNote # <termNote>
|
|
49
|
+
├── TermNoteGrp # <termNoteGrp>
|
|
50
|
+
├── Descrip # <descrip>
|
|
51
|
+
├── DescripGrp # <descripGrp>
|
|
52
|
+
├── DescripNote # <descripNote>
|
|
53
|
+
├── Admin # <admin>
|
|
54
|
+
├── AdminGrp # <adminGrp>
|
|
55
|
+
├── AdminNote # <adminNote>
|
|
56
|
+
├── Note # <note>
|
|
57
|
+
├── P # <p>
|
|
58
|
+
├── Ref # <ref>
|
|
59
|
+
├── Xref # <xref>
|
|
60
|
+
├── Transac # <transac>
|
|
61
|
+
├── TransacGrp # <transacGrp>
|
|
62
|
+
├── TransacNote # <transacNote>
|
|
63
|
+
├── DateElement # <date>
|
|
64
|
+
├── RefObjectSec # <refObjectSec>
|
|
65
|
+
├── RefObject # <refObject>
|
|
66
|
+
├── ItemSet # <itemSet>
|
|
67
|
+
├── ItemGrp # <itemGrp>
|
|
68
|
+
├── Item # <item>
|
|
69
|
+
├── Hi # <hi>
|
|
70
|
+
├── Foreign # <foreign>
|
|
71
|
+
├── Ec # <ec>
|
|
72
|
+
├── Sc # <sc>
|
|
73
|
+
├── Ph # <ph>
|
|
74
|
+
├── Title # <title>
|
|
75
|
+
├── Namespaces # XML namespace definitions
|
|
76
|
+
└── Ruby # Gem namespace (Tbx::Ruby::VERSION)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Key Implementation Patterns
|
|
80
|
+
|
|
81
|
+
**Element Classes** (in `lib/tbx/`):
|
|
82
|
+
- Inherit from `Lutaml::Model::Serializable`
|
|
83
|
+
- Define attributes and XML mapping in `xml do ... end` block
|
|
84
|
+
- Use `map_element` to map child elements, `map_content` for text content
|
|
85
|
+
- Use `mixed_content` for elements that contain both text and child elements
|
|
86
|
+
- Use `w3c_attributes` for `xml:lang` and other W3C attributes
|
|
87
|
+
|
|
88
|
+
**Example element structure:**
|
|
89
|
+
```ruby
|
|
90
|
+
module Tbx
|
|
91
|
+
class ConceptEntry < Lutaml::Model::Serializable
|
|
92
|
+
attribute :id, :string
|
|
93
|
+
attribute :lang_sec, ::Tbx::LangSec, collection: true
|
|
94
|
+
|
|
95
|
+
xml do
|
|
96
|
+
root "conceptEntry"
|
|
97
|
+
mixed_content
|
|
98
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
99
|
+
|
|
100
|
+
map_attribute "id", to: :id
|
|
101
|
+
map_element "langSec", to: :lang_sec
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Autoload Pattern**: Elements are autoloaded via `lib/tbx.rb`. When adding new elements, add autoloads in alphabetical order.
|
|
108
|
+
|
|
109
|
+
### XML Namespace
|
|
110
|
+
|
|
111
|
+
The TBX namespace is `urn:iso:std:iso:30042:ed-2` defined in `Tbx::Namespaces::TbxNamespace`.
|
|
112
|
+
|
|
113
|
+
### TBX Styles
|
|
114
|
+
|
|
115
|
+
- **DCA** (Data Category Archive): Uses standard element names like `<transac type="transactionType">`, `<descrip type="definition">`
|
|
116
|
+
- **DCT** (Data Category Tagging): Uses module-namespaced elements like `<basic:transactionType>`, `<basic:definition>`
|
|
117
|
+
|
|
118
|
+
Currently DCA style is fully supported. DCT support will be added.
|
|
119
|
+
|
|
120
|
+
### Reference Data
|
|
121
|
+
|
|
122
|
+
- RNG/XSD schemas: `reference-docs/schemas/`
|
|
123
|
+
- TBX-Basic dialect examples: `reference-docs/schemas/TBX-Basic_dialect_v1/`
|
|
124
|
+
- Test fixtures: `spec/fixtures/TBX_test_files/` (from https://github.com/LTAC-Global/TBX_test_files)
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
"tbx-ruby" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
|
|
4
|
+
|
|
5
|
+
* Participants will be tolerant of opposing views.
|
|
6
|
+
* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
|
|
7
|
+
* When interpreting the words and actions of others, participants should always assume good intentions.
|
|
8
|
+
* Behaviour which can be reasonably considered harassment will not be tolerated.
|
|
9
|
+
|
|
10
|
+
If you have any concerns about behaviour within this project, please contact us at ["ronald.tse@ribose.com"](mailto:"ronald.tse@ribose.com").
|
data/Gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gemspec
|
|
6
|
+
|
|
7
|
+
gem "canon"
|
|
8
|
+
gem "lutaml-model", path: "../../lutaml/lutaml-model"
|
|
9
|
+
gem "nokogiri"
|
|
10
|
+
gem "rake", "~> 13.0"
|
|
11
|
+
gem "rspec", "~> 3.0"
|
|
12
|
+
gem "rubocop", "~> 1.21"
|
|
13
|
+
gem "rubocop-performance"
|
|
14
|
+
gem "rubocop-rake"
|
|
15
|
+
gem "rubocop-rspec"
|
data/README.adoc
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
= Ruby library for TBX (ISO 30042:2019)
|
|
2
|
+
|
|
3
|
+
== Purpose
|
|
4
|
+
|
|
5
|
+
The `tbx` Ruby gem allows you to parse, manipulate, and serialize TBX
|
|
6
|
+
(TermBase eXchange) documents as defined by ISO 30042:2019.
|
|
7
|
+
|
|
8
|
+
TBX is an international standard for representing structured terminological
|
|
9
|
+
data in XML. This library provides complete coverage of the TBX core
|
|
10
|
+
structure, including:
|
|
11
|
+
|
|
12
|
+
* **DCA** (Data Category Archive) style -- standard TBX element names with
|
|
13
|
+
`type` attributes (e.g., `<descrip type="definition">`)
|
|
14
|
+
* **DCT** (Data Category Tagging) style -- module-namespaced elements
|
|
15
|
+
(e.g., `<basic:definition>`) *(planned)*
|
|
16
|
+
|
|
17
|
+
The library is built on https://github.com/lutaml/lutaml-model[`lutaml-model`]
|
|
18
|
+
for declarative XML serialization.
|
|
19
|
+
|
|
20
|
+
[NOTE]
|
|
21
|
+
This is a work-in-progress.
|
|
22
|
+
|
|
23
|
+
== Installation
|
|
24
|
+
|
|
25
|
+
Install the gem and add to the application's Gemfile:
|
|
26
|
+
|
|
27
|
+
[source,bash]
|
|
28
|
+
----
|
|
29
|
+
bundle add tbx
|
|
30
|
+
----
|
|
31
|
+
|
|
32
|
+
Or install directly:
|
|
33
|
+
|
|
34
|
+
[source,bash]
|
|
35
|
+
----
|
|
36
|
+
gem install tbx
|
|
37
|
+
----
|
|
38
|
+
|
|
39
|
+
== Usage
|
|
40
|
+
|
|
41
|
+
[source,ruby]
|
|
42
|
+
----
|
|
43
|
+
require 'tbx'
|
|
44
|
+
|
|
45
|
+
# Parse a TBX file
|
|
46
|
+
doc = IO.read('spec/fixtures/TBX_test_files/min_good.tbx')
|
|
47
|
+
tbx = Tbx::Document.from_xml(doc)
|
|
48
|
+
|
|
49
|
+
# Access document metadata
|
|
50
|
+
tbx.type # => "TBX-Min"
|
|
51
|
+
tbx.style # => "dca"
|
|
52
|
+
tbx.lang # => "en"
|
|
53
|
+
|
|
54
|
+
# Access header
|
|
55
|
+
tbx.tbx_header.file_desc.source_desc.p.first.content.join
|
|
56
|
+
# => "TBX file, created via MultiTerm Export"
|
|
57
|
+
|
|
58
|
+
# Navigate concept entries
|
|
59
|
+
entry = tbx.text.body.concept_entry.first
|
|
60
|
+
entry.id # => "c1"
|
|
61
|
+
entry.lang_sec.first.lang # => "en"
|
|
62
|
+
entry.lang_sec.first.term_sec.first.term.content.join
|
|
63
|
+
# => "open cluster"
|
|
64
|
+
|
|
65
|
+
# Serialize back to XML
|
|
66
|
+
puts tbx.to_xml(pretty: true)
|
|
67
|
+
# => round-tripped TBX document
|
|
68
|
+
----
|
|
69
|
+
|
|
70
|
+
=== API
|
|
71
|
+
|
|
72
|
+
[source,ruby]
|
|
73
|
+
----
|
|
74
|
+
# Parse
|
|
75
|
+
tbx = Tbx::Document.from_xml(xml_string)
|
|
76
|
+
|
|
77
|
+
# Access elements
|
|
78
|
+
tbx.tbx_header.file_desc.source_desc
|
|
79
|
+
tbx.text.body.concept_entry.each do |entry|
|
|
80
|
+
entry.lang_sec.each do |lang|
|
|
81
|
+
lang.term_sec.each do |ts|
|
|
82
|
+
puts ts.term.content.join
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Serialize back
|
|
88
|
+
tbx.to_xml
|
|
89
|
+
tbx.to_xml(pretty: true, declaration: true, encoding: "utf-8")
|
|
90
|
+
----
|
|
91
|
+
|
|
92
|
+
=== Supported TBX elements
|
|
93
|
+
|
|
94
|
+
==== Root and structure
|
|
95
|
+
|
|
96
|
+
`Document` (`<tbx>`), `TbxHeader`, `TextElement`, `Body`, `Back`
|
|
97
|
+
|
|
98
|
+
==== Terminological entries
|
|
99
|
+
|
|
100
|
+
`ConceptEntry`, `LangSec`, `TermSec`, `Term`
|
|
101
|
+
|
|
102
|
+
==== Data categories
|
|
103
|
+
|
|
104
|
+
`Admin`, `AdminGrp`, `AdminNote`, `Descrip`, `DescripGrp`, `DescripNote`,
|
|
105
|
+
`TermNote`, `TermNoteGrp`, `Ref`, `Xref`
|
|
106
|
+
|
|
107
|
+
==== Transactions
|
|
108
|
+
|
|
109
|
+
`Transac`, `TransacGrp`, `TransacNote`, `DateElement`
|
|
110
|
+
|
|
111
|
+
==== Header
|
|
112
|
+
|
|
113
|
+
`FileDesc`, `PublicationStmt`, `TitleStmt`, `SourceDesc`, `EncodingDesc`,
|
|
114
|
+
`RevisionDesc`, `Change`
|
|
115
|
+
|
|
116
|
+
==== Reference objects
|
|
117
|
+
|
|
118
|
+
`RefObjectSec`, `RefObject`, `ItemSet`, `ItemGrp`, `Item`
|
|
119
|
+
|
|
120
|
+
==== Inline
|
|
121
|
+
|
|
122
|
+
`Hi`, `Foreign`, `Ec`, `Sc`, `Ph`, `Note`, `P`, `Title`
|
|
123
|
+
|
|
124
|
+
== Test data
|
|
125
|
+
|
|
126
|
+
Test fixtures are sourced from the
|
|
127
|
+
https://github.com/LTAC-Global/TBX_test_files[TBX_test_files] repository
|
|
128
|
+
maintained by https://ltac-global.org[LTAC Global], and from the TBX-Basic
|
|
129
|
+
dialect schemas included in `reference-docs/`.
|
|
130
|
+
|
|
131
|
+
== Development
|
|
132
|
+
|
|
133
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
|
134
|
+
run `bundle exec rake` to run the tests and linter.
|
|
135
|
+
|
|
136
|
+
[source,bash]
|
|
137
|
+
----
|
|
138
|
+
# Run tests
|
|
139
|
+
bundle exec rspec
|
|
140
|
+
|
|
141
|
+
# Run linter
|
|
142
|
+
bundle exec rubocop
|
|
143
|
+
|
|
144
|
+
# Run both (default task)
|
|
145
|
+
bundle exec rake
|
|
146
|
+
----
|
|
147
|
+
|
|
148
|
+
== Credits
|
|
149
|
+
|
|
150
|
+
This gem is developed, maintained and funded by
|
|
151
|
+
https://www.ribose.com[Ribose Inc.]
|
|
152
|
+
|
|
153
|
+
== License
|
|
154
|
+
|
|
155
|
+
The gem is available as open source under the terms of the
|
|
156
|
+
https://opensource.org/licenses/BSD-2-Clause[2-Clause BSD License].
|
data/Rakefile
ADDED
data/lib/tbx/admin.rb
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tbx
|
|
4
|
+
class Admin < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
6
|
+
attribute :lang, Lutaml::Xml::W3c::XmlLangType
|
|
7
|
+
attribute :target, :string
|
|
8
|
+
attribute :datatype, :string
|
|
9
|
+
attribute :type, :string
|
|
10
|
+
attribute :content, :string, collection: true
|
|
11
|
+
attribute :hi, ::Tbx::Hi, collection: true
|
|
12
|
+
attribute :ec, ::Tbx::Ec, collection: true
|
|
13
|
+
attribute :foreign, ::Tbx::Foreign, collection: true
|
|
14
|
+
attribute :ph, ::Tbx::Ph, collection: true
|
|
15
|
+
attribute :sc, ::Tbx::Sc, collection: true
|
|
16
|
+
|
|
17
|
+
xml do
|
|
18
|
+
root "admin"
|
|
19
|
+
mixed_content
|
|
20
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
21
|
+
|
|
22
|
+
map_attribute "id", to: :id
|
|
23
|
+
w3c_attributes :lang
|
|
24
|
+
map_attribute "target", to: :target
|
|
25
|
+
map_attribute "datatype", to: :datatype
|
|
26
|
+
map_attribute "type", to: :type
|
|
27
|
+
map_content to: :content
|
|
28
|
+
map_element "hi", to: :hi
|
|
29
|
+
map_element "ec", to: :ec
|
|
30
|
+
map_element "foreign", to: :foreign
|
|
31
|
+
map_element "ph", to: :ph
|
|
32
|
+
map_element "sc", to: :sc
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tbx
|
|
4
|
+
class AdminGrp < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
6
|
+
attribute :admin, ::Tbx::Admin
|
|
7
|
+
attribute :admin_note, ::Tbx::AdminNote, collection: true
|
|
8
|
+
attribute :note, ::Tbx::Note, collection: true
|
|
9
|
+
attribute :ref, ::Tbx::Ref, collection: true
|
|
10
|
+
attribute :xref, ::Tbx::Xref, collection: true
|
|
11
|
+
|
|
12
|
+
xml do
|
|
13
|
+
root "adminGrp"
|
|
14
|
+
mixed_content
|
|
15
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
16
|
+
|
|
17
|
+
map_attribute "id", to: :id
|
|
18
|
+
map_element "admin", to: :admin
|
|
19
|
+
map_element "adminNote", to: :admin_note
|
|
20
|
+
map_element "note", to: :note
|
|
21
|
+
map_element "ref", to: :ref
|
|
22
|
+
map_element "xref", to: :xref
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tbx
|
|
4
|
+
class AdminNote < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
6
|
+
attribute :lang, Lutaml::Xml::W3c::XmlLangType
|
|
7
|
+
attribute :target, :string
|
|
8
|
+
attribute :datatype, :string
|
|
9
|
+
attribute :type, :string
|
|
10
|
+
attribute :content, :string, collection: true
|
|
11
|
+
|
|
12
|
+
xml do
|
|
13
|
+
root "adminNote"
|
|
14
|
+
mixed_content
|
|
15
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
16
|
+
|
|
17
|
+
map_attribute "id", to: :id
|
|
18
|
+
w3c_attributes :lang
|
|
19
|
+
map_attribute "target", to: :target
|
|
20
|
+
map_attribute "datatype", to: :datatype
|
|
21
|
+
map_attribute "type", to: :type
|
|
22
|
+
map_content to: :content
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/tbx/back.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tbx
|
|
4
|
+
class Back < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
6
|
+
attribute :ref_object_sec, ::Tbx::RefObjectSec, collection: true
|
|
7
|
+
|
|
8
|
+
xml do
|
|
9
|
+
root "back"
|
|
10
|
+
mixed_content
|
|
11
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
12
|
+
|
|
13
|
+
map_attribute "id", to: :id
|
|
14
|
+
map_element "refObjectSec", to: :ref_object_sec
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/tbx/body.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tbx
|
|
4
|
+
class Body < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
6
|
+
attribute :concept_entry, ::Tbx::ConceptEntry, collection: true
|
|
7
|
+
|
|
8
|
+
xml do
|
|
9
|
+
root "body"
|
|
10
|
+
mixed_content
|
|
11
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
12
|
+
|
|
13
|
+
map_attribute "id", to: :id
|
|
14
|
+
map_element "conceptEntry", to: :concept_entry
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/tbx/change.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tbx
|
|
4
|
+
class Change < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
6
|
+
attribute :lang, Lutaml::Xml::W3c::XmlLangType
|
|
7
|
+
attribute :p, ::Tbx::P, collection: true
|
|
8
|
+
|
|
9
|
+
xml do
|
|
10
|
+
root "change"
|
|
11
|
+
mixed_content
|
|
12
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
13
|
+
|
|
14
|
+
map_attribute "id", to: :id
|
|
15
|
+
w3c_attributes :lang
|
|
16
|
+
map_element "p", to: :p
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tbx
|
|
4
|
+
class ConceptEntry < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
6
|
+
attribute :admin, ::Tbx::Admin, collection: true
|
|
7
|
+
attribute :admin_grp, ::Tbx::AdminGrp, collection: true
|
|
8
|
+
attribute :descrip, ::Tbx::Descrip, collection: true
|
|
9
|
+
attribute :descrip_grp, ::Tbx::DescripGrp, collection: true
|
|
10
|
+
attribute :note, ::Tbx::Note, collection: true
|
|
11
|
+
attribute :ref, ::Tbx::Ref, collection: true
|
|
12
|
+
attribute :transac_grp, ::Tbx::TransacGrp, collection: true
|
|
13
|
+
attribute :xref, ::Tbx::Xref, collection: true
|
|
14
|
+
attribute :lang_sec, ::Tbx::LangSec, collection: true
|
|
15
|
+
|
|
16
|
+
xml do
|
|
17
|
+
root "conceptEntry"
|
|
18
|
+
mixed_content
|
|
19
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
20
|
+
|
|
21
|
+
map_attribute "id", to: :id
|
|
22
|
+
map_element "admin", to: :admin
|
|
23
|
+
map_element "adminGrp", to: :admin_grp
|
|
24
|
+
map_element "descrip", to: :descrip
|
|
25
|
+
map_element "descripGrp", to: :descrip_grp
|
|
26
|
+
map_element "note", to: :note
|
|
27
|
+
map_element "ref", to: :ref
|
|
28
|
+
map_element "transacGrp", to: :transac_grp
|
|
29
|
+
map_element "xref", to: :xref
|
|
30
|
+
map_element "langSec", to: :lang_sec
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/tbx/date.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tbx
|
|
4
|
+
class DateElement < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
6
|
+
attribute :content, :string
|
|
7
|
+
|
|
8
|
+
xml do
|
|
9
|
+
root "date"
|
|
10
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
11
|
+
|
|
12
|
+
map_attribute "id", to: :id
|
|
13
|
+
map_content to: :content
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/tbx/descrip.rb
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Tbx
|
|
4
|
+
class Descrip < Lutaml::Model::Serializable
|
|
5
|
+
attribute :id, :string
|
|
6
|
+
attribute :lang, Lutaml::Xml::W3c::XmlLangType
|
|
7
|
+
attribute :target, :string
|
|
8
|
+
attribute :datatype, :string
|
|
9
|
+
attribute :type, :string
|
|
10
|
+
attribute :content, :string, collection: true
|
|
11
|
+
attribute :hi, ::Tbx::Hi, collection: true
|
|
12
|
+
attribute :ec, ::Tbx::Ec, collection: true
|
|
13
|
+
attribute :foreign, ::Tbx::Foreign, collection: true
|
|
14
|
+
attribute :ph, ::Tbx::Ph, collection: true
|
|
15
|
+
attribute :sc, ::Tbx::Sc, collection: true
|
|
16
|
+
|
|
17
|
+
xml do
|
|
18
|
+
root "descrip"
|
|
19
|
+
mixed_content
|
|
20
|
+
namespace ::Tbx::Namespaces::TbxNamespace
|
|
21
|
+
|
|
22
|
+
map_attribute "id", to: :id
|
|
23
|
+
w3c_attributes :lang
|
|
24
|
+
map_attribute "target", to: :target
|
|
25
|
+
map_attribute "datatype", to: :datatype
|
|
26
|
+
map_attribute "type", to: :type
|
|
27
|
+
map_content to: :content
|
|
28
|
+
map_element "hi", to: :hi
|
|
29
|
+
map_element "ec", to: :ec
|
|
30
|
+
map_element "foreign", to: :foreign
|
|
31
|
+
map_element "ph", to: :ph
|
|
32
|
+
map_element "sc", to: :sc
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|