[rdfweb-dev] Parsing FOAF in perl?
jo at a...
Fri Dec 6 12:47:57 UTC 2002
> Does anyone have any suggestions for parsing FOAF in Perl?
depends what you are doing with the data afterwards... i use a perl
wrapper around an XSLT stylesheet, a straight port by mattb of a ruby
version... it uses XML::LibXML and XML::LibXSLT. it takes in RDF and
spits out n-triples, which are converted into sql statements for a
source is here: http://london.pm.org/~jo/rdfparse
i have used redland's perl api but there are bugs you have to be careful
of, you can't re-use nodes in statements but have to clone them first, it
gets a bit verbose... hoping to help fix this. redland doesnt have a
serialiser to RDF/XML though.
> I was looking at RDF::Core::Parser, but when I tried to use it on my
> FOAF, it died with:
> Element 'mbox' can not contain a literal value at line 9 at
> D:/Misc/Perl/site/lib/RDF/Core/Parser.pm line 863
it might be worth sending a report to the module maintainer at rt.cpan.org
if thats not the behaviour you expect
> At some point I'll probably want to be writing FOAF (automagically
> creating FOAF from scraping an HTML source), as well as parsing it.
i just use Template Toolkit templates to output RDF in XML, a very simple
approach but okay if you are not doing anything very generic.
"Common sense won't tell you. We have to tell each other." -DNA
More information about the foaf-dev