Re: PROPOSAL to close ISSUE-49: RDFNode type, equality and canonicalization

On Wed, 10 Nov 2010 20:42:51 -0500
Manu Sporny <msporny@digitalbazaar.com> wrote:

> The equals() method will return true if both RDFNodes have the same
> nodeType() and the same toCanonical() result. Simple string comparison
> between the two methods is sufficient when testing for equality
> between RDFNodes.

My implementation already has an isEqual method that works precisely
that way. :-) I'll just need to rename it.

FWIW my isEqual also accepts a string as a parameter, so:

	$iri = RDF::RDFa::API::IRI->new('http://example.com/');
	$iri->isEqual('<http://example.com/>');   # true

There's a reason for that - I overload Perl's normal 'eq' operator
which tests for string equality, so I can do this:

	$iri = RDF::RDFa::API::IRI->new('http://example.com/');
	if ($iri eq '<http://example.com/>')
	{
		# this will happen
	}

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Thursday, 11 November 2010 15:11:16 UTC