我一直在使用Python中的Sickle库,以便访问开放获取期刊目录中的OAI-PMH记录。我注意到,下面的代码将产生与sickle.ListRecords()每次运行时访问的前4000篇文章相似但略有不同的英文文章数量(每次大约2500-2600篇)。在我之前用来检索和下载文章全文的另一段代码中,我注意到每次文章都会发生变化。这似乎不是Sickle每次都以相同的顺序抓取OAI记录,这让我怀疑它们是以随机(Ish)顺序抓取的吗?我是OAI格式的新手,所以我不确定这种(看似)随机排序是OAI记录一般存储方式的一种属性,还是DOAJ存储它们的方式的一种属性,还是Sickle库在将其放入OAIIterator对象之前获取OAI记录的方式的一种属性。
from sickle import Sickle
import time
from langdetect import detect
def get_time_estimate():
sickle = Sickle('https://doaj.org/oai.article')
records = sickle.ListRecords(metadataPrefix='oai_doaj')
tot = 0
num_eng = 0
start_time = time.time()
for rec in records:
tot += 1
metadata = rec.metadata
if 'abstract' not in metadata:
continue
if 'fullTextUrl' not in metadata:
continue
abs = metadata['abstract'][0]
full = metadata['fullTextUrl'][0]
language = detect(abs)
if language == 'en':
num_eng += 1
if tot == 4000:
break
print("Completed in %.2f seconds" % (time.time() - start_time))
print("Number of English records: %s" % num_eng)发布于 2020-04-14 01:45:19
我刚接触OAI格式,所以我不确定这种(看似)随机排序是否是OAI记录一般存储方式的一种属性,
是的,引用OAI-PMH规范:
协议没有定义不完备性的语义。因此,收割机不应该假设不完整列表中的成员符合某些选择标准(例如,日期排序)。
http://www.openarchives.org/OAI/openarchivesprotocol.html#FlowControl
您可以通过datestamp或sets使用选择性收获:http://www.openarchives.org/OAI/openarchivesprotocol.html#SelectiveHarvesting
https://stackoverflow.com/questions/56956954
复制相似问题