Questions tagged [grel]

GREL is the transformation expression language for OpenRefine (formerly Google Refine), a data wrangling application. Originally, GREL stood for "Google Refine Expression Language". Now it is usually expanded as "General Refine Expression Language".

GREL is the transformation expression language for OpenRefine (formerly Google Refine), a data wrangling application. Originally, GREL stood for "Google Refine Expression Language". Now it is usually expanded as "General Refine Expression Language".

69 questions
1
vote
2 answers

What is the Python way to express a GREL line that is creating as many tags as needed in an XML document?

I'm using Open Refine to do something that I KNOW Python can do. I'm using it to convert a csv into an XML metadata document. I can figure out most of it, but the one thing that trips me up, is this GREL line: …
ArchivistG
  • 168
  • 1
  • 13
1
vote
5 answers

How to merge rows in OpenRefine

How to merge rows based on some ID field? Original Table New Table ID | Field1 | Field2 ID | Field1 | Field2 -----|------- |-------- -------|--------|------- A 5 A 5 10 A …
Vanuan
  • 31,770
  • 10
  • 98
  • 102
1
vote
1 answer

OpenRefine: regex returns null with match() but true with contain()

I'm trying to extract dates from a column of string values in OpenRefine. All dates are formatted with either periods or dashes between values. (e.g. "a_string_12-2-15", "3.12.99_another_string") I tried value.contains(/[0-9]+[.-][0-9]+[.-][0-9]+/)…
1
vote
4 answers

Remove outermost parentheses

I am having problem while removing outermost parentheses from a string using GREL. What i am trying to do is simply remove outermost parentheses and all other parentheses should be kept intact. Below is what i am trying to do using regex…
Jon Abraham
  • 851
  • 3
  • 14
  • 27
1
vote
1 answer

regex with match in GREL/OpenRefine

I'm using OpenRefine to parse a column with string values. I want to find the cells that contain either: offer or discount. The string value is usually a sentence My code below is using the match function not working. using value.contains() is…
rabi26
  • 25
  • 1
  • 4
1
vote
1 answer

sum function in GREL in OpenRefine

In OpenRefine, I'm trying to increase the value of every number in a column by 1. The GREL expression sum([value],1) gives me Error: sum expects an array of numbers. I guess I don't know how to produce an array of numbers. When I use a different…
Will Hanley
  • 457
  • 3
  • 16
1
vote
1 answer

OpenRefine: create a shifted copy of a column

I wonder if OpenRefine lets you access data from other rows, when creating a new column. I suspect it does not (and it would be a sane design principle) but there could be a hack around that. Here is an example of what one could want to do: shifting…
pintoch
  • 2,293
  • 1
  • 18
  • 26
1
vote
2 answers

Looking for a way to calculate time lapse in openrefine

This is the given expression of GREL language on OpenRefine. diff(date d1, date d2, optional string timeUnit) For dates, returns the difference in given time units. So the question is how to get the access to the values of both columns, that is not…
Joni Hoppen
  • 658
  • 5
  • 23
1
vote
1 answer

Parsing multiple values with Google Refine

I've a CSV column with content like this (just an example): [{"qual"=>"05-Admmin "name"=>"CLARK C COHO"}, {"qual"=>"20-Soc Con", "name"=>"ALPHA S A"}, {"qual"=>"20-Soc Con", "name"=>"JACK SA"} I would like to extract automatically the values from…
abaporu
  • 320
  • 2
  • 12
0
votes
0 answers

OpenRefine: Extract substring of n sentences before & after a keyword using GREL

I have a column with lengthy strings that I need to extract only a portion of to analyse. I need to extract a substring that contains the 5 sentences before and after occurrences of a keyword, excluding repeated sentences. For example, the original…
py_newie
  • 49
  • 2
0
votes
1 answer

Generating condition-based rdf:type triples using YARRRML mapping

I’m working on an implementation that requires assigning rdf:type based upon a value in the data. Example: ID,Species 1,Rat 2,Eagle ID-1 should be assigned type as "Animal" and ID-2 should be assigned type as "Bird". I’m stuck with the conditional…
0
votes
1 answer

How to keep only digits in a cell in OpenRefine using GREL

For example, the cell contains 5.6 4 5years 6years How can I make it so it will only keep the digits? Expected output: 5.6 4 5 6
Chang
  • 77
  • 6
0
votes
1 answer

OpenRefine capitalize first letter of all entries within a cell on a TSV

How do I capitalize the first letter of the first word of each entry within a cell on a TSV? For example is there a function to make 'Dogs||cats||fish' change to 'Dogs||Cats||Fish' and do the same to all cells on the TSV?
0
votes
1 answer

How to split all multi-valued columns into several columns at once in OpenRefine using GREL

So, I have a complex XML imported into OpenRefine and merged all rows of all records to one using a GREL formula in "All => Transform". Now I have around 50 columns with each containing multiple values in each cell seperated by "|" and I want to…
0
votes
1 answer

replace and multiply a value in GREL or Python

I am trying to do the following operation in either GREL or Python where I replace a string if it contains "$" and replace it with a value * 0.77 , if the string does not contain, then the value remains same. I did the following…
coder_bg
  • 340
  • 6
  • 20