weird behavior with class compares

Bug #185826 reported by Mike Travers
2
Affects Status Importance Assigned to Milestone
ActiveRDF
New
Undecided
Unassigned

Bug Description

This was utterly confusing me, until I figured out it is because ActiveRDF specializes the == method for its classes!

>> b = BNode.new("foo")
=> #<BNode:0x371ace8 @predicates={}, @uri="foo">
>> b.class
=> BNode
>> RDFS::Resource
=> RDFS::Resource
>> BNode.class
=> Class
>> RDFS::Resource.class
=> Class
>> b.class == RDFS::Resource
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.uri
 from /usr/local/lib/ruby/gems/1.8/gems/activerdf-1.6.8/lib/active_rdf/objectmanager/resource.rb:48:in `uri'
 from /usr/local/lib/ruby/gems/1.8/gems/activerdf-1.6.8/lib/active_rdf/objectmanager/resource.rb:50:in `=='
 from (irb):79
 from :0

Revision history for this message
michael (michael-thinknasium) wrote :

There is a bug here and its that BNode doesn't have a class_uri set.

b.class != RDFS::Resource
b.class == RDFS::Resource.class

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.