document.Yowl.register(
"twitter",
[ "Found a Twitter account", "Twittered" ],
[ "Found a Twitter account", "Twittered" ],
"http://twitter.com/favicon.ico"
);
select: [ "person", "twittername" ],
where:
[
{ pattern: [ "?account", "http://xmlns.com/foaf/0.1/accountServiceHomepage", "http://www.twitter.com/" ] },
{ pattern: [ "?account", "http://xmlns.com/foaf/0.1/accountName", "?twittername" ] }
]
twitter-person
document.Yowl.notify(
"Found a Twitter account",
"Found Twitter account :" + obj.twittername.content,
"Retrieving more information from Twitter API",
"twitter",
null,
false,
0
);
url: 'http://www.twitter.com/statuses/user_timeline/${obj.twittername.content}.json',
params:
{
callbackParamName: 'callback',
count: '2'
}
for (var i = 0; i != data.length; i++)
{
var item = data[i];
var uriStatus = "http://twitter.com/" + item.user.screen_name + "/statuses/" + item.id;
var uriPerson = "http://twitter.com/" + item.user.screen_name;
/*
* Add the status entry.
*/
document.meta.store.add(
uriStatus,
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"http://www.twitter.com/status",
false
);
var sText = item.text.replace(/img(\@src)?\=([^\s]*)/g, "<img src='$2' />");
sText = sText.replace(/tube(\@src)?\=(.*)/g, "<object width='425' height='355'><param name='movie' value='$2'/><param name='wmode' value='transparent'/><embed src='$2' type='application/x-shockwave-flash' wmode='transparent' width='425' height='355'/></object>");
document.meta.store.add(
uriStatus,
"http://www.twitter.com/text",
{
content: sText,
datatype: "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"
},
true
);
document.meta.store.add(
uriStatus,
"http://www.twitter.com/saidby",
"http://twitter.com/" + item.user.screen_name,
false
);
/*
* Add information about who said the status.
*/
document.meta.store.add(
uriPerson,
"http://xmlns.com/foaf/0.1/depiction",
item.user.profile_image_url,
false
);
document.meta.store.add(
uriPerson,
"http://xmlns.com/foaf/0.1/name",
item.user.name,
false
);
}
return;
select: [ "twitterer", "tweet", "name", "depiction" ],
where:
[
{ pattern: [ "?s", "a", "http://www.twitter.com/status" ] },
{ pattern: [ "?s", "http://www.twitter.com/text", "?tweet" ] },
{ pattern: [ "?s", "http://www.twitter.com/saidby", "?twitterer" ] },
{ pattern: [ "?twitterer", "http://xmlns.com/foaf/0.1/name", "?name" ] },
{ pattern: [ "?twitterer", "http://xmlns.com/foaf/0.1/depiction", "?depiction" ] }
]
if (obj.depiction == undefined)
obj.depiction = null;
document.Yowl.notify(
"Twittered",
obj.name + " said:",
obj.tweet.content,
"twitter",
obj.depiction,
true,
0
);