class BibTeX::Bibliography::RDFConverter

Attributes

agent[R]
bibtex[R]
graph[R]

Public Class Methods

convert(bibtex) click to toggle source

converts a BibTeX Bibliography to RDF @return [RDF::Graph] the RDF graph of the bibliography

# File lib/bibtex/bibliography/rdf_converter.rb, line 4
def self.convert(bibtex)
  new(bibtex).convert!
end
new(bibtex, graph = RDF::Graph.new) click to toggle source

@param [BibTeX::Entry] the bibliography to convert

# File lib/bibtex/bibliography/rdf_converter.rb, line 9
def initialize(bibtex, graph = RDF::Graph.new)
  @bibtex = bibtex
  @graph = graph
  @agent = {}
end

Public Instance Methods

convert!() click to toggle source

@return [RDF::Graph] the RDF graph of this bibliography

# File lib/bibtex/bibliography/rdf_converter.rb, line 16
def convert!
  bibtex.q('@entry').each do |entry|
    BibTeX::Entry::RDFConverter.convert(entry, graph, agent)
  end

  graph
end