LinkedHashModel filter method incorrect implementation

Description

org.openrdf.model.impl.LinkedHashModel does not perform per expected contract if multiple options are non-null.

IE : If model.filter(s1,p1,o1,c1), the filters are not additive (as demonstrated in tests, view of codebase). It appears that the implementation creates 3-4 sets, one per non-null filter argument, and merely attempts to choose the smallest among them rather than utilizing all filters together to narrow the model (IE all triples with s1, p1, o1, c1, which at best should be ONE statement)

additionally, filter() consistently returns LAST filter argument provided, as a result of what appears to be a secondary bug in the private method smallest(Set<ModelStatement>... sets) The private method appears to iterate through the Sets and select the last non-null set that does not exceed minSize (set/final to Integer.MAX_VALUE).

Environment

None

Assignee

Jeen Broekstra

Reporter

Steve Hoffman

Labels

None

Affects versions

Priority

Major
Configure