Revision 7303
Added by ben leinfelder over 12 years ago
src/doi_registration.sql | ||
---|---|---|
339 | 339 |
from systemMetadata sm |
340 | 340 |
where doi.guid = sm.guid; |
341 | 341 |
|
342 |
--update resourceMap pointer TBD |
|
342 |
/** use plain old revision history **/ |
|
343 |
-- update obsoletedby |
|
344 |
update doi_registration doi |
|
345 |
set obsoletedBy = newer.guid |
|
346 |
from identifier id, identifier newer |
|
347 |
where doi.guid = id.guid |
|
348 |
and id.docid = newer.docid |
|
349 |
and newer.rev = (select min(next.rev) from identifier next where next.docid = id.docid and next.rev > id.rev); |
|
350 |
|
|
351 |
-- update the obsolets |
|
352 |
update doi_registration doi |
|
353 |
set obsoletes = older.guid |
|
354 |
from identifier id, identifier older |
|
355 |
where doi.guid = id.guid |
|
356 |
and id.docid = older.docid |
|
357 |
and older.rev = (select max(prev.rev) from identifier prev where prev.docid = id.docid and prev.rev < id.rev); |
|
358 |
|
|
359 |
/** |
|
360 |
select doi.guid, older.guid as obsoletes |
|
361 |
from doi_registration doi, identifier id, identifier older |
|
362 |
where doi.guid = id.guid |
|
363 |
and id.docid = older.docid |
|
364 |
and older.rev = (select max(prev.rev) from identifier prev where prev.docid = id.docid and prev.rev < id.rev) |
|
365 |
and doi.guid like 'doi:10.5063/AA/ABS.4%'; |
|
366 |
**/ |
|
367 |
|
|
368 |
|
|
369 |
-- update resourceMap pointer |
|
343 | 370 |
-- NOTE: some of these maps might not actually exist |
344 | 371 |
update doi_registration doi |
345 | 372 |
set resourceMapId = 'resourceMap_'||id.docid||'.'||id.rev |
... | ... | |
350 | 377 |
|
351 | 378 |
--update the resourcemapid for described data |
352 | 379 |
CREATE TABLE ecogrid_docids AS |
353 |
|
|
354 | 380 |
select distinct id.docid, id.rev, id.guid, substring(xpi.nodedata from 'ecogrid://knb/(.*)$') as data_docid |
355 | 381 |
from xml_path_index xpi, identifier id, xml_documents xmld |
356 | 382 |
where xpi.docid = xmld.docid |
357 | 383 |
and xmld.docid = id.docid |
358 | 384 |
and xmld.rev = id.rev |
359 | 385 |
and xpi.path like 'dataset/%/physical/distribution/online/url' |
360 |
and xpi.nodedata like 'ecogrid%'; |
|
386 |
and xpi.nodedata like 'ecogrid%' |
|
387 |
and id.guid in (select guid from doi_registration); |
|
361 | 388 |
|
362 |
-- TODO: include revisions for described data |
|
389 |
-- include revisions for described data |
|
390 |
INSERT INTO ecogrid_docids |
|
391 |
select distinct id.docid, id.rev, id.guid, substring(child.nodedata from 'ecogrid://knb/(.*)$') as data_docid |
|
392 |
from identifier id, xml_revisions docs, xml_nodes_revisions nodes, xml_nodes_revisions parent, xml_nodes_revisions child |
|
393 |
where id.docid = docs.docid |
|
394 |
and id.rev = docs.rev |
|
395 |
and docs.rootnodeid = nodes.rootnodeid |
|
396 |
and nodes.nodeid = child.parentnodeid |
|
397 |
and nodes.parentnodeid = parent.nodeid |
|
398 |
and nodes.nodename = 'url' |
|
399 |
and parent.nodename = 'online' |
|
400 |
and child.nodedata like 'ecogrid%' |
|
401 |
and child.nodetype = 'TEXT' |
|
402 |
and id.guid in (select guid from doi_registration); |
|
363 | 403 |
|
364 | 404 |
-- NOTE: some of thee maps might not actually exist |
365 | 405 |
update doi_registration doi |
... | ... | |
368 | 408 |
where doi.guid = id.guid |
369 | 409 |
and id.docid||'.'||id.rev = eco.data_docid; |
370 | 410 |
|
411 |
select count(*) |
|
412 |
from doi_registration |
|
413 |
where resourceMapId is null; |
|
414 |
|
|
371 | 415 |
--update the resource map location |
372 | 416 |
update doi_registration |
373 | 417 |
set resourceMapLocation = 'https://cn.dataone.org/cn/v1/resolve/' || resourceMapId |
Also available in: Unified diff
DOI registration:
-include more revision history based on the identifier table not just the generated SM metadata
-include ecogrid data urls for revisions (long query in xml_nodes_revisions table)