Class: RDFObject::RDFAParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/rdf_objects/parsers.rb

Instance Attribute Summary

Attributes inherited from Parser

#base_uri, #collection

Instance Method Summary collapse

Methods inherited from Parser

init_parser, #initialize, parse, #sanitize_uri

Constructor Details

This class inherits a constructor from RDFObject::Parser

Instance Method Details

#data=(xhtml) ⇒ Object



451
452
453
# File 'lib/rdf_objects/parsers.rb', line 451

def data=(xhtml)
  @rdfa = xhtml  
end

#parseObject



455
456
457
458
459
460
461
462
463
# File 'lib/rdf_objects/parsers.rb', line 455

def parse
  rdfa_parser = RdfaParser::RdfaParser.new()
  html = open(uri)
  ntriples = ""
  rdfa_parser.parse(@rdfa, base_uri).each do | triple |
    ntriples << triple.to_ntriples + "\n"
  end
  RDFObject::Parser.parse(ntriples)
end