Ticket #26 (new enhancement)

Opened 2 years ago

Remove getElement() from the Constraint interface - An easy fix, no prior mulgara-internals experience required.

Reported by: andrae Assigned to: pag
Priority: minor Milestone:
Component: Mulgara Version:
Keywords: Cc:

Description

Back in the distant past when the only type of Constraint supported was what we now refer to as ConstraintImpl, getElement() was an ugly, but harmless way of obtaining the different elements of a constraint.

Now that we have dozens of different constraint types, the vast majority of which have to implement getElement() by throwing an exception, this is not so harmless.

It would be great if someone could go through the codebase and:

1) Add getSubject(), getPredicate(), and getObject() to ConstraintImpl
2) Find each call to ConstraintImpl::getElement(), and replace with the appropriate call (element 0->subject, 1->predicate, 2->object; 3->model but that should already have been done).
3) Repeat for ConstraintNegation (and any other constraint type that implements getElement(), but IIRC there aren't any).
4) Remove getElement() from the Constraint interface and implementing classes thereby banishing this aberration.