Method: RDF::URI#==

Defined in:
lib/rdf/model/uri.rb

#==(other) ⇒ Boolean

Checks whether this URI is equal to other (type checking).

Per SPARQL data-r2/expr-equal/eq-2-2, numeric can't be compared with other types

Examples:

RDF::URI('http://t.co/') == RDF::URI('http://t.co/')    #=> true
RDF::URI('http://t.co/') == 'http://t.co/'              #=> true
RDF::URI('http://www.w3.org/2000/01/rdf-schema#') == RDF::RDFS        #=> true

Parameters:

  • other (Object)

Returns:

  • (Boolean)

    true or false

See Also:



779
780
781
782
783
784
785
786
787
788
# File 'lib/rdf/model/uri.rb', line 779

def ==(other)
  case other
  when Literal
    # If other is a Literal, reverse test to consolodate complex type checking logic
    other == self
  when String then to_s == other
  when URI then hash == other.hash && to_s == other.to_s
  else other.respond_to?(:to_uri) && to_s == other.to_uri.to_s
  end
end