{"id":1556,"date":"2020-05-04T11:49:21","date_gmt":"2020-05-04T11:49:21","guid":{"rendered":"https:\/\/wetransform.eu\/?post_type=news-and-events&#038;p=1556"},"modified":"2022-07-28T08:15:13","modified_gmt":"2022-07-28T08:15:13","slug":"groovy-week-2020","status":"publish","type":"news-and-events","link":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/","title":{"rendered":"Groovy Week 2020: More Free Scripts for hale\u00bbstudio"},"content":{"rendered":"<p>Two years ago, we published a series of posts around using Groovy scripts to extend the functionality that hale\u00bbstudio offers. These posts have been a favorite among you, so we've decided to do a reload of the original &quot;Groovy Week&quot; this week!<\/p>\n<p>Let's start with the basics: When you try to do something in hale studio that isn\u2019t possible with the out-of-the-box functionality, hale studio offers several ways of creating that functionality yourself. The most accessible of these is to add your own transformation functions using Groovy scripting. There are several points where Groovy functions can be added:<\/p>\n<ul>\n<li>Type Transformation Functions<\/li>\n<li>Property Transformation Functions<\/li>\n<li>Custom Functions<\/li>\n<li>Post-processing scripts (only through the CLI)<\/li>\n<\/ul>\n<p>Groovy is a superset of Java, i.e. any valid Java program is also a valid Groovy program. What it makes much easier than Java is the creation of data structures \u2013 no boilerplate constructors and initialisation and the like. Here are some key resources for learning Groovy:<\/p>\n<ul>\n<li><a href=\"http:\/\/groovy-lang.org\/documentation.html\">Groovy Language Documentation<\/a><\/li>\n<li><a href=\"https:\/\/groovy-playground.appspot.com\/\">Groovy Playground<\/a><\/li>\n<li><a href=\"http:\/\/help.halestudio.org\/latest\/index.jsp?topic=%2Feu.esdihumboldt.cst.doc.functions%2Ffunctions%2Feu.esdihumboldt.cst.functions.groovy.html\">Groovy Scripting in hale studio<\/a><\/li>\n<\/ul>\n<p>The following posts should help you with some common challenges. Please note that this article assumes you have working knowledge of hale studio and know the <a href=\"http:\/\/help.halestudio.org\/latest\/nav\/0_3\">terminology<\/a>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/groovy-logo.png\" alt=\"The Groovy Logo, by Zorak1103, CC BY-SA 3.0, https:\/\/commons.wikimedia.org\/w\/index.php?curid=13358930\" \/><\/p>\n<h2>Monday's Script: Create a persistent ID for your target object (Johanna)<\/h2>\n<p>Sometimes, you can't just use a property of a source object to create a unique, persistent ID on the target side. The source object might not have an unique ID, or you might have to merge several source objects. If you just use <em>Generate sequential ID<\/em> or <em>Generate unique ID<\/em>, the ID will not be persistent across multiple transformation runs.<\/p>\n<p>If a combination of attributes of the source objects can be found that is unique and stable over time, the values of those attributes can be used to generate an unique ID on the target side that is persistent.<\/p>\n<p>To generate an ID from several source attributes, you can use the function <code>_.crypto.sha256<\/code> which is part of the standard Groovy helper functions. The function creates a hash for a string and, as long as the input <code>String<\/code> is stable, the generated hash value will also be stable.<\/p>\n<p>When using the generated hash as an ID, you should always use a prefix (e.g. the feature type name followed by an underscore) as the hash value might start with a number which is not allowed in a <code>gml:id<\/code>.<\/p>\n<p>Here is an example for mapping the <code>gml:id<\/code> attribute of a <code>Road<\/code> object of in the INSPIRE Transport Network Roads schema:<\/p>\n<p><script src=\"https:\/\/gist.github.com\/JBoudewijn\/add5105404c6dd58b6d8a392e7150aa9.js\"><\/script><\/p>\n<p>You can download this script <a href=\"https:\/\/github.com\/wetransform-os\/website-examples\/blob\/af7108ee8f5a838327c3e4b871850212c399e37c\/news\/resources\/persistentID.groovy\">here<\/a> and import it in hale studio as a Groovy snippet by going to File -&gt; Import -&gt; Groovy Snippet. Please note that some scripts use protected functions, so you might need to &quot;Lift Groovy Restrictions&quot; to execute the script. Make sure you replace the placeholder attribute names with your own attribute names.<\/p>\n<p>Happy transforming!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Two years ago, we published a series of posts around using Groovy scripts to extend the functionality that hale\u00bbstudio offers. These posts have been a favorite among you, so we&#8217;ve decided to do a reload of the original &quot;Groovy Week&quot; this week! Let&#8217;s start with the basics: When you try to do something in hale [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[48],"tags":[47,21,46],"class_list":["post-1556","news-and-events","type-news-and-events","status-publish","hentry","category-tutorials","tag-groovy","tag-halestudio","tag-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.1 (Yoast SEO v28.1) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Groovy Week 2020: More Free Scripts for hale\u00bbstudio - wetransform<\/title>\n<meta name=\"description\" content=\"It&#039;s 2020 and time for more Groovy scripts in our new Groovy week! Learn how to customise your data transformations!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Groovy Week 2020: More Free Scripts for hale\u00bbstudio\" \/>\n<meta property=\"og:description\" content=\"It&#039;s 2020 and time for more Groovy scripts in our new Groovy week! Learn how to customise your data transformations!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/\" \/>\n<meta property=\"og:site_name\" content=\"wetransform\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-28T08:15:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/groovy-logo.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wetransformto\" \/>\n<meta name=\"twitter:label1\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data1\" content=\"3\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/news-and-events\\\/groovy-week-2020\\\/\",\"url\":\"https:\\\/\\\/wetransform.to\\\/de\\\/news-and-events\\\/groovy-week-2020\\\/\",\"name\":\"Groovy Week 2020: More Free Scripts for hale\u00bbstudio - wetransform\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/news-and-events\\\/groovy-week-2020\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/news-and-events\\\/groovy-week-2020\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wetransform.eu\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/groovy-logo.png\",\"datePublished\":\"2020-05-04T11:49:21+00:00\",\"dateModified\":\"2022-07-28T08:15:13+00:00\",\"description\":\"It's 2020 and time for more Groovy scripts in our new Groovy week! Learn how to customise your data transformations!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/news-and-events\\\/groovy-week-2020\\\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wetransform.to\\\/de\\\/news-and-events\\\/groovy-week-2020\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/news-and-events\\\/groovy-week-2020\\\/#primaryimage\",\"url\":\"https:\\\/\\\/wetransform.eu\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/groovy-logo.png\",\"contentUrl\":\"https:\\\/\\\/wetransform.eu\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/groovy-logo.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wetransform.to\\\/de\\\/news-and-events\\\/groovy-week-2020\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/wetransform.to\\\/de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"News & Events\",\"item\":\"https:\\\/\\\/wetransform.to\\\/de\\\/news-and-events\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Groovy Week 2020: More Free Scripts for hale\u00bbstudio\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#website\",\"url\":\"http:\\\/\\\/wetransform.to\\\/de\\\/\",\"name\":\"wetransform\",\"description\":\"Making environmental data useful and accessible\",\"publisher\":{\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/wetransform.to\\\/de\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#organization\",\"name\":\"wetransform\",\"url\":\"http:\\\/\\\/wetransform.to\\\/de\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/wetransform.to\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/large-logo-whitebg.png\",\"contentUrl\":\"https:\\\/\\\/wetransform.to\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/large-logo-whitebg.png\",\"width\":1024,\"height\":1024,\"caption\":\"wetransform\"},\"image\":{\"@id\":\"http:\\\/\\\/wetransform.to\\\/de\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/wetransformto\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wetransform-gmbh\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Groovy Week 2020: More Free Scripts for hale\u00bbstudio - wetransform","description":"It's 2020 and time for more Groovy scripts in our new Groovy week! Learn how to customise your data transformations!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/","og_locale":"de_DE","og_type":"article","og_title":"Groovy Week 2020: More Free Scripts for hale\u00bbstudio","og_description":"It's 2020 and time for more Groovy scripts in our new Groovy week! Learn how to customise your data transformations!","og_url":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/","og_site_name":"wetransform","article_modified_time":"2022-07-28T08:15:13+00:00","og_image":[{"url":"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/groovy-logo.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_site":"@wetransformto","twitter_misc":{"Gesch\u00e4tzte Lesezeit":"3\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/","url":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/","name":"Groovy Week 2020: More Free Scripts for hale\u00bbstudio - wetransform","isPartOf":{"@id":"http:\/\/wetransform.to\/de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/#primaryimage"},"image":{"@id":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/#primaryimage"},"thumbnailUrl":"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/groovy-logo.png","datePublished":"2020-05-04T11:49:21+00:00","dateModified":"2022-07-28T08:15:13+00:00","description":"It's 2020 and time for more Groovy scripts in our new Groovy week! Learn how to customise your data transformations!","breadcrumb":{"@id":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/#primaryimage","url":"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/groovy-logo.png","contentUrl":"https:\/\/wetransform.eu\/wp-content\/uploads\/2022\/05\/groovy-logo.png"},{"@type":"BreadcrumbList","@id":"https:\/\/wetransform.to\/de\/news-and-events\/groovy-week-2020\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wetransform.to\/de\/"},{"@type":"ListItem","position":2,"name":"News & Events","item":"https:\/\/wetransform.to\/de\/news-and-events\/"},{"@type":"ListItem","position":3,"name":"Groovy Week 2020: More Free Scripts for hale\u00bbstudio"}]},{"@type":"WebSite","@id":"http:\/\/wetransform.to\/de\/#website","url":"http:\/\/wetransform.to\/de\/","name":"wetransform","description":"Making environmental data useful and accessible","publisher":{"@id":"http:\/\/wetransform.to\/de\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/wetransform.to\/de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"http:\/\/wetransform.to\/de\/#organization","name":"wetransform","url":"http:\/\/wetransform.to\/de\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"http:\/\/wetransform.to\/de\/#\/schema\/logo\/image\/","url":"https:\/\/wetransform.to\/wp-content\/uploads\/2022\/07\/large-logo-whitebg.png","contentUrl":"https:\/\/wetransform.to\/wp-content\/uploads\/2022\/07\/large-logo-whitebg.png","width":1024,"height":1024,"caption":"wetransform"},"image":{"@id":"http:\/\/wetransform.to\/de\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/wetransformto","https:\/\/www.linkedin.com\/company\/wetransform-gmbh\/"]}]}},"_links":{"self":[{"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events\/1556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events"}],"about":[{"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/types\/news-and-events"}],"author":[{"embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/comments?post=1556"}],"version-history":[{"count":3,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events\/1556\/revisions"}],"predecessor-version":[{"id":3759,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/news-and-events\/1556\/revisions\/3759"}],"wp:attachment":[{"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/media?parent=1556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/categories?post=1556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wetransform.to\/de\/wp-json\/wp\/v2\/tags?post=1556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}