February 16th, 2004

photogeek

Welcome!

This community is geared towards discussing uses of, applications of, and nifty things about the LiveJournal Friend of a Friend information. Since I wrote most of the code for this feature, I'm probably going to be writing most of the documentation for the time being - my goal is to have a centralized resource for those people who are using the feature for all kinds of nifty things to share tips and tricks.

If anyone needs to contact me, my contact information will always be available in the community user information. I haven't had too many problems with trolls in communities I maintain in the past, but I will deal with situations as they arise, as best I can.

For more information on what FOAF is, check out http://www.foaf-project.org . The people there have put together a useful informative site describing what the spec is and what it does.

Welcome to the community!
photogeek

External FOAF field

This code will break your FOAF feed in any RDF parser. I missed a /, which confuses things, and causes parsing to fail.

The external FOAF URL can be set on your Personal Information page, at http://www.livejournal.com/editinfo.bml . Under advanced options, there is a field labeled "External FOAF URL". This URL will let LiveJournal know that you already have a FOAF file created elsewhere on the net, and that you would prefer that people be redirected to this URL.

The following is an example FOAF file created when you set "External FOAF URL".

Collapse )

As you can see, no information such as foaf:knows fields is included in this file: these fields are excluded when the seeAlso field is included. If you plan to spider the information presented by LiveJournal, you should ignore all other information presented in this FOAF file - although it may or may not be accurate, it is not the canoncial source of information for the user. They set the External FOAF URL specifically so that this information can be presented in a different location.

In summary: External FOAF set on editinfo. Replaces all your FOAF:interests, foaf:knows, etc. with a bare bones document containing very little information. Any other information in this type of feed should be ignored. Check for a seeAlso before you store information from a feed. Example feed stored above.
photogeek

Searching for FOAF

In order to facilitate finding users more easily on LiveJournal, an option was added to redirect to the FOAF output of a user, so that you can search directly through FOAF files.

By sending a GET or POST request to http://www.livejournal.com/multisearch.bml, you can find a redirection to a FOAF file based on:
  1. Username
  2. Email
  3. AOL IM
  4. ICQ number
  5. Yahoo! ID
  6. MSN username
  7. Jabber ID


The format of a query should be:

q=search string
For example, q=crschmidt

type=search type
keys are, respective to order of list above:
  1. user
  2. email
  3. aolim
  4. icq
  5. yahoo
  6. msn
  7. jabber


output=foaf
This sets the output type to FOAF. This is an alternative to displaying the LiveJournal user information page, such as the one at http://www.livejournal.com/userinfo.bml?user=crschmidt . Keep in mind that all values must be escaped: for example, the @ sign would change to %40, and so on. If the search does not return any results, a return page will look something like http://www.livejournal.com/multisearch.bml?q=crschmidt%40livejournal.com&type=email . (The default scheme, xcolibur, will be used. If you are currently viewing the page in something other than xcolibur, you can see it to compare the source at http://goathack.livejournal.org:8023/multisearch.bml?q=crschmidt%40livejournal.com&type=email&usescheme=xcolibur .)

Keep in mind, not all users list the same contact user everywhere - although I'm crschmidt@livejournal.com in one place, I'm crschmid@uiuc.edu in another. So, you may want to compare on several of the contact information fields to ensure you're looking at the same person. Also, some users may choose to hide their contact information, so the fact that a search doesn't return anything isn't neccesarily an indicator that the user doesn't have a LiveJournal account.

This is the easiest way to find users FOAF files on LiveJournal - simply generate a query string with the contact information, send it to multisearch.bml with output=foaf, and you'll hopefully get a FOAF page back :)
photogeek

Only listing certain FOAF:knows

Since LiveJournal does not yet have true "trust" relationships, that indicate recprocity, the FOAF:knows relationship is not described exactly by the "friends" relationship. (For example, I friend brad, but he doesn't friend me back.) This would seem to be a problem, however, it is possible to override the users listed under FOAF:knows with a little bit of effort.

To accomodate for the fact that not everyone "knows" all the users on their friends lists, in order to modify who is displayed under your Foaf:knows categories, you simply need to create a specific friends group. You can create and modify your friends groups at http://www.livejournal.com/friends/editgroups.bml .

To use a FOAF friends group, create a new group labeled FOAF-knows. This group will act as a filter for users who are listed under your FOAF:knows listings. Simply add the journals you want listed there to the group, and they will be displayed under your FOAF:knows listings.

Keep in mind that LiveJournal will not display communities or syndicated feeds under the foaf:knows section. So, if you friend a community, even if it's in your FOAF-knows group, it won't be displayed in this section. This is both to conform to spec and to save in possible incorrect relations.

That sums up how to limit who shows up in your FOAF-knows filter, so that you only establish the relationships that you really think belong there.
photogeek

Linking your Journal to your FOAF file

Since FOAF is supposed to be integrating data, some of you might be asking where all this magical integration is coming from. Thus far, I've described a lot of LiveJournal specific ways of dealing with your FOAF file - now we get into the more interesting information.

Currently, if you have a properly coded journal style, utitlities have the ability to find an RSS feed of your journal simply by visiting your journal. In the source of the page is a tag:

<link title="RSS" href="http://www.livejournal.com/users/crschmidt/rss" rel="alternate" type="application/rss+xml" />

This tag tells any smart passers by that there is rss-xml information awaiting delivery at the URL mentioned. A tool could then go, gather the information for my entries, and have everything that it needs about the content stored by my journal. It would have a list of the most recent entries, who the author was, and more.

FOAF takes this concept a step further. Because it's possible to describe the person who owns the journal, you can find out a wide variety of information about the journal and author in question. In order to tell tools that integrate this type of data where your FOAF file is, LiveJournal will add this line to the <head> section of your journal:

<link title="FOAF" href="http://www.livejournal.com/users/crschmidt/data/foaf" rel="meta" type="application/rdf+xml" />

Because FOAF tools list a large number of people, it's best to identify who you are in the FOAF file. LiveJournal does this by adding the following line:

<meta name="foaf:maker" content="foaf:mbox_sha1sum '1ba3bffdd13a136d38b77542f2e26fd1dc0042f2' />

This string matches your FOAF file, where it will be generated based on your email address. This will tell FOAF tools which foaf:person is you specifically, rather than anyone else.

For more information on the foaf:maker tag, you can see http://usefulinc.com/foaf/iMadeThis . A good example of a tool which uses these links is Dashboard.

That's how LiveJournal tells web crawling type tools how to find your FOAF file, and to let them know that you were the one who made it.