rdf-mt/tests/convert-manifest.rb
author Ivan Herman <ivan@ivan-herman.net>
Sat, 29 Nov 2014 09:59:49 +0100
changeset 2035 1fda78347d91
parent 1116 68d68502a9da
permissions -rwxr-xr-x
rdfs:approval has been changed to rift:approval
1113
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
     1
#!/usr/bin/env ruby
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
     2
# Convert 2004 manifest to 2013 format and vocabulary
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
     3
require 'linkeddata'
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
     4
require 'fileutils'
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
     5
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
     6
TEST = RDF::Vocabulary.new("http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#")
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
     7
QUERY = SPARQL.parse(%(
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
     8
  PREFIX test: <http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#>
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
     9
  SELECT ?subject ?type ?description ?premise ?conclusion
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    10
  WHERE {
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    11
    ?subject a ?type;
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    12
      test:status "APPROVED";
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    13
      test:premiseDocument ?premise;
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    14
      test:conclusionDocument ?conclusion;
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    15
      OPTIONAL {
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    16
        ?subject test:description ?description
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    17
      }
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    18
    FILTER(?type = test:PositiveEntailmentTest || ?type = test:NegativeEntailmentTest)
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    19
  }
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    20
))
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    21
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    22
g = RDF::Repository.load("2004-test-suite/Manifest.rdf")
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    23
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    24
tests = {}
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    25
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    26
File.open("manifest.ttl", "w") do |f|
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    27
  f.write(%(
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    28
    # RDF Schema and Semantics tests
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    29
    ## Distributed under both the W3C Test Suite License[1] and the W3C 3-
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    30
    ## clause BSD License[2]. To contribute to a W3C Test Suite, see the
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    31
    ## policies and contribution forms [3]
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    32
    ##
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    33
    ## 1. http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    34
    ## 2. http://www.w3.org/Consortium/Legal/2008/03-bsd-license
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    35
    ## 3. http://www.w3.org/2004/10/27-testcases
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    36
    
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    37
    @prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    38
    @prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    39
    @prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    40
    @prefix rdft:   <http://www.w3.org/ns/rdftest#> .
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    41
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    42
    <> rdf:type mf:Manifest ;
1115
b02866fcb433 fix problem in rdf-mt manifest
Gregg Kellogg <gregg@kellogg-assoc.com>
parents: 1114
diff changeset
    43
      rdfs:comment "RDF Schema and Semantics tests" ;
1114
bd5749f3a40a fix problem in rdf-mt manifest
Gregg Kellogg <gregg@kellogg-assoc.com>
parents: 1113
diff changeset
    44
      mf:entries \()[1..-1].gsub(/^    /, ''))
1113
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    45
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    46
  QUERY.execute(g).each do |soln|
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    47
    #puts soln.inspect
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    48
    dir = soln.subject.path.split('/')[-2]
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    49
    frag = "##{dir}-#{soln.subject.fragment}"
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    50
    puts "test #{dir}/'#{frag}' already defined" if tests.has_key?(frag)
1114
bd5749f3a40a fix problem in rdf-mt manifest
Gregg Kellogg <gregg@kellogg-assoc.com>
parents: 1113
diff changeset
    51
    f.write("\n    <#{frag}>")
1113
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    52
    tests[frag] = soln
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    53
  end
1114
bd5749f3a40a fix problem in rdf-mt manifest
Gregg Kellogg <gregg@kellogg-assoc.com>
parents: 1113
diff changeset
    54
  f.puts("\n  ) .\n\n")
1113
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    55
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    56
  tests.each_pair do |frag, test|
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    57
    # Wrap description to 40 characters and indent
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    58
    desc = test.description.
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    59
      to_s.
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    60
      strip.
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    61
      gsub(/\s+/m, ' ').
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    62
      scan(/\S.{0,60}\S(?=\s|$)|\S+/).
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    63
      join("\n    ")
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    64
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    65
    [:premise, :conclusion].each do |t|
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    66
      test[t] = if test[t].node?
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    67
        'false'
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    68
      else
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    69
        path = test[t].path.split('/')[-2..-1].join('/')
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    70
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    71
        # Copy the test into place, if it does not exist.
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    72
        # If it is an RDF/XML file, transform it to Turtle
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    73
        parts = path.split('/')
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    74
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    75
        FileUtils.mkdir(parts.first) unless Dir.exist?(parts.first)
1116
68d68502a9da Ensure that .rdf file extensions are changed to .ttl for MT test manifest
Gregg Kellogg <gregg@kellogg-assoc.com>
parents: 1115
diff changeset
    76
        if File.exist?(path.sub('.rdf', '.ttl'))
68d68502a9da Ensure that .rdf file extensions are changed to .ttl for MT test manifest
Gregg Kellogg <gregg@kellogg-assoc.com>
parents: 1115
diff changeset
    77
          path.sub!('.rdf', '.ttl')
68d68502a9da Ensure that .rdf file extensions are changed to .ttl for MT test manifest
Gregg Kellogg <gregg@kellogg-assoc.com>
parents: 1115
diff changeset
    78
        else
1113
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    79
          if parts.last =~ /\.rdf/
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    80
            puts "Transform 2004-test-suite/#{path} to #{path.sub('.rdf', '.ttl')}"
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    81
            RDF::RDFXML::Reader.open("2004-test-suite/#{path}") do |reader|
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    82
              doc = reader.instance_variable_get(:@doc)
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    83
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    84
              # Retain comment
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    85
              comment = doc.children.detect {|c| c.is_a?(Nokogiri::XML::Comment)}
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    86
              comment = comment ? comment.content : ""
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    87
              test_graph = RDF::Graph.new << reader
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    88
              ttl = test_graph.dump(:ttl, :standard_prefixes => true, :prefixes => {
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    89
                :test => TEST.to_uri
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    90
              })
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    91
              parts[1] = parts.last.sub('.rdf', '.ttl')
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    92
              path = parts.join("/")
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    93
              File.open(path, "w") do |ttl_file|
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    94
                # Output existing comment
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    95
                comment.lines.each do |line|
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    96
                  ttl_file.write("# #{line}")
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    97
                end
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    98
                ttl_file.write(ttl)
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
    99
              end
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   100
            end
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   101
          else
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   102
            puts "Copy 2004-test-suite/#{path} to #{path}"
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   103
            FileUtils.cp "2004-test-suite/#{path}", path
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   104
          end
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   105
        end
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   106
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   107
        # Use this relative path in manifest
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   108
        "<#{path}>"
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   109
      end
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   110
    end
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   111
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   112
    f.puts(%(
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   113
      <#{frag}> a mf:#{test.type.fragment};
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   114
        mf:name "#{frag[1..-1]}";
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   115
        rdfs:comment """
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   116
          #{desc}
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   117
        """;
2035
1fda78347d91 rdfs:approval has been changed to rift:approval
Ivan Herman <ivan@ivan-herman.net>
parents: 1116
diff changeset
   118
        rdft:approval rdft:Approved;
1113
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   119
        mf:action #{test.premise};
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   120
        mf:result #{test.conclusion} .
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   121
    )[1..-1].gsub(/^      /, ''))
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   122
  end
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   123
end
dcd08e341441 Add rdf-mt test manifest converstions script and results. Also converts RDF/XML documents to Turtle.
Gregg Kellogg <gregg@kellogg-assoc.com>
parents:
diff changeset
   124