An open API service indexing awesome lists of open source software.

https://github.com/zuki/ruby-bibframe


https://github.com/zuki/ruby-bibframe

Last synced: 8 months ago
JSON representation

Awesome Lists containing this project

README

          

# Bibframe

[marc2bibframe](https://github.com/lcnetdev/marc2bibframe)のXQueryをRubyに変換した、MARCXMLレコードを[Bibframe](http://www.loc.gov/bibframe/)形式に変換するRubyGem。

## インストール

以下をアプリケーションのGemfileに追加する:

gem 'ruby-bibframe', :git => "https://github.com/zuki/ruby-bibframe.git"

bundleコマンドを実行する:

$ bundle

## 利用法

````
require 'rdf'
require 'marc'
require 'bibframe'
require 'rdf/rdfxml'

reader = MARC::XMLReader.new('/path/to/MARCXML.xml')
repo = RDF::Repository.new
# 典拠IDを付加し、名前付きグラフにする
for record in reader
repo << Bibframe::BFRDF(record, resolve: true, repository: repo).graph
end

RDF::RDFXML::Writer.open('/path/to/output.rdf') do |writer|
writer << repo
end
````

## TODO

- Testの追加
- コードのリファイン
- Bibframeの進捗状況に合わせた改訂