[foaf-dev] [foaf-protocols] fp:ping

Story Henry henry.story at bblfish.net
Fri Apr 16 21:59:14 CEST 2010

On 16 Apr 2010, at 20:10, Mischa Tuffield wrote:

> Hello, 
> On 16 Apr 2010, at 17:26, Danny Ayers wrote:
>> pings are great, and recording pings is a great idea (you don't think
>> google don't do this already?). Bit over engineered - all you need is
>> maybe A -> B (hopefully URIs) and a timestamp.
> I would like to think it was that simple too. But I am guessing that would require each foaf page to have it's own rdf store. If every foaf personalprofiledocument came with its own sparql store, a friend request could be as simple as telling the foaf person's rdf store to grab your foaf data, 

Hmm, why so complicated?

Here is how one could do it with very simple cgis.

1. You use vi to edit your foaf file on http://mischa.name, and add a pointer

  :me ping:servivce </ping> .

2. At /ping you have a simple cgi, that received the post of a
WebID as described earlier in this thread. When it received one of those 
it just logs the request somewhere. Perhaps it can even create a little rdfa 
marked up resource 


only visible to the agent who made it (using foaf+ssl) and to the web service owner - to avoid people using this
as a way to get kudos in a big search engine by means of link spamming.

3. Next time you log in you can visit


   which in the initial version shows you a simple html table with all the requests you have 
received. This table is in a form. A slightly more clever script can do an HTTP GET on each webid, and
do a bit of verification for you: show you the info the person is publishing about themselves, verify if you
have any friends in common (by parsing your foaf file, and doing a few quick queries). Ok, so here you have a cgi that can deal with parsing remote rdf. But that could be done on the fly quite easily for small sites. I don't get that many friend requests - and I am quite happy - I have enough friends now :-) Though I'd rather have them in foaf than on FB...

4. those friends you accept get added to your foaf file.

Ok, so we have foaf stores, but they can just be the foaf files themselves - makes it sound less advanced that way :-)

> I guess something like (but better than)[1].

Well yes, though calling your ping service "submit a foaf file" may not be an intuitive way to explain the ping

What we want to is automate your form, by adding the form post end point to your foaf directly. So that when I add someone to my foaf, automatically a cgi can go and find their webid, find the ping service and ping it for me.

So what we are looking for is just a standard way for you to add a relation to each foaf file hosted by you to your <http://foaf.qdos.com/ping> service.

I would like to use my own ping service, and each instance of Elgg or foaf.me would have its own ping service.

> We implemented a UI for showing friend requests in a  foafbuilder UI [2], which checks the contents of the KB which the ping service adds rdf to, to present the user with a list of mutual friends, friend requests, and friend requests you have made (was meant to be facebookie).

yes, that is very nice part of foafbuilder. I highly recommend that as a way of presenting the result of friend requests.

> I can see how catering for people to arbitrarily upload rdf to your kb doesn't always sound like a good idea,
> as your KB could get rather bloated.

yes, you just want people to post their WebId in the form, perhaps the WebId of the person they are trying to link to,  with a comment perhaps and a date. These are details to be worked out.

All the server needs to store is that POSTED information. 

> I could envisage a UI feature which showed you a list of foaf:Document URIs that contain no information about anyone you have added as a friend, which you then then choose to remove from your rdf store.

That would be the minimal version.

More interesting implementations would GET that WebId and find the picture of the person, the name, etc.
and present you with something easier to read.

> My foaf file[3] works well in the foafbuilder.qdos.com (and yes I know I am a bad example, and that the service is far from polished - must find more time ....), but meh. 

Yep. Not much to see there for the end user.  :-)

> So, if I wanted to "friend" another foaf:Person, and I didn't know their foaf:Document URI,

We are not starting from this use case. We are starting from a use case where we know their WebID.
From their we find the ping end point to contact them, and post the information.

It's a really simple service.

Finding a webid can be done in many different ways. By using qdos for example. We just want to make it easy
for everyone who has a foaf file to be pinged for friend requests, wherever they are, one whatever server,...

> I could ask a search engine (or until then i could ask) foaf.qdos.com [5] for foaf:Person URIs for a Person which I know an ifp [4] for (as foaf.qdos.com does cater for name based searching - which it should do!).
> Then I would have to some how magically find a way to ping them my updated foaf:Document. I guess a triple stating "<#me> <http://example.org/hasPingEndpoint> <http://foo.com/ping/> ." would be a starting point -

Yep, that is the proposal!

> and is what most of this thread is about trying to define (I think). And yes, I standard way of performing this would be a good thing.

Ok. We agree. 

> IMO it is best to keep whatever mechanism simple,

We agree even more. 
Did we go to the same school together? ;-)

> all you need for friend requests to work is a store to hold the various foaf files of interest, and a way to query them to find out who is trying to friend you, as illustrated by the foafbuilder which I linked to above. It would be nice if one could find the object of the <http://example.org/hasPingEndpoint> property and then PUT a foaf:Document URI to the endpoint. Something like : 
> curl -T mynewlyupdatefoaffile.rdf 'http://foo.com/ping/http://example.com/mynewlyupdatefoaffile.rdf'

I think just POSTing a link to your webid is enough, no?
The server can then go and get that info himself, which is a way also of verifying the validity of the claim.

> Then you don't need anything other than RDF, SPARQL, and yay friend requests.

yes. As mentioned above, you can even have in memory stores with very short life for little private servers.

> Saying that I should add some timestamping triples to the foaf.qdos.com KB indicating the time when the foaf:Document was pinged (thanks Danny - should have really be doing this from the outset). Will help with keeping the kb uptodate later on ... 


So perhaps given that what we have is a little bit different from the X-Ping header stuff, we should try to develop this and then see how we can get a generalised ping mechansim out of this.

I'd be happy to put together a little cgi in scala to do this. We'd just need to agree on a URL for it.


> Thanks all really, 
> Mischa
> [1] http://foaf.qdos.com/ping
> [2] http://foafbuilder.qdos.com/
> [3] http://mmt.me.uk/foaf.rdf
> [4] http://foaf.qdos.com/sameas/?path=http://danbri.org/&ifp=
> [5] http://foaf.qdos.com/sameas
>> On 14 April 2010 11:00, Story Henry <henry.story at bblfish.net> wrote:
>>> Hi,
>>> I would like to propose a ping relation. It is extremely common for people
>>> to ask how does one make friends in foaf. For a long time, I thought looking
>>> at the referrer in the logs would be enough. But that is perhaps just a bit
>>> too minimalistic. Here we can do better.
>>> This is a sketch of what the relation should look like. It should be really
>>> simple, something that would allow a simple html form to do the job for
>>> human readers too.
>>> The access to the resource can be protected using foaf+ssl, so that one can reduce spam
>>> opportunities, or at least filter them.
>>> It would be defined like this
>>> @prefix fp: <http://foaf-protocols.com/ont/> . # made up name-space
>>> @prefix owl: <http://www.w3.org/2002/07/owl#> .
>>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>>> fp:ping a rdf:Property;
>>>   rdfs:domain foaf:Agent;
>>>   rdfs:range xxx:POSTResource;
>>>   rdfs:comment """
>>>      This relation gives a way for other services to ping
>>>    this webid when a new document is found that mentions this WebID.
>>>      The relation relates a WebId to a collection. A new resource of
>>>   type PingEvent can be created in that collection by POST ing a
>>>   URL that mentions the given WebId.
>>>      The POSTing would be the post created by the following html form where
>>>   ?coll is the name of the object of the relation, and ?rederer is the URL of
>>>   the referring resource
>>>    <form action="POST" action="?coll">
>>>        referer: <input type="text" name="referer"/><br/>
>>>        comment: <input type="text" name="comment"/>
>>>    </form>
>>>   The resource returned by a GET on the POSTResource can even return the above html
>>>   form.
>>>   The resource created should be a named ping request, which itself
>>>  can be described using this ontology.
>>>   This end point could long term accept more flexible contents to be
>>>  posted. One could post an atom Entry for example.
>>>   """ .
>>> Henry
>>> Social Web Architect
>>> http://bblfish.net/
> Mischa Tuffield PhD
> Email: mischa.tuffield at garlik.com
> Homepage - http://mmt.me.uk/
> Garlik Limited, 1-3 Halford Road, Richmond, TW10 6AW, UK
> +44(0)7989 199 786  http://www.garlik.com/
> Registered in England and Wales 535 7233 VAT # 849 0517 11
> Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD

More information about the foaf-dev mailing list