Datenmodelle
Sozialer Netzwerkdienste

2011-10-15
Datenspuren

<astro@spaceboyz.net>

Folienvorlage von slides.html5rocks.com

Agenda

  • Grundlagen: Aspekte, Basistechnologien
  • Nutzermetadaten
  • Feed & Activity Streams
  • Dezentralisierung
    • OStatus
    • buddycloud

Was macht einen
Sozialen Netzwerkdienst aus?

Target, Date Range, About Me, Account End Date, Account Status History, Address, Alternate Name, Applications, Checkins, Connections, Credit Cards, Credit Balance, Currency, Date of Birth, Education, E-Mails, Events, Family, Favourite Quotes, Friend Requests, Friends, Gender, Groups, Hometown, Last Location, Linked Accounts, Locale, Logins, Machines, Messages, Minifeed, Name, Name Changes, Networks, Notes, Notification Settings, Notifications, Phone Numbers, Photos, Physical Tokens, Pokes, Political Views, Favourite Quotes, Friend Requests, Friends, Gender, Groups, Hometown, Last Location, Linked Accounts, Locale, Logins, Machines, Messages, Minifeed, Name, Name Changes, Networks, Notes, Notification Settings, Notifications, Phone Numbers, Photos, Physical Tokens, Pokes, Political Views, Privacy Settings, Profile Blurb, Realtime Activities, Recent Activities, Registration Date, Relationship, Religious Views, Removed Friends, Screen Names, Shares, Status Updates, Vanity, Wallposts, Website, Work

Quelle: europe-v-facebook.org

Soziale Netzwerkdienste

...erlauben Nutzern:

  1. ein (halb-)öffentliches Profil im System zu erstellen
  2. eine Liste Nutzer zu pflegen, mit denen man verbunden ist
  3. Listen anderer Nutzer anzusehen und zu durchlaufen

Boyd, Danah M., & Ellison, Nicole B. 2008. Social Network Sites: Definition, History, and Scholarship

Basisprotokolle

Keine Angst vor spitzen Klammern!

HTTP

http://example.com/path/to/resource

Request & Response

Links im Web

Embedding in HTML

<style>
    a { color: red; }
</style>
<script>alert("pwned");</script>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA
AABMAAAATCAYAAAByUDbMAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWX
MAAAsSAAALEgHS3X78AAAAB3RJTUUH0gwDAQszGYGHgQAAAMFJREFUeJy
dVNsRBCEIA1vantyatiesifu4Q5GHupcZf2KIYUQRcvBiDyOyJCZMBMDs
F9HQLA77ioiAmfeLyBvquMzbszwQh4+0yb/4VpQVd6i2e7IplS54wWOJU
r2FpEOb6p9ksheNRhfagowXhGargtWNO7PsFk90xQpqPTOrNTZ0Ux9xdv
IjLpwz3cbzDO6+RRxqe84wCQAwX2PZRPaNbt/marZsqjLxCNDaLNbfj0Z
rvr0IRxcgrU0pN6YZwroPdCriaYFg3d8AAAAASUVORK5CYII=">

Baumstruktur von HTML/XML

Nutzermetadaten

vCard

BEGIN:VCARD
VERSION:4.0
N:Gump;Forrest;;;
FN: Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
PHOTO:http://www.example.com/dir_photos/my_photo.gif
TEL;TYPE="work,voice";VALUE=uri:tel:+1-111-555-1212
TEL;TYPE="home,voice";VALUE=uri:tel:+1-404-555-1212
ADR;TYPE=work;LABEL="42 Plantation St.\nBaytown, LA 30314\nUnited States of America"
 :;;42 Plantation St.;Baytown;LA;30314;United States of America
EMAIL:forrestgump@example.com
REV:20080424T195243Z
END:VCARD

hCard

<div class="vcard">
  <a class="fn org url" href="http://www.commerce.net/">CommerceNet</a>
  <div class="adr">
    <span class="type">Work</span>:
    <div class="street-address">169 University Avenue</div>
    <span class="locality">Palo Alto</span>,  
    <abbr class="region" title="California">CA</abbr>  
    <span class="postal-code">94301</span>
    <div class="country-name">USA</div>
  </div>
  <div class="tel">
   <span class="type">Work</span> +1-650-289-4040
  </div>
  <div class="tel">
    <span class="type">Fax</span> +1-650-289-4041
  </div>
  <div>Email: 
   <span class="email">info@commerce.net</span>
  </div>
</div>

Nutzerprofile als
Activity/Life Streams

Feeds

Twitter

Delicious

Github

Verbindungen

Mutual Friendship or just Following?

Nutzerverbindungen: Abonnement für Updates

Feed Discovery

<link rel="alternate"
      type="application/rss+xml"
      title="RSS 2.0"
      href="updates-rss.xml"/>

<link rel="alternate"
         type="application/atom+xml"
         title="Atom 1.0"
         href="updates-atom.xml"/>
	    

RSS

<rss version="2.0">
<channel>
  <title>RSS Title</title>
  <description>This is an example of an RSS feed</description>
  <link>http://blog.example.com/</link>
  <lastBuildDate>Mon, 06 Sep 2010 00:01:00 +0000 </lastBuildDate>
  <pubDate>Mon, 06 Sep 2009 16:45:00 +0000 </pubDate>
  <ttl>1800</ttl>
 
  <item>
    <title>Example entry</title>
    <description>Here is a description.</description>
    <link>http://blog.example.com/2009/09/example-entry</link>
    <guid>unique string per item</guid>
    <pubDate>Mon, 06 Sep 2009 16:45:00 +0000 </pubDate>
  </item>
 
</channel>
</rss>

ATOM

<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Example Feed</title>
  <link href="http://example.org/feed/" rel="self" />
  <link href="http://example.org/" />
  <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
  <updated>2003-12-13T18:30:02Z</updated>
  <author>
    <name>John Doe</name>
    <email>johndoe@example.com</email>
  </author>
  <entry>
    <title>Atom-Powered Robots Run Amok</title>
    <link rel="alternate" type="text/html"
          href="http://example.org/2003/12/13/atom03.html"/>
    <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
    <updated>2003-12-13T18:30:02Z</updated>
    <content>Stuff.</content>
  </entry>
</feed>

ATOM type attributes

<entry xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Hello</title>
  <summary type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
      <h1>Hello World</h1>
      <script>alert("pwned")</script>
    </div>
  </summary>
  <content type="html">
    &lt;h1&gt;Hello World&lt;/h1&gt;
    &lt;script ="&gt;" src="http://evil.com/xss.js"&gt;
  </content>
</entry>

Feeds nutzen

Web-Aggregatoren

Activity Streams

  • Konstrukt per Eintrag:
    Somebody [actor] posted [verb] something [object] somewhen [time] to a profile [target].
  • verb: add, delete, favorite, unfavorite, follow, stop-following, ignore, invite, join, leave, like, unlike, save, share, tag, update, ...
  • object types: article, bookmark, comment, event, file, group, image, note, person, place, product, question, ...
  • Location
  • Mood
  • Rating
  • Source

Activity Streams-Beispiel

<entry xmlns="http://www.w3.org/2005/Atom"
       xmlns:activity="http://activitystrea.ms/spec/1.0/">
  <id>tag:photopanic.example.com,2009:activity/4859/4352</id>
  <title>Geraldine posted a Photo on PhotoPanic</title>
  <published>2009-11-02T15:29:00Z</published>
  <link rel="alternate" type="text/html"
      href="http://example.com/geraldine/activities/4352" />
  <activity:verb>post</activity:verb>
  <activity:object>
    <id>tag:photopanic.example.com,2009:photo/4352</id>
    <activity:object-type>photo</activity:object-type>
  </activity:object>
  <content type="html">
    &lt;p&gt;Geraldine posted a Photo on PhotoPanic&lt;/p&gt;
    &lt;img src="/geraldine/photos/4352.jpg"&gt;
  </content>
</entry>

XHTML Friends Network
(XFN)

<a href="http://jimmy.com/" rel="friend">Jimmy>/a>
<a href="http://blog.example.com/" rel="me">My Blog>/a>

XFN Demo

http://socialgraph-resources.googlecode.com/svn/trunk/samples/findcontacts.html

Aus der Blogosphäre...

Trackback

POST http://www.example.com/trackback/5
Content-Type: application/x-www-form-urlencoded; charset=utf-8

title=Foo+Bar&url=http://www.bar.com/&excerpt=My+Excerpt&blog_name=Foo

Pingback

  • Alice bloggt über Bob und findet:
    <link rel="pingback" href="http://bob.example.net/xmlrpcserver">
  • XMLRPC zu http://bob.example.net/xmlrpcserver:
    pingback.ping('http://alice.example.org/#p123',
                  'http://bob.example.net/#foo')

Dezentralität

Dezentral und benutzerfreundlich?
Zooko's triangle

OStatus-Beispiele

Server gesucht? http://podupti.me/

OStatus

  • hCard: Benutzerprofile
  • ATOM+ActivityStreams: Inhalte
  • Portable Contacts: Following-Listen
  • Webfinger: Discovery
  • PubSubHubbub: Abonnements
  • Salmon: Benachrichtigungen

Webfinger

Benutzerreferenzierung:

  • Profile URL: http://identi.ca/datenspuren
  • Webfinger Account ID: acct:pentaradio@identi.ca

XRD:

  • http://identi.ca/.well-known/host-meta
  • http://joindiaspora.com/.well-known/host-meta
  • http://gmail.com/.well-known/host-meta

PubSubHubbub

<feed xmlns="http://www.w3.org/2005/Atom">
  <link rel="hub"
        href="https://myhub.example.com/endpoint"/>
  ...
</feed>

POST /endpoint

  • subscribe/unsubscribe
  • topic
  • callback URL

Salmon

“Personalized successor to Trackback/Pingback”

<feed xmlns="http://www.w3.org/2005/Atom">
  <link rel="salmon"
        href="http://example.org/all-replies-endpoint"/>
  <entry
    <link rel="salmon"
          href="http://example.org/repliy-endpoint/2342"/>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
  <Subject>acct:bob@example.com</Subject>
  <Link rel="salmon"
        href="https://example.com/mention-handler"/>
</XRD>

POST /mention-handler

Salmon Magic Envelope

<me:env xmlns:me='http://salmon-protocol.org/ns/magic-env'>
  <me:data type='application/atom+xml'>
    PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4KPGVudHJ5IHhtbG5zPSdod
    HRwOi8vd3d3LnczLm9yZy8yMDA1L0F0b20nPgogIDxpZD50YWc6ZXhhbXBsZS5jb20sMjAwOT
    pjbXQtMC40NDc3NTcxODwvaWQ-ICAKICA8YXV0aG9yPjxuYW1lPnRlc3RAZXhhbXBsZS5jb20
    8L25hbWU-PHVyaT5ib2JAZXhhbXBsZS5jb208L3VyaT48L2F1dGhvcj4KICA8dGhyOmluLXJl
    cGx5LXRvIHhtbG5zOnRocj0naHR0cDovL3B1cmwub3JnL3N5bmRpY2F0aW9uL3RocmVhZC8xL
    jAnCiAgICAgIHJlZj0ndGFnOmJsb2dnZXIuY29tLDE5OTk6YmxvZy04OTM1OTEzNzQzMTMzMT
    I3MzcucG9zdC0zODYxNjYzMjU4NTM4ODU3OTU0Jz50YWc6YmxvZ2dlci5jb20sMTk5OTpibG9
    nLTg5MzU5MTM3NDMxMzMxMjczNy5wb3N0LTM4NjE2NjMyNTg1Mzg4NTc5NTQKICA8L3Rocjpp
    bi1yZXBseS10bz4KICA8Y29udGVudD5TYWxtb24gc3dpbSB1cHN0cmVhbSE8L2NvbnRlbnQ-C
    iAgPHRpdGxlPlNhbG1vbiBzd2ltIHVwc3RyZWFtITwvdGl0bGU-CiAgPHVwZGF0ZWQ-MjAwOS
    0xMi0xOFQyMDowNDowM1o8L3VwZGF0ZWQ-CjwvZW50cnk-CiAgICA=
  </me:data>
  <me:encoding>base64url</me:encoding>
  <me:alg>RSA-SHA256</me:alg>
  <me:sig>
    cAIu8VKIhs3WedN91L3ynLT3GbZFhbVidDn-skGetENVH-3EguaYIjlPTq7Ieraq4SD
    BknM9STM9DR90kveUrw==
  </me:sig>
</me:env>

buddycloud

buddycloud Datenmodell

buddycloud Features

  • Dezentralität durch XMPP
  • Echtzeit-Benachrichtigungen
  • Identifizierung durch Jabber-Id
  • Zugriffsmodelle: open, whitelist, authorize

Auf, in eine dezentrale Zukunft!

Fragen?