Skip to content

Term normalization for .quad function? #145

@blake-regalia

Description

@blake-regalia

While this issue is related to the .equals function, it actually exists outside the scope of the other discussions we've had. This one might be addressed by amending the definition of the .quad function itself, but right now there is asymmetry in the naive implementation:

let realTerm = factory.namedNode('http://ex.org/red');
let fakeTerm = {
	termType: 'NamedNode',
	value: 'http://ex.org/red',
};

let realQuad = factory.quad(realTerm, realTerm, realTerm, realTerm);
let fakeQuad = factory.quad(fakeTerm, fakeTerm, fakeTerm, fakeTerm);

realQuad.equals(fakeQuad);  // `true`
fakeQuad.equals(realQuad);  // throws exception

Most importantly, without specifying some needs for normalizing arguments passed to .quad (as it is now), we will see different behavior, i.e., inconsistencies in the results of .equals, between implementations that normalize terms passed to .quad and those that don't.

I understand that the parameter type is specified as Term to the .quad function, but I think it's important to at least consider and discuss these circumstances. Possibly related to #104 and #137

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions