[rdfweb-dev] Which Person wrote this FOAF?

Ian Davis iand at internetalchemy.org
Wed Jul 30 15:36:46 UTC 2003


On Tuesday, 29 July 2003 at 12:30, Leigh Dodds wrote:
> Not to disagree with any of the good points made already, I'd been 
> thinking along the same lines myself for the FOAF-a-Matic. I'd 
> thought about implementing the following algorithm:

> 1. try to find a foaf:maker, if found thats your person
> 2. otherwise try to find a dc:creator, if found thats your person
> 3. otherwise try to identify a person who isn't known by another else 
>   in the graph generated from that FOAF file, if found thats your person
> 4. otherwise present a menu to say "which person?"
Step 3 here doesn't work if you're using the relationships module.
I've got my wife in my FOAF including a property showing that she's
married to me. It's a circular reference.

Indirectly relevant:

On Semantic Planet I wanted to pick out what each RDF file was
describing since each document may be describing a number of
'interesting' things. I arranged so the crawler matches things
according to a template. (I need to write this up properly). I look
for foaf:Person with some required properties (mbox/mbox_sha1sum) plus
some optional properties. There's a threshold for how many optional
properties are should be present to make the thing an interesting one.

It works fairly well - picking out the main subject of the document
while excluding those who are just mentioned in passing. I do it for
Documents and Channels too.

Here's the code:

my $pattern = new SemBot::Pattern;
$pattern->setType( 'http://xmlns.com/foaf/0.1/Person', 'Person' );
$pattern->addRequiredProperty( 'http://xmlns.com/foaf/0.1/mbox_sha1sum' );

$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/name' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/title' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/surname' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/nick' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/knows' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/mbox' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/homepage' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/depiction' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/phone' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/workplaceHomepage' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/schoolHomepage' );
$pattern->addOptionalProperty( 'http://xmlns.com/foaf/0.1/interest' );

$pattern->setMinOptional(1);

$pattern->addDescriberProperty( 'http://xmlns.com/foaf/0.1/name', 'name' );
$pattern->addDescriberProperty( 'http://xmlns.com/foaf/0.1/mbox_sha1sum', 'mbox_sha1sum' );
$pattern->addDescriberProperty( 'http://xmlns.com/foaf/0.1/homepage', 'homepage' );

$pattern->match($model)



- Ian <iand at internetalchemy.org>
"Imagination is more important than knowledge."




More information about the foaf-dev mailing list