Subject: | RDF::Core::Serializer populates Subjects hash with empty arrays |
In RDF/Core/Serializer.pm (starting at line 136):
while (defined $stmt) {
if
($self->getSubjects->{$stmt->getSubject->getURI}->[2]) {
$retval = $_;
last;
}
$stmt = $enum->getNext;
}
should be:
while (defined $stmt) {
if (exists
${$self->getSubjects}{$stmt->getSubject->getURI} &&
$self->getSubjects->{$stmt->getSubject->getURI}->[2]) {
$retval = $_;
last;
}
$stmt = $enum->getNext;
}
This prevents $stmt->getSubject from being populated by keys pointing to
empty arrays. The empty arrays cause problems elsewhere when they are
assumed to have a RDF::Core::Resource object at the 0 index.
This only arises when trying to serialize a part of a model instead of
the complete model. A possible work around is to add all subjects to
the getSubjects hash and mark them as serialized before serializing if
they aren't supposed to be in the resulting serialization.