Sha256: dbbf8a06cc5f5ae2cd7a540b9f56979832f5a29b3d9a7ef0f884475eac90922c

Contents?: true

Size: 626 Bytes

Versions: 49

Compression:

Stored size: 626 Bytes

Contents

class BibTeX::Bibliography::RDFConverter
  # converts a BibTeX Bibliography to RDF
  # @return [RDF::Graph] the RDF graph of the bibliography
  def self.convert(bibtex)
    new(bibtex).convert!
  end

  # @param [BibTeX::Entry] the bibliography to convert
  def initialize(bibtex, graph = RDF::Graph.new)
    @bibtex = bibtex
    @graph = graph
    @agent = {}
  end

  # @return [RDF::Graph] the RDF graph of this bibliography
  def convert!
    bibtex.q('@entry').each do |entry|
      BibTeX::Entry::RDFConverter.convert(entry, graph, agent)
    end

    graph
  end

  protected

  attr_reader :bibtex, :graph, :agent
end

Version data entries

49 entries across 49 versions & 3 rubygems

Version Path
bibtex-ruby-6.1.0 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-6.0.0 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-5.1.6 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-5.1.5 lib/bibtex/bibliography/rdf_converter.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/bibtex-ruby-5.1.4/lib/bibtex/bibliography/rdf_converter.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/bibtex-ruby-5.1.4/lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-5.1.4 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-5.1.3 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-5.1.2 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-5.1.1 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-5.1.0 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-5.0.1 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-5.0.0 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.4.7 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.4.6 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.4.5 lib/bibtex/bibliography/rdf_converter.rb
bibtex_to_scrapbox-0.2.0 gems/gems/bibtex-ruby-4.4.4/lib/bibtex/bibliography/rdf_converter.rb
bibtex_to_scrapbox-0.1.0 gems/gems/bibtex-ruby-4.4.4/lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.4.4 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.4.3 lib/bibtex/bibliography/rdf_converter.rb