otm:the_matching_of_causal_sequences:example1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
otm:the_matching_of_causal_sequences:example1 [2011/02/07 11:04]
aspectscript
otm:the_matching_of_causal_sequences:example1 [2012/02/06 19:22] (current)
aspectscript
Line 1: Line 1:
-A kind of W2As are social networks applications like [[http://twitter.com|Twitter]] and [[http://www.facebook.com|Facebook]]. Nowadays, these applications are widely used, thereby, the analysis the flow of information is an interesting research topic. This flow of information is analyzed trough messages sent and retrieved between users of these applications. This analysis is complex because it is necessary to reason about the distributed computations of a social networks application. Next, we present the analysis of popularity +====== Analyzing Tweet Popularity ======
-of a //tweet// (a publication of a small post) in Twitter.+
  
-{{ :otm:the_matching_of_causal_sequences:twitter.png?390x300 | Tweets & Retweets}} +The following example shows two independent Web applications that constitute social network applicationuser can publish a tweet and this tweet can be retweeted by the other user because both users follow each otherA OTM distributed stateful aspect observes and counts each retweet of a user. 
- +
-The analysis of popularity of user tweets is novel topic in TwitterThis analysis allows a user to know the popularity of every tweet published by him, which is measured by the number of //retweets// (republications of a tweet) that its followers do of his tweet. For example, the figure shows above four Tweeter users: Toti, Peter, Kuky, and Paul. Toti follows Peter and Peter follows Paul; Kuky follows nobody and vice versa. On the one hand, the figure also shows that Paul publishes a tweet and Peter receives this tweet and retweets it. On the other hand, the figure also shows that Kuky publishes a tweet and nobody receives itBased on the popularity measurement, the popularity of the Paul’s tweet is one and the Kuky’s tweet is zero. Although Kuky and Paul would have published the same tweet (the same string), the popularity of Kuky is zero because the Kuky’s tweet does not cause any retweet. Commonly, this kind of analysis is carried out through [[http://en.wikipedia.org/wiki/Graph_dynamical_system|dynamic graphs]]. Sadly, this analysis is not at real-time and is complex when social networks contains big amount of users. An alternative way is the use of the [[http://en.wikipedia.org/wiki/Vector_clocks|vector clock]] algorithm. We use **[[weca|WeCa]]** to analyze the popularity of every tweets of every user when the //midnight// event happens+
  
 <html> <html>
Line 12: Line 9:
    <link href="/aspectscript/external/otm/paperExample-SPE/style.css" rel="stylesheet" type="text/css"/>    <link href="/aspectscript/external/otm/paperExample-SPE/style.css" rel="stylesheet" type="text/css"/>
      <script type="text/javascript" language="javascript" src="/aspectscript/external/otm/paperExample-SPE/lib.js"> </script>      <script type="text/javascript" language="javascript" src="/aspectscript/external/otm/paperExample-SPE/lib.js"> </script>
-   <iframe id="example" src="/aspectscript/external/otm/paperExample-SPE/causal/counterNew" width="850" height="480"></iframe>    +   <iframe id="example" src="/aspectscript/external/otm/paperExample-SPE/causal/counterNew" width="850" height="490"></iframe>    
     <iframe id="code" style="display:none" src="/aspectscript/external/otm/paperExample-SPE/causal/counterNew/analysisNews.js" width="850" height="580"></iframe>     <iframe id="code" style="display:none" src="/aspectscript/external/otm/paperExample-SPE/causal/counterNew/analysisNews.js" width="850" height="580"></iframe>
    <a id="button" class="button" onclick="toggle('code','example')"> <span>Toggle between the code and example </span></a>    <a id="button" class="button" onclick="toggle('code','example')"> <span>Toggle between the code and example </span></a>
Line 20: Line 17:
  
 <code javascript> <code javascript>
-var countRetweet = causalSeq(callTweet, repeatUntil(callRetweet, event("midnight")))+var countRetweet = causalSeq(callTweet, repeatUntil(eventRetweet, event("midnight")))
 </code>  </code> 
  
-This sequence matches and counts all republications of a post until the **midnight** event happens. The retweets that are considered must be //caused// by a tweet received. This sequence begins the matching process when the **callTweet** pointcut matches:+This sequence matches and counts all retweets of a tweet until the **midnight** event happens. The retweets that are considered must be //caused// by a tweet received. This sequence begins the matching process when the **callTweet** pointcut matches:
  
 <code javascript> <code javascript>
Line 31: Line 28:
 </code>  </code> 
    
-This pointcut matches the call of the **tweet** function and returns an environment that contains the **id** of the tweet and a **counter** initialized to zero. This counter is used to count the retweets of a tweet. Whenever **callTweet** matches, the **callRetweet** pointcut could match several times:+This pointcut matches the call of the **tweet** function and returns an environment that contains the **id** of the tweet and a **counter** initialized to zero. This counter is used to count the retweets of a tweet. Whenever **callTweet** matches, the **eventRetweet** pointcut could match several times:
  
 <code javascript> <code javascript>
Line 40: Line 37:
 </code>  </code> 
    
-This pointcut matches the **retweet** event. This event is the notification of a call to the **retweet** function that happened in another machine/application. The retweet of this event must be the same (//ie// the same string) that the environment contains. If this pointcut matches, it returns an environment that contains the counter incremented by one. This pointcut matches retweet events until the **midnight** event happens, meaning that the sequence matches. +This pointcut matches the **retweet** event. This event is the notification of a call to the **retweet** function that happened in another machine/application. The tweet of this event must be the same (//ie// the same string) that the environment contains. If this pointcut matches, it returns an environment that contains the counter incremented by one. This pointcut matches retweet events until the **midnight** event happens, meaning that the sequence matches. 
  
-A user commonly publishes several tweets, then it is necessary to have several sequences that matches, //ie.// one sequence by every different tweet. For example, if a user publishes the tweet //m1// twice and //m2// once, we only need a sequence for m1 and a sequence for m2 to analyze the popularity of all tweets of the user. To achieve this goal, it is necessary to //spawn// a new sequence by every different tweet. **WeCa**, through [[../|OTM]] , allows us to spawn sequence when a different tweet is published:+A user commonly publishes several tweets, then it is necessary to have several sequences, //ie.// one sequence for every different tweet. For example, if a user publishes the tweet //m1// twice and //m2// once, we only need two sequences: one for m1 and a sequence for m2 to analyze the popularity of all tweets of the user. To achieve this goal, it is necessary to //spawn// a new sequence for every different tweet. **WeCa**, through [[../|OTM]] , allows us to spawn a new sequence when a different tweet is published:
  
 <code javascript> <code javascript>
 var newPosts = function(steps, index, env, jp){ var newPosts = function(steps, index, env, jp){
-    var currentEnvs = this.getCurrentEnvs(index);+    var currentEnvs = this.getEnvsOfCurrentSeqs(index);
  
     return !currentEnvs.some(function(currentEnv){ //returns true if some condition is not satisfied     return !currentEnvs.some(function(currentEnv){ //returns true if some condition is not satisfied
Line 54: Line 51:
 </code> </code>
  
-Finally, the definition and deployment of the //tm// that analyzes the popularity of posts is:+Finally, the definition and deployment of the **sAspTweetPopularity** stateful aspect that determines the popularity of tweets is:
 <code javascript> <code javascript>
-var tm = {+var sAspTweetPopularity = {
     kind: AFTER,     kind: AFTER,
-    seqExp: countRetweet,+    sequence: countRetweet,
     advice: function(jp, env){     advice: function(jp, env){
         addPopularity(env.idT, env.counter);         addPopularity(env.idT, env.counter);
Line 64: Line 61:
     spawn: newPosts     spawn: newPosts
 }; };
-deploy(tm);+WeCa.OTM.deploy(sAspTweetPopularity);
 </code> </code>
  
 Go [[otm/the_matching_of_causal_sequences|the parent Web page]]. Go [[otm/the_matching_of_causal_sequences|the parent Web page]].
  • otm/the_matching_of_causal_sequences/example1.1297091040.txt.gz
  • Last modified: 2011/02/07 11:04
  • by aspectscript