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-4.4.2 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.4.1 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.4.0 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.3.0 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.2.0 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.1.2 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.1.1 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.1.0 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.16 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.15 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.14 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.13 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.12 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.11 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.10 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.9 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.8 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.7 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.6 lib/bibtex/bibliography/rdf_converter.rb
bibtex-ruby-4.0.5 lib/bibtex/bibliography/rdf_converter.rb