{"path":"/sutl/examples/tweettransform","content":{"title":"Transforming a historical tweet","summary":"A worked sUTL example with source data, transform, expected output and runnable-original links.","body":"[sUTL](/sutl) · [Guide](/sutl/guide) · [Reference](/sutl/reference) · [Examples](/sutl/examples)\n\nThis worked example preserves its recovered source, transform and expected result. It is a static, inspectable example in Everything.\n\n## Source\n\n```json\n{\n  \"coordinates\": null,\n  \"created_at\": \"Thu Oct 21 16:02:46 +0000 2010\",\n  \"favorited\": false,\n  \"truncated\": false,\n  \"id_str\": \"28039652140\",\n  \"entities\": {\n    \"urls\": [\n      {\n        \"expanded_url\": null,\n        \"url\": \"http://gnip.com/success_stories\",\n        \"indices\": [\n          69,\n          100\n        ]\n      }\n    ],\n    \"hashtags\": [],\n    \"user_mentions\": [\n      {\n        \"name\": \"Gnip, Inc.\",\n        \"id_str\": \"16958875\",\n        \"id\": 16958875,\n        \"indices\": [\n          25,\n          30\n        ],\n        \"screen_name\": \"gnip\"\n      }\n    ]\n  },\n  \"in_reply_to_user_id_str\": null,\n  \"text\": \"what we've been up to at @gnip -- delivering data to happy customers http://gnip.com/success_stories\",\n  \"contributors\": null,\n  \"id\": 28039652140,\n  \"retweet_count\": null,\n  \"in_reply_to_status_id_str\": null,\n  \"geo\": null,\n  \"retweeted\": false,\n  \"in_reply_to_user_id\": null,\n  \"user\": {\n    \"profile_sidebar_border_color\": \"C0DEED\",\n    \"name\": \"Gnip, Inc.\",\n    \"profile_sidebar_fill_color\": \"DDEEF6\",\n    \"profile_background_tile\": false,\n    \"profile_image_url\": \"http://a3.twimg.com/profile_images/62803643/icon_normal.png\",\n    \"location\": \"Boulder, CO\",\n    \"created_at\": \"Fri Oct 24 23:22:09 +0000 2008\",\n    \"id_str\": \"16958875\",\n    \"follow_request_sent\": false,\n    \"profile_link_color\": \"0084B4\",\n    \"favourites_count\": 1,\n    \"url\": \"http://blog.gnip.com\",\n    \"contributors_enabled\": false,\n    \"utc_offset\": -25200,\n    \"id\": 16958875,\n    \"profile_use_background_image\": true,\n    \"listed_count\": 23,\n    \"protected\": false,\n    \"lang\": \"en\",\n    \"profile_text_color\": \"333333\",\n    \"followers_count\": 260,\n    \"time_zone\": \"Mountain Time (US & Canada)\",\n    \"verified\": false,\n    \"geo_enabled\": true,\n    \"profile_background_color\": \"C0DEED\",\n    \"notifications\": false,\n    \"description\": \"Gnip makes it really easy for you to collect social data for your business.\",\n    \"friends_count\": 71,\n    \"profile_background_image_url\": \"http://s.twimg.com/a/1287010001/images/themes/theme1/bg.png\",\n    \"statuses_count\": 302,\n    \"screen_name\": \"gnip\",\n    \"following\": false,\n    \"show_all_inline_media\": false\n  },\n  \"in_reply_to_screen_name\": null,\n  \"source\": \"web\",\n  \"place\": null,\n  \"in_reply_to_status_id\": null\n}\n```\n\n## Transform\n\n```json\n{\n  \"name\": \"^@.user.screen_name\",\n  \"text\": \"^@.text\",\n  \"urls\": {\n    \"&\": \"removenulls\",\n    \"list\": [\n      \"&&\",\n      \"&@.**.url\",\n      \"&@.**.profile_image_url\",\n      \"&@.**.profile_image_url\",\n      \"&@.**.expanded_url\"\n    ]\n  }\n}\n```\n\n## Expected result\n\n```json\n{\n  \"name\": \"gnip\",\n  \"text\": \"what we've been up to at @gnip -- delivering data to happy customers http://gnip.com/success_stories\",\n  \"urls\": [\n    \"http://blog.gnip.com\",\n    \"http://gnip.com/success_stories\",\n    \"http://a3.twimg.com/profile_images/62803643/icon_normal.png\",\n    \"http://a3.twimg.com/profile_images/62803643/icon_normal.png\",\n    null\n  ]\n}\n```\n\n## Run it\n\nUse the [language site example](https://sutl-bronzearch.house-of-ur.com/examples/tweettransform-sutllang-emlynoregan-com--97a10b5a-84ef-62e2-363c-2237298f5b19/) or copy it into the [playground](https://sutl-bronzearch.house-of-ur.com/playground/). If the transform calls `map_core` or another library name, load the [core distribution](/sutl/core-library) and compile its requirements; the full fixture retains that library context.\n\n[Full original fixture](https://github.com/emlynoregan/sutl-language/blob/0c3463677495ea00767f8266ae900eb4e2f98617/fixtures/studio/97a10b5a-84ef-62e2-363c-2237298f5b19.json) · [Curated source record](https://github.com/emlynoregan/sutllang-site/blob/e59ecafd364848cd71a1d18ce74cdf67f2f69328/content/examples/curated/tweettransform-sutllang-emlynoregan-com--97a10b5a-84ef-62e2-363c-2237298f5b19.json)\n\n## Related reading\n\n[Paths](/sutl/guide/paths) · [Quoting and evaluation](/sutl/guide/quoting-and-evaluation) · [Libraries](/sutl/guide/declarations-and-libraries)\n\n## Source\n\nAdapted from [the sUTL source material](https://github.com/emlynoregan/sutllang-site/blob/e59ecafd364848cd71a1d18ce74cdf67f2f69328/content/examples/curated/tweettransform-sutllang-emlynoregan-com--97a10b5a-84ef-62e2-363c-2237298f5b19.json).\n\n[Back to sUTL](/sutl) · [Software & Agents](/topics/software-and-agents) · [All topics](/guide)","author":"Emlyn O'Regan"}}