Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to lutaml-model #90

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
44a457d
WIP create some model elements
andrew2net May 31, 2024
fe3f055
WIP create some model elements
andrew2net Jun 11, 2024
5bf0ae8
WIP create some model elements
andrew2net Jun 12, 2024
f80f4ea
WIP create some model elements
andrew2net Jun 13, 2024
95d2694
WIP create some model elements
andrew2net Jun 14, 2024
e35ed82
WIP create some model elements
andrew2net Jun 16, 2024
6aa72ea
WIP create some model elements
andrew2net Jun 22, 2024
e03d0da
WIP create some model elements
andrew2net Jun 29, 2024
20cb40d
WIP
andrew2net Aug 3, 2024
77dd434
WIP
andrew2net Aug 23, 2024
596f8e4
WIP
andrew2net Sep 11, 2024
e1ed1e1
WIP
andrew2net Sep 29, 2024
f48e54f
WIP
andrew2net Nov 9, 2024
c415182
WIP
andrew2net Dec 8, 2024
b8cce92
Merge branch 'main' into shale-integration
andrew2net Dec 23, 2024
511cf82
WIP create Bibitem::Model classes
andrew2net Dec 31, 2024
1635994
WIP
andrew2net Jan 8, 2025
b2dcf03
WIP update old YAML parser, we need to convert old files to new format
andrew2net Jan 23, 2025
9b2008f
WIP
andrew2net Jan 24, 2025
3c62ca0
WIP fixing tests
andrew2net Jan 25, 2025
535ad13
Merge branch 'main' into shale-integration
andrew2net Jan 27, 2025
f0b1bcc
Merge branch 'main' into shale-integration
andrew2net Jan 28, 2025
482b74b
WIP update invalid date parsing test & Util's namespace
andrew2net Jan 28, 2025
3bde703
WIP remove custom models & old files
andrew2net Jan 29, 2025
e556fc0
WIP udate mappings & remove unused files
andrew2net Jan 30, 2025
77b1fe0
WIP add XML validation in tests
andrew2net Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 35 additions & 24 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
= RelatonBib
= Relaton::Bib

image:https://img.shields.io/gem/v/relaton-bib.svg["Gem Version", link="https://rubygems.org/gems/relaton-bib"]
image:https://github.com/relaton/relaton-bib/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton-bib/actions?workflow=rake"]
image:https://codeclimate.com/github/relaton/relaton-bib/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-bib"]
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bib.svg["Pull Requests", link="https://github.com/relaton/relaton-bib/pulls"]
image:https://img.shields.io/github/commits-since/relaton/relaton-bib/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bib/releases"]

RelatonBib is a Ruby gem that implements the https://github.com/metanorma/relaton-models#bibliography-uml-models[BibliographicItem model].
Relaton::Bib is a Ruby gem that implements the https://github.com/metanorma/relaton-models#bibliography-uml-models[BibliographicItem model].

== Installation

Expand All @@ -27,23 +27,34 @@ Or install it yourself as:

== Usage

=== Create bibliographic item
=== Configuration

Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `Relaton::Bib.configure` block.

[source,ruby]
----
require 'relaton_bib'
=> true

Relaton::Bib.configure do |config|
config.logger.level = Logger::DEBUG
end
----

=== Create bibliographic item

[source,ruby]
----
hash = YAML.load_file "spec/examples/bib_item.yml"
=> {"id"=>"ISOTC211",
"fetched"=>"2022-05-02",
"title"=>["Geographic information", {"content"=>"Information géographique", "language"=>"fr", "script"=>"Latn"}],
...

item = RelatonBib::BibliographicItem.from_hash(hash)
=> #<RelatonBib::BibliographicItem:0x00007f962f030710
item = Relaton::Bib::Item.from_hash(hash)
=> #<Relaton::Bib::Item:0x00007f962f030710
@abstract=
[#<RelatonBib::FormattedString:0x00007f962f02acc0
[#<Relaton::Bib::FormattedString:0x00007f962f02acc0
...
----

Expand All @@ -52,24 +63,24 @@ item = RelatonBib::BibliographicItem.from_hash(hash)
[source,ruby]
----
item.title
=> #<RelatonBib::TypedTitleStringCollection:0x00007fea821ec6b0
=> #<Relaton::Bib::TitleCollection:0x00007fea821ec6b0
@array=
[#<RelatonBib::TypedTitleString:0x00007fea821ecb60
@title=#<RelatonBib::FormattedString:0x00007fea821eca70 @content="Geographic information", @format="text/plain", @language=nil, @script=nil>,
[#<Relaton::Bib::Title:0x00007fea821ecb60
@title=#<Relaton::Bib::FormattedString:0x00007fea821eca70 @content="Geographic information", @format="text/plain", @language=nil, @script=nil>,
@type="title-main">,
#<RelatonBib::TypedTitleString:0x00007fea821ec8b8
@title=#<RelatonBib::FormattedString:0x00007fea821ec818 @content="Geographic information", @format="text/plain", @language=nil, @script=nil>,
#<Relaton::Bib::Title:0x00007fea821ec8b8
@title=#<Relaton::Bib::FormattedString:0x00007fea821ec818 @content="Geographic information", @format="text/plain", @language=nil, @script=nil>,
@type="main">,
#<RelatonBib::TypedTitleString:0x00007fea821ec610
#<Relaton::Bib::Title:0x00007fea821ec610
@title=
#<RelatonBib::FormattedString:0x00007fea821ec570 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
#<Relaton::Bib::FormattedString:0x00007fea821ec570 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
@type=nil>]>

item.title lang: "fr"
=> #<RelatonBib::TypedTitleStringCollection:0x00007fea8222d908
=> #<Relaton::Bib::TitleCollection:0x00007fea8222d908
@array=
[#<RelatonBib::TypedTitleString:0x00007fea821ec610
@title=#<RelatonBib::FormattedString:0x00007fea821ec570 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
[#<Relaton::Bib::Title:0x00007fea821ec610
@title=#<Relaton::Bib::FormattedString:0x00007fea821ec570 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
@type=nil>]>
----

Expand All @@ -78,12 +89,12 @@ item.title lang: "fr"
[source,ruby]
----
item.abstract
=> [#<RelatonBib::FormattedString:0x00007fea82236828
=> [#<Relaton::Bib::FormattedString:0x00007fea82236828
@content="<p>ISO 19115-1:2014 defines the schema required for ...</p>",
@format="text/html",
@language=["en"],
@script=["Latn"]>,
#<RelatonBib::FormattedString:0x00007fea82236670
#<Relaton::Bib::FormattedString:0x00007fea82236670
@content="L'ISO 19115-1:2014 définit le schéma requis pour ...",
@format="text/plain",
@language=["fr"],
Expand Down Expand Up @@ -191,8 +202,8 @@ hash = YAML.load_file 'spec/examples/bib_item.yml'
=> {"id"=>"ISOTC211"
...

RelatonBib::BibliographicItem.from_hash hash
=> #<RelatonBib::BibliographicItem:0x007ff1524f8c88
Relaton::Bib::Item.from_hash hash
=> #<Relaton::Bib::Item:0x007ff1524f8c88
...
----

Expand All @@ -203,8 +214,8 @@ RelatonBib::BibliographicItem.from_hash hash
bibxml = File.read "spec/examples/rfc.xml"
=> <reference anchor=...

RelatonBib::BibXMLParser.parse bibxml
=> #<RelatonBib::BibliographicItem:0x00007f9d0c75b268
Relaton::Bib::BibXMLParser.parse bibxml
=> #<Relaton::Bib::Item:0x00007f9d0c75b268
...
----

Expand All @@ -226,9 +237,9 @@ item.to_hash

[source,ruby]
----
RelatonBib::BibtexParser.from_bibtex File.read('spec/examples/techreport.bib')
Relaton::Bib::BibtexParser.from_bibtex File.read('spec/examples/techreport.bib')
=> {"ISOTC211"=>
#<RelatonBib::BibliographicItem:0x007fedee0a2ab0
#<Relaton::Bib::Item:0x007fedee0a2ab0
...
----

Expand Down
Loading
Loading