在Openrefine

时间:2018-01-11 05:43:54

标签: json excel openrefine

我一直在努力建立一份关于我大学员工和学生发表的所有论文的excel表。我使用Scopus API来检索所有信息,如作者,标题和发布日期,它完美地运作。

由于检索到的数据是JSON文件,我不得不将其转换为Excel,因此我选择了OpenRefine,当我转换文件时,如果纸张有多个编写器,则会创建多行

例如Like Sample Scopus

我的JSON响应看起来像

{
abstracts-retrieval-response: {
coredata: {
citedby-count: 0,
prism:volume: 430-431,
prism:pageRange: 240-246,
prism:coverDate: 2018-03-01,
dc:title: Solving the 3-COL problem by using tissue P systems without environment and proteins on cells,
prism:aggregationType: Journal,
prism:doi: 10.1016/j.ins.2017.11.022,
prism:publicationName: Information Sciences
},
authors: {
author: [
{
ce:given-name: Daniel,
preferred-name: {
ce:given-name: Daniel,
ce:initials: D.,
ce:surname: Díaz-Pernil,
ce:indexed-name: Díaz-Pernil D.
},
@seq: 1,
ce:initials: D.,
@_fa: true,
affiliation: {
@id: 60033284,
@href: http://api.elsevier.com/content/affiliation/affiliation_id/60033284
},
ce:surname: Díaz-Pernil,
@auid: 16645195100,
author-url: http://api.elsevier.com/content/author/author_id/16645195100,
ce:indexed-name: Diaz-Pernil D.
},
{
ce:given-name: Hepzibah A.,
preferred-name: {
ce:given-name: Hepzibah A.,
ce:initials: H.A.,
ce:surname: Christinal,
ce:indexed-name: Christinal H.
},
@seq: 2,
ce:initials: H.A.,
@_fa: true,
affiliation: {
@id: 60100082,
@href: http://api.elsevier.com/content/affiliation/affiliation_id/60100082
},
ce:surname: Christinal,
@auid: 57197875639,
author-url: http://api.elsevier.com/content/author/author_id/57197875639,
ce:indexed-name: Christinal H.A.
},
{
ce:given-name: Miguel A.,
preferred-name: {
ce:given-name: Miguel A.,
ce:initials: M.A.,
ce:surname: Gutiérrez-Naranjo,
ce:indexed-name: Gutiérrez-Naranjo M.
},
@seq: 3,
ce:initials: M.A.,
@_fa: true,
affiliation: {
@id: 60033284,
@href: http://api.elsevier.com/content/affiliation/affiliation_id/60033284
},
ce:surname: Gutiérrez-Naranjo,
@auid: 6506630834,
author-url: http://api.elsevier.com/content/author/author_id/6506630834,
ce:indexed-name: Gutierrez-Naranjo M.A.
}
]
}
}
}

那么如何根据标题将所有作者合并为一个单元?

1 个答案:

答案 0 :(得分:2)

将JSON导入OpenRefine后,需要将项目组织到Records中。有关'行'之间差异的说明,请参阅http://kb.refinepro.com/2012/03/difference-between-record-and-row.html。和'记录'在OpenRefine中。

要将项目转换为记录,您需要移动一个包含每个记录中只出现一次的信息的列(例如标题列 - 可能标记为" _ - 摘要 - 检索 - 响应 - coredata - dc:title"基于您在此处粘贴的JSON)到项目的开始。有关在OpenRefine中创建记录的详细信息,请参阅http://kb.refinepro.com/2012/06/create-records-in-google-refine.html

完成此操作后,请切换到'记录'查看(点击数据表左上角的'记录'链接)然后按照@ Ettore-Rizza的评论提及 - 选择包含您要使用的名称的列(例如&#34 ; _ - 摘要 - 检索 - 响应 - 作者 - 作者 - _ - ce:索引名称"列)并使用编辑单元格 - >从列顶部的下拉菜单中加入多值单元格选项。

因为在JSON中描述了与文章相关的每个作者,其中包含多个字段(包括各种名称形式和URL),您需要删除包含作者信息的其他列,或者将多个值合并为一个在所有受影响的列上使用“加入多值单元格”选项的字段(除非您需要保留此信息,否则删除不需要的列要容易得多)

完成此操作后,如果记录中没有其他字段重复数据,则每个标题应该有一行。