RDFLib/rdflib — Issue #189: Add RDFa 1.1 parser
Author: gjhiggins
Created: 2012-02-20 08:34:45+00:00
State: open

gromgull, 2012-01-19T12:59:26.000Z

Ivan Herman maintains a RDFa distiller written in python, see bottom of this page:

http://www.w3.org/2007/08/pyRdfa/Shadow.html

This implements the latest version of the spec.

It would be nice if we could integrate this into rdflib somehow. The current RDFa parser we have is also written by Ivan, but was copy/pasted and changed when moved into rdflib, so we lost the ability to get updates.

RDFa 1.1 is not yet 100% stable, so a way to integrate that does not require doing it all again by hand in a few months would be good!

Ivan says the new parser is backwards compatible, so it could replace the old one. Also:

"[...] the new library is more complex than the old one, which may make it a bit more complex. It does a better job in looking at HTTP headers, which the old one did not, and that is an extra possible point of clash; there is a caching mechanism built in for @vocab management that needs some thoughts, it has its own serializers for json-ld..."

Also see #swig discussion:

http://chatlogs.planetrdf.com/swig/2012-01-19#T12-40-57

Comment 1 by gjhigg...@gmail.com
This raises some knotty problems. pyRdfa's current dependencies will pose problems for rdflib support.

1. html5lib is incompatible with Python 2.4/2.5 because of its use of "if" ternaries. This dependency currently applies to rdflib 3.2.X but is dormant until runtime when, if the parsing drops through to "lax", it causes Exceptions for those RHEL/CentOs users who are obliged to stick to the supported OS Python2.4 distro - I'd say that the RDFa parser is pretty much unusable under Python<2.6. Judging by the pyRdfa code, html5lib has now become a primary dependency which will need to be specified in rdflib's setup.py. One alternative would be to drop rdflib support for Python 2.4/2.5.

2. Neither httpheaders.py nor odict.py have been ported to Python 3. This issue might be finessed away by switching to WebOb: its MultiDict also behaves as an OrderedDict and WebOb may be able to handle the header parsing --- and if not, the WebOb folks may welcome a contribution to this effect.

3. I didn't see anything in the discussions about porting pyRdfa itself to Python 2/3 and couldn't help wondering if rdflib's recent development in this area has maybe slipped under the radar (maybe we should knock up some blog/socialnet posts to increase awareness of Thomas' py3 port). It could turn out to be a real PITA if there's no corresponding upstream port.