the older implementation looped over each statement. within those loops it
looped over each inlined resource URI. then it allocated an entirely new graph
and shoveled resources into it.
RDF.rb doesn't have a delete-by-query, but we can do a lot better by: looping
over the inlined resource URIs, doing a query (which is a hash lookup O(1)-ish),
and then using #delete (which is also hash-driven) to drop matching
statements. in addition to involving much faster data structure operations, this
should avoid a large number of allocations in the normal case.
the older implementation looped over each statement. within those loops it looped over each inlined resource URI. then it allocated an entirely new graph and shoveled resources into it.
RDF.rb doesn't have a delete-by-query, but we can do a lot better by: looping over the inlined resource URIs, doing a query (which is a hash lookup O(1)-ish), and then using
#delete
(which is also hash-driven) to drop matching statements. in addition to involving much faster data structure operations, this should avoid a large number of allocations in the normal case.