ruby-rdf / rdf-vocab

Common RDF Vocabularies
The Unlicense
50 stars 29 forks source link

after running `rake gen_vocabs` rspec tests fail #26

Closed cgalarza closed 8 years ago

cgalarza commented 9 years ago

(On the current develop branch)

I forked the repository in hopes of adding a new ontology. I added my ontology and then ran rake gen_vocabs. I ran git status and saw that a few of the vocabs were updated and a few were added. I expected that the only change would be the ontology I added. I then got an error when I tried to run the rspec tests.

I reverted all the changes, ran the vocab generator, ran the spec tests, and got the following error:

/../rdf-vocab/lib/rdf/vocab.rb:156:in `<module:Vocab>': uninitialized constant RDF::MA (NameError)
    from /.../rdf-vocab/lib/rdf/vocab.rb:6:in `<module:RDF>'
    from /.../rdf-vocab/lib/rdf/vocab.rb:5:in `<top (required)>'
    from /.../rdf-vocab/spec/spec_helper.rb:2:in `require'
gkellogg commented 9 years ago

The top of develop definitely builds cleanly, as is verified by Travis CI.

You may need to do a bundle update, as RDF::MA is pulled in from the RDF.rb gem.

cgalarza commented 9 years ago

I did a bundle update and all of the gems were up to date.

Am I correct in thinking that if I pull down the develop branch and run rake gen_vocabs none of the files should change, because the repository should have the latest versions of the vocab?

Thanks for your help!

gkellogg commented 9 years ago

No, gen_vocabs will re-fetch and serialize all vocabularies, which may have changed.

cgalarza commented 9 years ago

But it shouldn't add any new files, right? When I ran the generator it created files for MA, MO, OG, OGC, though it shouldn't have because they are aliased in the rdf gem.

I reverted all the files that were generated and then in vocab.rb, I added alias: true to the mo, ma, og, ogc definitions. I then ran the vocab generator and the error above was fixed, but I instead got this error:

/usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:737:in `rescue in []': Individual not found in vocabulary RDF::OWL (KeyError)
    from /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:735:in `[]'
    from /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:169:in `expand_pname'
    from /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `block in method_missing'

The generation of the LDP vocab changed the type of a few of the properties from owl:NamedIndividual to owl:Individual:

-      type: "owl:NamedIndividual".freeze,
+      type: "owl:Individual".freeze,

Individual is not defined in the owl vocab in the rdf gem, but NamedIndividual is. I reverted back lib/rdf/vocab/ldp.rb and the Rspec test run, but I get the following failures:

Failures:

  1) RDF::Vocab entailments cnt:leadingMisc range
     Failure/Error: expect {term.range.map(&:pname)}.not_to raise_error
       expected no Exception, got #<KeyError: XMLLiteral not found in vocabulary RDF::RDFS> with backtrace:
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:737:in `rescue in []'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:735:in `[]'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:169:in `expand_pname'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `block in method_missing'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `map'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `method_missing'
         # ./spec/vocab_spec.rb:54:in `block (7 levels) in <top (required)>'
         # ./spec/vocab_spec.rb:54:in `block (6 levels) in <top (required)>'
     # ./spec/vocab_spec.rb:54:in `block (6 levels) in <top (required)>'

  2) RDF::Vocab entailments cnt:rest range
     Failure/Error: expect {term.range.map(&:pname)}.not_to raise_error
       expected no Exception, got #<KeyError: XMLLiteral not found in vocabulary RDF::RDFS> with backtrace:
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:737:in `rescue in []'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:735:in `[]'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:169:in `expand_pname'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `block in method_missing'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `map'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `method_missing'
         # ./spec/vocab_spec.rb:54:in `block (7 levels) in <top (required)>'
         # ./spec/vocab_spec.rb:54:in `block (6 levels) in <top (required)>'
     # ./spec/vocab_spec.rb:54:in `block (6 levels) in <top (required)>'

  3) RDF::Vocab entailments marcrelators:lee subPropertyOf
     Failure/Error: expect {term.subPropertyOf.map(&:pname)}.not_to raise_error
       expected no Exception, got #<KeyError: lei not found in vocabulary RDF::Vocab::MARCRelators> with backtrace:
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:737:in `rescue in []'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:735:in `[]'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:169:in `expand_pname'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `block in method_missing'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `map'
         # /usr/local/rvm/gems/ruby-2.2.0/bundler/gems/rdf-e27d00d8b78d/lib/rdf/vocabulary.rb:705:in `method_missing'
         # ./spec/vocab_spec.rb:48:in `block (7 levels) in <top (required)>'
         # ./spec/vocab_spec.rb:48:in `block (6 levels) in <top (required)>'
     # ./spec/vocab_spec.rb:48:in `block (6 levels) in <top (required)>'

I am not sure if my changes helped or hurt the problem. Any guidance would be appreciated.

gkellogg commented 9 years ago

Some of these vocabularies do, indeed, need to be fixed by hand. An automated way of doing this would be nice. In most cases, bug reports have been created, but haven't been responded to.

After running the update, reverting changes to ldp.rb, fixing the XMLLiteral issue in cnt.rb, and reverting marc_relators.rb does the trick.

Suggestions and/or PR requests to automate this would be welcome.

I fixed this up in develop.

gkellogg commented 9 years ago

Seems to be building properly, other than known errors with some vocabularies (MARC and LDP).