Hi,
it’s me again with another tough one…
We’re trying to harvest our URNs (in epicur format) vie OAI-PMH. Now it turned out, that the Earliest Datestamp provided by /oai?verb=Identify seems not to be correct - there are a lot of older submissions in the system. I tried to trace this back and found, that the function here which inherits from here creates this value. It generates this query as far I can see
SELECT
CASE
WHEN COALESCE(dot.date_deleted, a.last_modified) > i.last_modified THEN i.last_modified
ELSE COALESCE(dot.date_deleted, a.last_modified)
END
FROM
mutex m
LEFT JOIN
published_articles pa ON (m.i = 0)
LEFT JOIN
articles a ON (a.article_id = pa.article_id)
LEFT JOIN
issues i ON (i.issue_id = pa.issue_id)
LEFT JOIN
sections s ON (s.section_id = a.section_id)
LEFT JOIN
journals j ON (j.journal_id = a.journal_id)
LEFT JOIN
data_object_tombstones dot ON (m.i = 1)
LEFT JOIN
data_object_tombstone_oai_set_objects tsoj ON tsoj.assoc_id = NULL
LEFT JOIN
data_object_tombstone_oai_set_objects tsos ON tsos.assoc_id = NULL
WHERE
((s.section_id IS NOT NULL
AND i.published = 1
AND j.enabled = 1
AND a.status <> 0)
OR dot.data_object_id IS NOT NULL)
An then takes the first result.. Since there is no order by clause in the query, how is this supposed to be the earlieist timestamp? It looks to me, that this might be a bug, and a simple order by clause could fix it - on the other hand, so many projects around the world use OAIPMH with OJS and don’t have this problem, so maybe the integrity of our database is not okay somehow? But how?
Someone have any thoughts about this? Thank you in advance as always for your help.
Best wishes,
Paf