I've just uploaded the first cut of a php FOAF parser for use in applications that need to read FOAF without needing to understand RDF. You can find it here.

Here's the readme. There's a test rig here.


Copyright:
Original written by Julian Bond
This work is in the public domain:
SEE: http://creativecommons.org/licenses/publicdomain/
So do what you like with it!

Description:
A general purpose Person Class for use when reading FOAF into
non-FOAF aware Applications. It assumes that the FOAF file is a
personal profile document for a single Person. It attempts to locate
this person using a heuristic that works from an explicit PrimaryTopic
downwards to guesswork.

Requires RAP v0.8 http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/
A cut down copy of RAP v0.8 is included in the zip in the sub-directory
api/ with unused files commented out in RdfAPI.php. Please note that the
above license info only applies to this file. RAP has it's own license.

Usage:
$data = foafPerson_FetchDataCurl($url);
$thePerson = new foaf_Person($data, $url);
print "<pre>".print_r($thePerson->values)

Data:
$thePerson->model gives access to the underlying RAP memmodel
$thePerson->Person is the single top level person
$thePerson->values is a sparse array of values of types keyed
on the tag name.
- Literal
- URI
- geo
- Vcard address
- knows Person

eg.
values["name"][0]
values["weblog"][0]["uri"] or ["title"]
values["based_near"][0]["lat"] or ["long"]
values["ADR"][0]["Street"]or["Locality"]or["Region"]
or["Pcode"]or["Country"]
values["knows"][0]["relationship"] or ["person"] where Person is
of the same form as values but without any knows array

Extensions:
It's fairly easy to add new namespaces into foafPerson_ns() and
namespace tags into foafPerson_rdfTags() The array of tags has three
elements
[0] associative key into the namespace list
[1] tag name
[2] tag type

New types can be added into the foaf_Person constructor with a
corresponding new function to create the array.


[ << FOAF Workshop @ DERI Galway (1-2 Sept 2004): Call for papers ] [ Searching the Invisible Web >> ]
[ 19-Jun-04 4:33pm ]