Last active
August 29, 2015 14:15
-
-
Save ocorcho/ce3954b766a0c1651c7b to your computer and use it in GitHub Desktop.
Open Refine code for creating links from Zaragoza street names to datos.bne.es
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"op": "core/column-removal", | |
"description": "Remove column tipo", | |
"columnName": "tipo" | |
}, | |
{ | |
"op": "core/column-removal", | |
"description": "Remove column lastUpdated", | |
"columnName": "lastUpdated" | |
}, | |
{ | |
"op": "core/column-removal", | |
"description": "Remove column pubDate", | |
"columnName": "pubDate" | |
}, | |
{ | |
"op": "core/column-addition-by-fetching-urls", | |
"description": "Create column Autores_BNE at index 3 by fetching URLs based on column title_ext using expression grel:\"http://datos.bne.es/find/resultados/?s=\"+value.trim().escape(\"url\")+\"&type=Autor&format=json\"", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"newColumnName": "Autores_BNE", | |
"columnInsertIndex": 3, | |
"baseColumnName": "title_ext", | |
"urlExpression": "grel:\"http://datos.bne.es/find/resultados/?s=\"+value.trim().escape(\"url\")+\"&type=Autor&format=json\"", | |
"onError": "set-to-blank", | |
"delay": 0 | |
}, | |
{ | |
"op": "core/column-addition-by-fetching-urls", | |
"description": "Create column Obras_BNE at index 3 by fetching URLs based on column title_ext using expression grel:\"http://datos.bne.es/find/resultados/?s=\"+value.trim().escape(\"url\")+\"&type=Obra&format=json\"", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"newColumnName": "Obras_BNE", | |
"columnInsertIndex": 3, | |
"baseColumnName": "title_ext", | |
"urlExpression": "grel:\"http://datos.bne.es/find/resultados/?s=\"+value.trim().escape(\"url\")+\"&type=Obra&format=json\"", | |
"onError": "set-to-blank", | |
"delay": 0 | |
}, | |
{ | |
"op": "core/column-addition-by-fetching-urls", | |
"description": "Create column Temas_BNE at index 3 by fetching URLs based on column title_ext using expression grel:\"http://datos.bne.es/find/resultados/?s=\"+value.trim().escape(\"url\")+\"&type=Tema&format=json\"", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"newColumnName": "Temas_BNE", | |
"columnInsertIndex": 3, | |
"baseColumnName": "title_ext", | |
"urlExpression": "grel:\"http://datos.bne.es/find/resultados/?s=\"+value.trim().escape(\"url\")+\"&type=Tema&format=json\"", | |
"onError": "set-to-blank", | |
"delay": 0 | |
}, | |
{ | |
"op": "core/column-addition", | |
"description": "Create column Autores_BNE_Summary at index 6 based on column Autores_BNE using expression grel:forEach(value.parseJson().hits.hits,h,h._score.toNumber().round()+\" \"+h._source.id+\" \"+h._source.label).join(\";;;;\")", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"newColumnName": "Autores_BNE_Summary", | |
"columnInsertIndex": 6, | |
"baseColumnName": "Autores_BNE", | |
"expression": "grel:forEach(value.parseJson().hits.hits,h,h._score.toNumber().round()+\" \"+h._source.id+\" \"+h._source.label).join(\";;;;\")", | |
"onError": "set-to-blank" | |
}, | |
{ | |
"op": "core/column-addition", | |
"description": "Create column Obras_BNE_Summary at index 5 based on column Obras_BNE using expression grel:forEach(value.parseJson().hits.hits,h,h._score.toNumber().round()+\" \"+h._source.id+\" \"+h._source.label).join(\";;;;\")", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"newColumnName": "Obras_BNE_Summary", | |
"columnInsertIndex": 5, | |
"baseColumnName": "Obras_BNE", | |
"expression": "grel:forEach(value.parseJson().hits.hits,h,h._score.toNumber().round()+\" \"+h._source.id+\" \"+h._source.label).join(\";;;;\")", | |
"onError": "set-to-blank" | |
}, | |
{ | |
"op": "core/column-addition", | |
"description": "Create column Temas_BNE_Summary at index 4 based on column Temas_BNE using expression grel:forEach(value.parseJson().hits.hits,h,h._score.toNumber().round()+\" \"+h._source.id+\" \"+h._source.label).join(\";;;;\")", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"newColumnName": "Temas_BNE_Summary", | |
"columnInsertIndex": 4, | |
"baseColumnName": "Temas_BNE", | |
"expression": "grel:forEach(value.parseJson().hits.hits,h,h._score.toNumber().round()+\" \"+h._source.id+\" \"+h._source.label).join(\";;;;\")", | |
"onError": "set-to-blank" | |
}, | |
{ | |
"op": "core/column-removal", | |
"description": "Remove column Obras_BNE", | |
"columnName": "Obras_BNE" | |
}, | |
{ | |
"op": "core/column-removal", | |
"description": "Remove column Autores_BNE", | |
"columnName": "Autores_BNE" | |
}, | |
{ | |
"op": "core/column-removal", | |
"description": "Remove column Temas_BNE", | |
"columnName": "Temas_BNE" | |
}, | |
{ | |
"op": "core/multivalued-cell-split", | |
"description": "Split multi-valued cells in column Temas_BNE_Summary", | |
"columnName": "Temas_BNE_Summary", | |
"keyColumnName": "id", | |
"separator": ";;;;", | |
"mode": "plain" | |
}, | |
{ | |
"op": "core/multivalued-cell-split", | |
"description": "Split multi-valued cells in column Obras_BNE_Summary", | |
"columnName": "Obras_BNE_Summary", | |
"keyColumnName": "id", | |
"separator": ";;;;", | |
"mode": "plain" | |
}, | |
{ | |
"op": "core/multivalued-cell-split", | |
"description": "Split multi-valued cells in column Autores_BNE_Summary", | |
"columnName": "Autores_BNE_Summary", | |
"keyColumnName": "id", | |
"separator": ";;;;", | |
"mode": "plain" | |
}, | |
{ | |
"op": "core/transpose-columns-into-rows", | |
"description": "Transpose cells in columns starting with Temas_BNE_Summary into rows in two new columns named tipo and valor", | |
"startColumnName": "Temas_BNE_Summary", | |
"columnCount": -1, | |
"ignoreBlankCells": true, | |
"fillDown": true, | |
"keyColumnName": "tipo", | |
"valueColumnName": "valor" | |
}, | |
{ | |
"op": "core/fill-down", | |
"description": "Fill down cells in column id", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"columnName": "id" | |
}, | |
{ | |
"op": "core/fill-down", | |
"description": "Fill down cells in column title", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"columnName": "title" | |
}, | |
{ | |
"op": "core/fill-down", | |
"description": "Fill down cells in column title_ext", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"columnName": "title_ext" | |
}, | |
{ | |
"op": "core/mass-edit", | |
"description": "Mass edit cells in column tipo", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"columnName": "tipo", | |
"expression": "value", | |
"edits": [ | |
{ | |
"fromBlank": false, | |
"fromError": false, | |
"from": [ | |
"Temas_BNE_Summary" | |
], | |
"to": "Tema" | |
} | |
] | |
}, | |
{ | |
"op": "core/mass-edit", | |
"description": "Mass edit cells in column tipo", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"columnName": "tipo", | |
"expression": "value", | |
"edits": [ | |
{ | |
"fromBlank": false, | |
"fromError": false, | |
"from": [ | |
"Obras_BNE_Summary" | |
], | |
"to": "Obra" | |
} | |
] | |
}, | |
{ | |
"op": "core/mass-edit", | |
"description": "Mass edit cells in column tipo", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"columnName": "tipo", | |
"expression": "value", | |
"edits": [ | |
{ | |
"fromBlank": false, | |
"fromError": false, | |
"from": [ | |
"Autores_BNE_Summary" | |
], | |
"to": "Autor" | |
} | |
] | |
}, | |
{ | |
"op": "core/column-split", | |
"description": "Split column valor by separator", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"columnName": "valor", | |
"guessCellType": true, | |
"removeOriginalColumn": true, | |
"mode": "separator", | |
"separator": " ", | |
"regex": false, | |
"maxColumns": 3 | |
}, | |
{ | |
"op": "core/column-rename", | |
"description": "Rename column valor 1 to score", | |
"oldColumnName": "valor 1", | |
"newColumnName": "score" | |
}, | |
{ | |
"op": "core/column-rename", | |
"description": "Rename column valor 2 to idBNE", | |
"oldColumnName": "valor 2", | |
"newColumnName": "idBNE" | |
}, | |
{ | |
"op": "core/column-rename", | |
"description": "Rename column valor 3 to labelBNE", | |
"oldColumnName": "valor 3", | |
"newColumnName": "labelBNE" | |
}, | |
{ | |
"op": "core/column-addition", | |
"description": "Create column URI_BNE at index 6 based on column idBNE using expression grel:\"http://datos.bne.es/\"+cells[\"tipo\"].value.toLowercase()+\"/\"+value", | |
"engineConfig": { | |
"facets": [], | |
"mode": "row-based" | |
}, | |
"newColumnName": "URI_BNE", | |
"columnInsertIndex": 6, | |
"baseColumnName": "idBNE", | |
"expression": "grel:\"http://datos.bne.es/\"+cells[\"tipo\"].value.toLowercase()+\"/\"+value", | |
"onError": "set-to-blank" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment