Save or export GREL history (or GREL/regex favourites)

Hi , In addition to this the question, I was wondering how to export (my favourites) in the GREL History , which is saved in the 'Add column based on this column'-window (the starred expressions at least)? While I had/have to work on different devices, I would like to save these useful expressions too. While I was able to transport all my projects by copying all the local stored files, including al the ' usual' history of each project, which is stored in the Undo/Redo) I encountered that the GREL history in the 'Add column based on this column'-window was not saved/included :frowning: .
Thanks in advance!
best regards, Annika

1 Like

I don't think this is currently possible. Also, there is no single account to put favourite GREL's from projects on different machines in. So if it were possible to export your GREL history, you'd still have to rummage through all your exports in search of the expression you need.

As a workaround, you could put your favourite GREL expressions in a separate file that you can access from anywhere. This is what I do with programming and scripting languages that I use frequently, but not often enough to ever get to any level of proficiency.

I have files for about 8 languages. SQL, SPARQL, Regex, Powershell, GREL, ...

And yes, it does require some additional maintenance.

I was wondering how to export (my favourites) in the GREL History , which is saved in the 'Add column based on this column'-window (the starred expressions at least)? While I had/have to work on different devices, I would like to save these useful expressions too. While I was able to transport all my projects by copying all the local stored files, including al the ' usual' history of each project, which is stored in the Undo/Redo)

There were a couple of bugs fixed in v3.8 which had to do with the saving of expression histories - https://github.com/OpenRefine/OpenRefine/issues/6362#issuecomment-1943057418

Starred expressions are saved as a user preference value, so should be transferred if you move your entire OpenRefine workspace to a different machine. Starting with OpenRefine 3.8, expression histories should also be saved with the project metadata again, so will get transferred with exported/imported projects.

I encountered that the GREL history in the 'Add column based on this column'-window was not saved/included :frowning:.

The expressions used for "Add column" shouldn't be treated any differently than expressions used in any other context and should get added to the History and Starred lists. This appears to be how things work on my system, but perhaps I'm missing some nuance of your test case.

Tom

Thank you Tom,

I am working with 3.7.6 now, so I should upgrade I guess :wink:

Thanks for your information :slight_smile:

Indeed, "The expressions used for "Add column" shouldn't be treated any differently than expressions used in any other context and should get added to the History and Starred lists" :it is no other but didn't know how to name this.

Additional question in reaction to "Starred expressions are saved as a user preference value"
Where are these saved ?

and is het possible to join saved expressions from several installs in one file for a future (3rd) install on another device? (and if so, how?)
Thanks again :slight_smile:

User preferences are stored in your workspace (workspace.json in the OpenRefine data directory). The global expression history and starred expressions are both there and it would theoretically be possible to graft together lists from multiple files if you knew what you were doing and were careful with your editing, but it sounds like a good feature to request to be able to export and import your starred expressions. This feature was first requested in 2014. See issues #912 and #1232. You can add any additional detail about your specific use case to the latter, if it's not already covered.

If you do want to explore merging expression lists on your own, the structure is below with the relevant bits bolded, BUT if you mess up your workspace, you risk losing all your projects, so make sure you have a backup and proceed very carefully.

{
"projectIDs": [
...
],
"preferences": {
"entries": {
"reconciliation.standardServices": [
...
],
"ui.browsing.listFacet.limit": "2",
"scripting.starred-expressions": {
"top": 2147483647,
"list": [
"grel:value.split('|')[-1]",
...
],
"class": "com.google.refine.preference.TopList"
},

"scripting.expressions": {

"top": 100,
"list": [
"grel:value",

...

1 Like