Tag Archives: phoaf

PHOAF v0.4 and performance tests for inference engine

I forgot to mention it on my previous post, but PHOAF v0.4 is available[1]. This version handles Relationship vocabulary as explained here.

Here are the results of a few tests about time / memory performance of 0.3 vs 0.4 – that uses inference engine. I choosed 3 FOAF files which differ in the way they represent relations between people:

I ran the tests under a 1.8Ghz Pentium-M with 512Mo RAM, and files were copied locally to avoid network latency:

 
alex@marvin:~/foaf-perf$ ./perf.sh  
** Performances for models/danbri.rdf  
* PHOAF v0.3:  Dan Brickley knows 22 people  Memory: 2159288  Time: 0.334619998932 seconds 
* PHOAF v0.4:  Dan Brickley knows 22 people  Memory: 2722496  Time: 0.857136964798 seconds  

** Performances for models/iandavis.rdf  
* PHOAF v0.3:  Ian Davis knows 15 people  Memory: 2162440  Time: 0.111047029495 seconds  
* PHOAF v0.4:  Ian Davis knows 15 people  Memory: 2725496  Time: 0.747648954391 seconds  

** Performances for models/kasei.rdf  
* PHOAF v0.3:  Gregory Todd Williams knows 1 people  Memory: 3096304  Time: 0.339249849319 seconds  
* PHOAF v0.4:  Gregory Todd Williams knows 6 people  Memory: 3650496  Time: 1.99226093292 seconds

As you can see, the issue is more on time than memory, especially when it has to create new triples from default model using inference engine: script behavior is almost the same for the 2 first files, but really longer for the last one, where it discovers new <foaf:knows> relations.

Yet, even on files using only <foaf:knows> it can be problematic as it can make your PHP script timeout, as it seems to do in FOAFMap for files containing a lot of relationships (~100). So if you plan to use it on big models, update your PHP time limit.

Notes

[1] As I got some bugs reported since FOAFMap.net has been online, a new version is expected soon.

About these ads

FOAFMap.net is online !

As I’m finally satisfied with the code I wrote, here’s a first public version of FOAFMap.net, a “not-beta Semantic Web2.0 geolocation mashup” (nice, isn’t it ?!).

Regarding the previous version of the tool, here are the main improvements:

  • Support for Relationship vocabulary (that I introduced in PHOAF recently). So if you use rel:xxx instead of foaf:knows to manage your friends, the tool will find them anyway;
  • Group management. As I explained here, PHOAF can handle foaf:group, and this feature have been integrated into FOAFMap, so that you can use it to display communities. Thanx Tom for suggesting it;
  • Cache. As you may see, it can be really long to parse a file, especially when there are a lot of foaf:knows relations. A cache system is now available, so that you can save the created map to display it more quickly later. Just check the appropriate checkbox when submitting your profile to enable. You’ll also be listed in users directory when using cache system.
  • Tags. FOAFMap.net automagically gets “Tags” from your FOAF profile. Actually, these tags are your foaf:interest. Tags are identified and mapped thanks to their URI, as people can use different labels (with dc:title) for the same one; eg: FOAF, ”Friend of a Friend’ for http://foaf-project.org. And, indeed, you can see which profiles are related to a specific tag.

Well, as you can see, what was at the begining just a small script to render FOAF files on a GoogleMap is now an more complex (and friendly, I hope) tool that takes ideas from both Semantic Web and Web2.0.

I think this could be a Semantic Web answer to geolocation tools such as frappr.com. The main advantage is that you own the data, and the tool just display it. If your blogging software, or wiki, creates a personnal/group FOAF file, you can use the tool to locate people, but data is still yours.

Some may insist on the privacy point, as there’s no logging system. Yet, as all data displayed on the tool is publicly available on the web, I don’t think that’s an issue. Anyway, you can drop me a mail if someone else has listed your profile and you want to remove it.

Finally, I’ll submit FOAFMap.net to SFSW06 scripting challenge, and will certainly release code (GPL-ed), so that you can use for Intranet or private working groups.

Have fun !

Relationship vocabulary in PHOAF with RAP inference engine

I’ve just added support for Relationship vocabulary in PHOAF, so that the knows() method now recognise all Relationship properties (as they are subproperties of foaf:knows()).

I was wondering how such subproperties and inferencing could be handled in RAP, but this is actually really simple.

First, your model needs to be an InfModel (I choosed InfModelF, as the file is not supposed to evolve after being loaded). Then, you must add the statements that will define relations between properties and their “top-properties”.

Eg:

$this->add(new Statement(RELATIONSHIP::RELATIONSHIP(), RDFS::SUB_PROPERTY_OF(), FOAF::KNOWS());
$this->add(new Statement(RELATIONSHIP::ACQUAINTANCE_OF(), RDFS::SUB_PROPERTY_OF(), FOAF::KNOWS());
$this->add(new Statement(RELATIONSHIP::AMBIVALENT_OF(), RDFS::SUB_PROPERTY_OF(), FOAF::KNOWS());
$this->add(new Statement(RELATIONSHIP::ANCESTOR_OF(), RDFS::SUB_PROPERTY_OF(), FOAF::KNOWS());
$this->add(new Statement(RELATIONSHIP::ANTAGONIST_OF(), RDFS::SUB_PROPERTY_OF(), FOAF::KNOWS());
$this->add(new Statement(RELATIONSHIP::APPRENTICE_TO(), RDFS::SUB_PROPERTY_OF(), FOAF::KNOWS());

Now, when using $this->getMatchingStatements(NULL, FOAF::KNOWS(): NULL), and thanks to the inference engine, you’ll get all statements with rel:xxx as a predicate.

PHOAF v0.3 and foafMap future

I’ve updated PHOAF in CVS last week-end, and also as a v0.3 release.

Here’s the changelog:

  • First, a bugfix about PHP5 warnings in RAP, as it uses reference when calling some methods. I fixed it in v0.1 but forgot to do it when upgrading RAP to 0.9.3[1]. Thanx to Jean-Jacques for reporting it
  • Removing all useless code from RAP, so that the API will be lighter to embed in other apps. By useless, I mean that PHOAF doesn’t need all the features that RAP offers, as infModel, resModel … I also removed the SPARQL + RDQL functions. Indeed, the aim of PHOAF is to provide an easy way to parse FOAF files, using only PHP objects and appropriate methods. IMHO, if a user want to use SPARQL on FOAF files, it means that he knows RDF and SPARQL, so he’ll have better to use RAP directly instead of PHOAF. The archive is now only 91K, while it used to be 544k for v0.2 !
  • the methode FoafModel->root(), which is used when you want to get the primary topic of the file can now retrieve not only people, but also groups[2]
  • As a consequence of the previous point, I added a getResourceType() method for FoafResource, so that you can check if your PPD is a Person, a Group, or anything else actually.

So, indeed, I’ll move it into foafmap soon.

The main interest is that it will be able to manage group files, as Tom suggested me. Then, I’ll put an optional cache system (as retrieving informations from distributed FOAF files over the network is a bit long). I’ll also add a user account system, so that users will be available to update their cached result, maybe tag their profile (with tag detection from foaf:interests), etc …

I think it could lead to a SemWeb equivalent to Frappr!, where the main advantage is that you own your datas, and the app is just here to display it on a map. I think that’s really better, for privacy and for decentralized knowledge management. If you or one of your friend change location, you won’t have to modify anything, just update your FOAF profile, reload your foafmap page, and that’s ok !

Notes

[1] RAP v1.0 might be rewritten in PHP5

[2] BTW, please use personalProfileDocument and primaryTopic when you create a FOAF file. That’s the better machine-readable way to tell who is your FOAF file about

Foaf and Google Maps with foafMap

I mentionned about one month ago I wrote a frontend to RAP, called PHOAF, to easilly query FOAF files in PHP5.

Here’s the app I wanted to hack while starting the lib: foafMap, which displays users found in a FOAF profile on a Google Map.

This first version is really basic, but I plan to improve it in the future[1] (avatars, auto-zoom on main foaf user, expanding network …). And, also that’s a bit slow if you know a lot of people, as it fetch and parse each profile.

Yet, I think that’s another fun way to see how Semantic Web can help to share and re-use data among the Web.

Enjoy !

Notes

[1] Check posts tagged with foafmap from this blog … humm one more thing to add to my todo list: RSS feeds per tags

Retrieving FOAF informations with PHP

After reading this tutorial by Ian Davis about parsing FOAF files with PHP – which is also a good introduction to RDF and FOAF -, I started to write a PHP5 library to easilly retrieve informations from FOAF files.

The goal of PHOAF is to provide a set of functions to get information from a FOAF file without any knowledge about FOAF or RDF.

Eg:

$foaf = new FOAFProfile("http://mywebsite/profile.rdf"); $me = $foaf->root(); echo $me->getName() . " knows " . $sizeof($me->knows()) . " people";

It still needs some documentation, code cleaning and so on, but information about the project can be found on its gna.org homepage, and you can download a first package here.

A first app using it will be online soon, in the next 2 weeks I hope, and updates of the library will occur at the same time.