Sha256: a800b7c32b48835442b6b201c8c53ec50dd06c5103a6cd51137cda5ddafa55f2

Contents?: true

Size: 1.72 KB

Versions: 3

Compression:

Stored size: 1.72 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", 'lib')))
require 'rdf/n3'
require 'rdf/rdfxml'
require 'rdf/rdfa'
require File.expand_path(File.join(File.dirname(__FILE__), "..", 'spec', 'rdfa_helper'))
require 'getoptlong'

def run_tc(tc)
  puts "run #{tc.name}"
  puts tc.input if $verbose
  pg = RDF::Graph.new if $pg_format
  RDF::Writer.for($output_format.to_sym).new do |writer|
    RDF::RDFa::Reader.new(tc.input,
      :base_uri => tc.informationResourceInput,
      :validate => $validate,
      :processor_graph => pg,
      :version => tc.version).each do |statement|
      writer << statement
    end
  end
  puts ""
  
  if pg
    puts "\nProcessor Graph:\n"
    puts pg.inspect
    RDF::Writer.for($pg_format.to_sym).new do |writer|
      writer << pg
    end
  end
end

$verbose = false
$output_format = :ntriples
$pg_format = nil
$validate = false
suite = "xhtml"
opts = GetoptLong.new(
  ["--debug", GetoptLong::NO_ARGUMENT],
  ["--verbose", GetoptLong::NO_ARGUMENT],
  ["--quiet", GetoptLong::NO_ARGUMENT],
  ["--suite", GetoptLong::OPTIONAL_ARGUMENT],
  ["--validate", GetoptLong::NO_ARGUMENT],
  ["--format", GetoptLong::REQUIRED_ARGUMENT],
  ["--pg-format", GetoptLong::REQUIRED_ARGUMENT]
)
opts.each do |opt, arg|
  case opt
  when '--verbose' then $verbose = true
  when '--quiet' then $quiet = true
  when '--debug' then ::RDF::RDFa::debug = true
  when '--format' then $output_format = arg
  when '--pg-format' then $pg_format = arg
  when '--suite' then suite = arg
  when '--validate' then $validate = true
  end
end

test_cases = RdfaHelper::TestCase.test_cases(suite)

test_cases.each do |tc|
  next unless ARGV.empty? || ARGV.any? {|n| tc.name.match(/#{n}/)}
  run_tc(tc)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rdf-rdfa-0.3.1.2 script/tc
rdf-rdfa-0.3.1.1 script/tc
rdf-rdfa-0.3.0 script/tc