RDF::R...:Config(3pm)
π NAME π
okay so this is RDF::RDFa::Parser::Config β it's the module that hands you configuration sets for the RDFa parser. that's it, that's the vibe. π
β¨ DESCRIPTION β¨
bestie, listen. when you build an RDF::RDFa::Parser object, the third argument you pass to the constructor is a configuration set. and guess what β this module is where those configuration sets come from. π¦
why do they even exist? because the parser has to know how to handle certain features, and those features vary depending on which host language you're in or which RDFa version you're doing. so like, it needs the tea. π
the constructor (the only thing you truly need)
$config = RDF::RDFa::Parser::Config->new($host, $version, %options);
$host is the host language. you'd normally pass one of these constants β and the default is HOST_XHTML. internet media types are accepted too (like 'text/html' or 'image/svg+xml'), but ngl it's usually better to use a constant, because some media types are shared (HTML4 and HTML5 both use the same media type, iykyk).
RDF::RDFa::Parser::Config->HOST_ATOMRDF::RDFa::Parser::Config->HOST_DATARSSRDF::RDFa::Parser::Config->HOST_HTML32RDF::RDFa::Parser::Config->HOST_HTML4RDF::RDFa::Parser::Config->HOST_HTML5RDF::RDFa::Parser::Config->HOST_OPENDOCUMENT_XMLβ flat XML, so like"FODT","FODS", etcRDF::RDFa::Parser::Config->HOST_OPENDOCUMENT_ZIPβ the zipped ones,"ODT","ODS", etcRDF::RDFa::Parser::Config->HOST_SVGRDF::RDFa::Parser::Config->HOST_XHTMLRDF::RDFa::Parser::Config->HOST_XHTML5RDF::RDFa::Parser::Config->HOST_XML
$version is the RDFa version. again, you'd generally supply one of these constants, and the default is RDFA_LATEST. π
RDF::RDFa::Parser::Config->RDFA_10RDF::RDFa::Parser::Config->RDFA_11RDF::RDFa::Parser::Config->RDFA_GUESSRDF::RDFa::Parser::Config->RDFA_LATEST
version guessing, because of course: the root element gets inspected for an attribute called 'version'. if that attribute exists and matches /\bRDFa\s+(\d+\.\d+)\b/i then that match is the version. otherwise, the latest version is assumed. periodt.
%options is a hash of extra options that override the defaults. and yeah, a lot of them are useful, but heads up β they probably also reduce conformance to the official RDFa specifications. π here's everything that exists; the defaults for XHTML+RDFa1.0 and XHTML+RDFa1.1 are chillin' in brackets.
alt_stylesheetβ the magicrel="alternate stylesheet". [0]atom_elementsβ process<feed>and<entry>specially. [0]atom_parserβ extract Atom 1.0 native semantics. [0]auto_configβ go look at the "Auto Config" section. [0]bookmark_start,bookmark_end,bookmark_nameβ elements to treat like OpenDocument's<text:bookmark-start>and<text:bookmark-end>element, plus the associatedtext:nameattribute. you have to set all three to actually use this feature. use Clark Notation to specify namespaces. [all undef]cite_attrβ support@cite. [0]datetime_attrβ support the@datetimeattribute and the HTML5<time>element. [0]default_profilesβ π¨ THIS OPTION IS NO LONGER SUPPORTED!dom_parserβ the parser used to turn a markup string into a DOM.'html','opendocument'(i.e. zipped XML) or'xml'. ['xml']embedded_rdfxmlβ find plain RDF/XML chunks inside the document.0=no,1=handle,2=skip. [0]full_urisβ support full URIs in CURIE-only attributes. [0, 1]graphβ turn on support for named graphs. [0]graph_attrβ the attribute to use for named graphs. use Clark Notation to specify a namespace. ['graph']graph_typeβ graph attribute behaviour, either'id'or'about'. ['about']graph_defaultβ default graph name. [undef]initial_contextβ space-separated list of URIs, which must be keys in%RDF::RDFa::Parser::InitialContext::Known. [?]inlist_attrβ support@inlist. [0, 1]longdesc_attrβ support@longdesc. [0]lwp_uaβ anLWP::UserAgentto use for HTTP requests. [undef]nsβ namespace for RDFa attributes. [undef]prefix_attrβ support@prefixinstead of just@xmlns:*. [0, 1]prefix_bareβ support CURIEs with no colon+suffix. [0]prefix_defaultβ URI for the default prefix (likerel=":foo"). ['http://www.w3.org/1999/xhtml/vocab#']prefix_nocaseβ DEPRECATED β it's just a shortcut forprefix_nocase_attrandprefix_nocase_xmlns.prefix_nocase_attrβ ignore case-sensitivity of CURIE prefixes defined via the@prefixattribute. [0, 1]prefix_nocase_xmlnsβ ignore case-sensitivity of CURIE prefixes defined via xmlns. [0, 1]profile_attrβ π¨ THIS OPTION IS NO LONGER SUPPORTED!profile_piβ π¨ THIS OPTION IS NO LONGER SUPPORTED!property_resourcesβ@propertyworks for resources. [0, 1]role_attrβ support for XHTML@role. [0]safe_anywhereβ allow Safe CURIEs in@rel/@rev/etc. [0, 1]safe_optionalβ allow Unsafe CURIEs in@about/@resource. [0, 1]skolemizeβ mint URIs instead of blank node identifiers. [0]src_sets_objectβ@srcsets the object URI (like@href). [0, 1]tdb_serviceβ use thing-described-by.org to name some bnodes. [0]typeof_resourcesβ allow@typeofto occasionally apply to objects rather than subjects. [0, 1]user_agentβ aUser-Agentheader to use for HTTP requests. ignored iflwp_uais provided. [undef]use_rtnlxβ useRDF::Trine::Node::Literal::XML.0=no,1=if available. [0]value_attrβ support the@valueattribute (like@content). [0]vocab_attrβ support@vocabfrom RDFa 1.1. [0, 1]vocab_defaultβ default vocab URI (likerel="foo"). [undef]vocab_tripleβ generate a triple from@vocab. [0, 1]xhtml_baseβ process the<base>element.0=no,1=yes,2=use it for RDF/XML too. [1]xhtml_elementsβ process<head>and<body>specially. (different special handling for XHTML+RDFa 1.0 and 1.1, btw.) [1, 2]xhtml_langβ support@langrather than just@xml:lang. [0]xml_baseβ support for the'xml:base'attribute.0=only RDF/XML;1=except@href/@src;2=always. [0]xml_langβ support for the'xml:lang'attribute. [1]xmllit_defaultβ generate XMLLiterals enthusiastically. [1, 0]xmllit_recurseβ look for RDFa inside XMLLiterals. [0, 1]xmlns_attrβ support for'xmlns:foo'to define CURIE prefixes. [1]
there's also an alternative constructor, tagsoup, which comes preloaded with a genuinely useful set of options for dealing with content "from the wild". π§
πΈ EXAMPLES πΈ
this full example parses RDFa 1.1 inside an Atom document, and it also flips on the non-default 'atom_parser' option so native Atom elements get parsed into the graph too. π
use RDF::RDFa::Parser;
$config = RDF::RDFa::Parser::Config->new(
RDF::RDFa::Parser::Config->HOST_ATOM,
RDF::RDFa::Parser::Config->RDFA_11,
atom_parser => 1,
);
$parser = RDF::RDFa::Parser->new_from_url($url, $config);
$data = $parser->graph;
this next configuration set parses XHTML+RDFa 1.1 while also parsing any RDF/XML chunks embedded in the document. two for one, we love to see it. β¨
use RDF::RDFa::Parser::Config qw(HOST_XHTML RDFA_11);
$config = RDF::RDFa::Parser::Config->new(
HOST_XHTML, RDFA_11, embedded_rdfxml=>1);
$parser = RDF::RDFa::Parser->new_from_url($url, $config);
$data = $parser->graph;
and this one? this one is the config for dealing with (X)HTML content from the wild. iconic. π¦
$config = RDF::RDFa::Parser::Config->tagsoup;
$parser = RDF::RDFa::Parser->new_from_url($url, $config);
$data = $parser->graph;
π SEE ALSO π
RDF::RDFa::Parser. that's the one. go read it. π«Ά
π AUTHOR π
Toby Inkster <tobyink@cpan.org>. king behaviour, honestly. π
π COPYRIGHT AND LICENCE π
Copyright 2008-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. so like, go off. π
β οΈ 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.
no cap, it's giving "you're on your own" and honestly? that's the whole disclaimer. π
and that's the page, bestie!! this was pulled from perl v5.32.1, dated 2021-09-11, and it lives in the RDF::RDFa::Parser::Config section 3pm of the User Contributed Perl Documentation. mwah, go configure 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