【发布时间】:2019-05-31 16:18:39
【问题描述】:
我从我的 postgresql 数据库上传了一个 openrefine 数据集。在我的表中,我有一个主键“id”。
然后,我在打开的精炼中清理我导入的表,做以下两件事:
1) 聚类并合并包含地址位(“address_line_1”、“address_line_2”、“address_country”等)的几列,以便我可以将"london" "lodon" "londres" 等条目合并到london 等...
2) 基于address_line_1 添加一列address_full,然后将其他列与以下GREL 连接:
if(isBlank(cells["address_line_1_normalised"].value), " ",
cells["address_line_1_normalised"].value)
+ ' '
+ if(isBlank(cells["address_line_2_normalised"].value), " ",
cells["address_line_2_normalised"].value)
+ ' '
+ if(isBlank(cells["address_town_normalised"].value), " ",
cells["address_town_normalised"].value)
+ ' '
+ if(isBlank(cells["address_county_normalised"].value), " ",
cells["address_county_normalised"].value)
+ ' '
+ if (isBlank(cells["address_postcode"].value), " ",
cells["address_postcode"].value)
+ ' '
+ if(isBlank(cells["address_country_normalised"].value), " ",
cells["address_country_normalised"].value)
3) 对full_address 进行聚类和合并,使地址标准化。
在这里我会很高兴,并想在 postgres 中再次上传,但是在提取的那一刻,我意识到 某些 id 编号是相同的,这应该是不可能的,经过仔细查询我认为有些行已被其他行压碎。
--详情--
1) 我确定我在 pg 表中有唯一的 ID。
2)从pg获取数据到openrefine的查询是:
select * from schema_name.table_name;
3)我在open优化中编辑后的csv输出将以这样的id系列开头。
1
2
3
...
-> from row 265 it would go like this
265 (same record 265)
265 (same record 265)
266 (same record 266)
266 (same record 266)
266 (same record 266)
267 (same record 267)
267 (same record 267)
267 (same record 267)
...
-> up until row number 2456 (whose id is 1245) and from here starts again the unique increment of the id column:
1245
1246
....
-> up until 4000 something - where it has a jump of several thousands.
6234
我想 openrefine 只是覆盖了所有丢失的记录,并将重复行的所有 id 与列表中第一个的 id 相结合。
有谁知道 openrefine 的工作原理知道如何反转这个?
【问题讨论】:
-
您能否显示您的表的架构以及您用于在 OpenRefine 中检索数据的查询?
标签: export uniqueidentifier openrefine grel