You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/12/06 16:01:00 UTC

[jira] [Commented] (STREAMS-630) Add Tweets to twitter AS2.0 TTL output

    [ https://issues.apache.org/jira/browse/STREAMS-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16711631#comment-16711631 ] 

ASF GitHub Bot commented on STREAMS-630:
----------------------------------------

steveblackmon closed pull request #469: resolves STREAMS-630
URL: https://github.com/apache/streams/pull/469
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/streams-contrib/streams-provider-twitter/src/main/templates/twitter.ttl.ftl b/streams-contrib/streams-provider-twitter/src/main/templates/twitter.ttl.ftl
index 12acb16aa4..0cdc8f51c2 100644
--- a/streams-contrib/streams-provider-twitter/src/main/templates/twitter.ttl.ftl
+++ b/streams-contrib/streams-provider-twitter/src/main/templates/twitter.ttl.ftl
@@ -1,4 +1,6 @@
 <#ftl output_format="XML" auto_esc=true>
+<#setting output_encoding="UTF-8">
+<#setting url_escaping_charset="UTF-8">
 <#--
   ~ Licensed to the Apache Software Foundation (ASF) under one
   ~ or more contributor license agreements.  See the NOTICE file
@@ -162,3 +164,55 @@
   </#list>
 </#if>
 
+<#assign usernameshash = {} />
+
+<#attempt>
+  <#assign tweets = pp.loadData('json', 'tweet.js')>
+  <#recover>
+</#attempt>
+
+<#if tweets??>
+  <#list tweets as tweet>
+:${id}-note-${tweet.id}
+  a as:Note ;
+  as:actor :${id} ;
+    <#attempt>
+      <#assign createdAt_datetime = tweet.created_at?datetime("EEE MMM dd HH:mm:ss Z yyyy")>
+      <#assign createdAt_datetime_xsnz = createdAt_datetime?string.xs_nz>
+  as:published "${createdAt_datetime_xsnz}"^^xs:dateTime ;
+      <#recover>
+  # TWEET TIMESTAMP PROCESSING FAILED
+        <#if tweet.created_at??>
+  # tweet.created_at: ${tweet.created_at}
+        </#if>
+        <#if createdAt_datetime??>
+  # createdAt_datetime: ${createdAt_datetime}
+        </#if>
+        <#if createdAt_datetime_xsnz??>
+  # createdAt_datetime_xsnz: ${createdAt_datetime_xsnz}
+        </#if>
+    </#attempt>
+  .
+
+    <#if tweet.entities.user_mentions??>
+      <#list tweet.entities.user_mentions as user_mention>
+        <#if ( user_mention.id?? && user_mention.id?number gt 0 )>
+          <#if idshash[user_mention.id]??>
+          <#else>
+:${user_mention.id} a apst:TwitterProfile .
+
+            <#assign idshash += { user_mention.id_str: user_mention.id_str } />
+          </#if>
+          <#if usernameshash[user_mention.id]??>
+          <#else>
+:${user_mention.id} as:name "${user_mention.screen_name}" .
+
+            <#assign usernameshash += { user_mention.id: user_mention.screen_name } />
+          </#if>
+:${id}-note-${tweet.id} as:cc :${user_mention.id} .
+
+        </#if>
+      </#list>
+    </#if>
+  </#list>
+</#if>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Add Tweets to twitter AS2.0 TTL output
> --------------------------------------
>
>                 Key: STREAMS-630
>                 URL: https://issues.apache.org/jira/browse/STREAMS-630
>             Project: Streams
>          Issue Type: Improvement
>            Reporter: Steve Blackmon
>            Assignee: Steve Blackmon
>            Priority: Major
>
> Process the tweet.js file into Note activities.
> set as:to and as:cc for each mentioned account.
> also there are handles and display names of mentioned account which could be added to the file



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)