RDF::T...r::RDFa(3pm)
β¨ RDF::TrineX::Parser::RDFa β¨
okay bestie, gather round π«Ά this is the User Contributed Perl Documentation page for RDF::TrineX::Parser::RDFa, and honestly? it's a glow-up story.
πΈ NAME πΈ
RDF::TrineX::Parser::RDFa β an RDF::Trine::Parser-compatible interface for RDF::RDFa::Parser. no cap, that's the whole vibe.
π DESCRIPTION π
So like... RDF::RDFa::Parser is a genuinely good RDFa parser. iconic behavior. BUT. its interface is a tad... shall we say... crufty. π
RDF::TrineX::Parser::RDFa swoops in with a much nicer interface, and β this is the main character detail β it's a subclass of RDF::Trine::Parser, so you get super-polymorphic benefits. Yay! π
π§ Class Method
parse_url_into_model($url, $model, %args)β just like the method of the same name inRDF::Trine::Parser: it grabs the URL and parses it into a model. BUT (and this is the twist) unlikeRDF::Trine::Parser, this one always assumes you're trying to parse some variety of RDFa. no guessing games, periodt.
π Constructor
new(%options)β constructs a brand newRDF::TrineX::Parser::RDFaparser. fresh out the box π
The two important options are flavour (which defaults to 'xhtml') and version (which defaults to '1.1'). Every other option is documented over in RDF::RDFa::Parser::Config.
Let's imagine you wanna parse RDFa 1.1 in HTML5, and you also wanna parse the "role", "longdesc" and "cite" attibutes (which are not strictly part of RDFa, but nevertheless often interesting β lowkey juicy, honestly). Then you'd use:
my $parser = RDF::TrineX::Parser::RDFa->new(
flavour => 'html5',
version => '1.1',
role_attr => 1,
longdesc_attr => 1,
cite_attr => 1,
);
π Object Methods
The following methods are supported, exactly as documented in RDF::Trine::Parser:
parse_into_model($base_uri, $data, $model [,context => $context])parse($base_uri, $data, \&handler)parse_file_into_model($base_uri, $fh, $model [,context => $context])parse_file($base_uri, $fh, \&handler)
And the following additional methods are supported too:
rdfa_flavourβ returns the RDFa host language being used. π¦rdfa_versionβ returns the RDFa version number being used. β
π Subclasses
The following subclasses of RDF::TrineX::Parser::RDFa exist:
RDF::TrineX::Parser::XHTML_RDFa10RDF::TrineX::Parser::HTML32_RDFa10RDF::TrineX::Parser::HTML4_RDFa10RDF::TrineX::Parser::HTML5_RDFa10RDF::TrineX::Parser::XHTML5_RDFa10RDF::TrineX::Parser::Atom_RDFa10RDF::TrineX::Parser::DataRSS_RDFa10RDF::TrineX::Parser::SVG_RDFa10RDF::TrineX::Parser::XML_RDFa10RDF::TrineX::Parser::OpenDocument_RDFa10RDF::TrineX::Parser::XHTML_RDFa11RDF::TrineX::Parser::HTML32_RDFa11RDF::TrineX::Parser::HTML4_RDFa11RDF::TrineX::Parser::HTML5_RDFa11RDF::TrineX::Parser::XHTML5_RDFa11RDF::TrineX::Parser::Atom_RDFa11RDF::TrineX::Parser::DataRSS_RDFa11RDF::TrineX::Parser::SVG_RDFa11RDF::TrineX::Parser::XML_RDFa11RDF::TrineX::Parser::OpenDocument_RDFa11
By using these classes, you can skip the need to pass the 'flavour' and 'version' options to the constructor. the way that saves you two whole lines... obsessed. For example:
my $parser = RDF::TrineX::Parser::HTML5_RDFa11->new(
role_attr => 1,
longdesc_attr => 1,
cite_attr => 1,
);
β οΈ real talk bestie: note that these are classes, but they are not modules. You should not attempt to load them withrequireoruse. do not do it. i'm begging. π
π₯ SEE ALSO π₯
RDF::Trine::ParserRDF::RDFa::ParserRDF::RDFa::Parser::Config- <http://www.perlrdf.org/>
- <http://rdfa.info/>
π«Ά AUTHOR π«Ά
Toby Inkster <tobyink@cpan.org>.
π COPYRIGHT AND LICENCE π
Copyright 2012 Toby Inkster
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
π DISCLAIMER OF WARRANTIES π
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
and that's the whole page, bestie πΈ this one came from perl v5.32.1, dated 2021-09-11, and it's filed as RDF::T...r::RDFa(3pm) β iykyk. go parse something cute π
β¨
π¦ where this page comes from
- debian bookworm: librdf-rdfa-parser-perl 1.097-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: librdf-rdfa-parser-perl 1.097-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: librdf-rdfa-parser-perl 1.097-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-rdfa-parser-perl 1.097-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: librdf-rdfa-parser-perl 1.097-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: librdf-rdfa-parser-perl 1.097-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms