You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2018/10/23 15:20:00 UTC

[streams] 01/01: resolves STREAMS-618

This is an automated email from the ASF dual-hosted git repository.

sblackmon pushed a commit to branch STREAMS-618
in repository https://gitbox.apache.org/repos/asf/streams.git

commit d69994720b806d3b74855a37b4615c83efeb8228
Author: Steve Blackmon <sb...@apache.org>
AuthorDate: Tue Oct 23 10:19:49 2018 -0500

    resolves STREAMS-618
---
 .../src/main/templates/facebook.ttl.ftl            | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/streams-contrib/streams-provider-facebook/src/main/templates/facebook.ttl.ftl b/streams-contrib/streams-provider-facebook/src/main/templates/facebook.ttl.ftl
index eda16bb..8957c89 100644
--- a/streams-contrib/streams-provider-facebook/src/main/templates/facebook.ttl.ftl
+++ b/streams-contrib/streams-provider-facebook/src/main/templates/facebook.ttl.ftl
@@ -155,3 +155,43 @@
 
 </#list>
 </#if>
+
+<#assign messagesDirs = pp.loadData('eval', '
+  debug();
+  String[] dirs = new java.io.File(engine.getDataRoot(), "messages").list();
+  return dirs;
+')>
+
+<#if messagesDirs??>
+  <#if (messagesDirs?size > 0)>
+    <#list messagesDirs as messageDir>
+      <#attempt>
+        <#assign messages = pp.loadData('json', 'messages/${messageDir}/message.json')>
+        <#if (messages.participants?? && messages.participants?size == 1 && messages.title??)>
+          <#assign fidraw = "${messages.title}">
+          <#assign fid=fidraw?replace("\\W","","r")>
+          <#list messages.messages as message>
+            <#list friends.friends as friend>
+              <#if friend.name == message.sender_name>
+:${fid}-message-${id}-${message.timestamp}
+a as:Note ;
+as:actor :${fid} ;
+as:object :${id} ;
+as:published "${message.timestamp}" .
+
+              <#elseif fullname == message.sender_name>
+:${id}-message-${fid}-${message.timestamp}
+a as:Note ;
+as:actor :${id} ;
+as:object :${fid} ;
+as:published "${message.timestamp}" .
+
+              </#if>
+            </#list>
+          </#list>
+        </#if>
+      <#recover>
+      </#attempt>
+    </#list>
+  </#if>
+</#if>