RDFa linting/validation

Toby Inkster tai at g5n.co.uk
Thu May 6 00:55:23 CEST 2010


On Wed, 5 May 2010 14:30:59 +0100
Toby Inkster <tai at g5n.co.uk> wrote:

> 3. We need RDF::RDFa::Writer::Pretty to take an RDF graph and write it
> out as pretty, human-readable RDFa. As well as the graph, it should be
> able to take a collection of warnings (each of which has a subject
> resource URI or bnode identifier associated with it), and include them
> in the output.

I've started work on some RDFa output modules. Assuming that $dom
contains an XML::LibXML::Document representing an XHTML document,
and $model contains your data, then:

	$gen = RDF::RDFa::Generator::HTML::Hidden->new;
	@bodies = $dom->getElementsByTagName[0];
	foreach my $node ($gen->nodes($model))
	{
		$bodies[0]->addChild($node);
	}

Will add the RDFa as hidden elements in your document body. Or for the
head:

	$gen = RDF::RDFa::Generator::HTML::Head->new;
	@heads = $dom->getElementsByTagName[0];
	foreach my $node ($gen->nodes($model))
	{
		$heads[0]->addChild($node);
	}

Plans are to create a module RDF::RDFa::Generator which wraps the
different generators and provides some convenience methods; and to
create an RDF::RDFa::Generator::HTML::Pretty for visible output.
Possibly also a couple of modules to add RDFa to SVG and Atom documents.

-- 
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>


More information about the Dev mailing list