RDF::R...Parser(3pm)

✨ RDF::R...Parser πŸ’… (it's the RDF::Redland::Parser page, bestie)

okay so you found the RDF::R...Parser manpage in the User Contributed Perl Documentation section and I'm SO glad you're here 🫢 this is the whole thing, every single crumb, no skips.


🌸 NAME

RDF::Redland::Parser β€” the Redland RDF Syntax Parsers Class, aka the girl who takes your weird RDF syntax and turns it into actual statements πŸ’–


πŸŽ€ SYNOPSIS

use RDF::Redland;

...
my $parser=new RDF::Redland::Parser("rdfxml");
my $parser2=new RDF::Redland::Parser(undef, "application/rdf+xml);

# Return as an RDF::Redland::Stream
my $stream=$parser->parse_as_stream($source_uri, $base_uri);

# Store in an RDF::Redland::Model
$parser->parse_into_model($source_uri, $base_uri, $model);

πŸ¦‹ DESCRIPTION

so basically, this class is the parser representation moment ✨ It handles a bunch of different syntaxes, and it can hand you back an RDF model in two iconic ways:

  • as an RDF::Redland::Stream full of RDF::Redland::Statement objects, or
  • straight into an RDF::Redland::Model object.

that's it, that's the whole vibe. slay.


πŸ‘‘ CONSTRUCTORS

  • new [NAME [MIME_TYPE [URI]]] β€” makes you a brand new RDF::Redland::Parser object for a syntax parser named NAME, with MIME Type MIME_TYPE and/or URI URI. literally any of those fields can be undef or just... not there. And if you omit all of them? it requests a parser that provides MIME Type application/rdf+xml. no notes πŸ’…

🌈 METHODS

  • parse_as_stream SOURCE_URI BASE_URI β€” parses the syntax living at the RDF::Redland::URI SOURCE_URI, with an optional base RDF::Redland::URI BASE_URI. If you give it a base URI, the content gets parsed as if it was chillin' at the base URI instead of the source URI. Returns an RDF::Redland::Stream of RDF::Redland::Statement objects, or undef on failure 😭 lowkey rude of it but that's the deal.
  • parse_into_model SOURCE_URI BASE_URI MODEL [HANDLER] β€” parses the syntax at the RDF::Redland::URI SOURCE_URI with optional base RDF::Redland::URI BASE_URI, and yeets it into RDF::Redland::Model MODEL. Same base-URI situation as above: if the base URI is given, the content is parsed as if it was at the base URI rather than the source URI.

If you pass the optional HANDLER, it's a reference to a sub with this exact signature:

sub handler($$$$$$$$$) {
  my($code, $level, $facility, $message, $line, $column, $byte,
$file, $uri)=@_;
  ...
}

and that sub receives errors in parsing 🫢 (nine whole args, she's doing the most, but valid.)

  • parse_string_as_stream STRING BASE_URI β€” parses the syntax inside STRING with a required base RDF::Redland::URI BASE_URI. Returns an RDF::Redland::Stream of RDF::Redland::Statement objects, or undef on failure. bestie the base URI here is required, don't forget it πŸ™ˆ
  • parse_string_into_model STRING BASE_URI MODEL [HANDLER] β€” parses the syntax in STRING with required base RDF::Redland::URI BASE_URI into RDF::Redfland::Model MODEL. (yes, that's exactly how it's spelled on the page, Redfland, iconic typo, we keep it fr fr.)

If you pass the optional HANDLER, it's a reference to a sub with this signature:

sub handler($$$$$$$$$) {
  my($code, $level, $facility, $message, $line, $column, $byte,
$file, $uri)=@_;
  ...
}

which receives errors in parsing πŸ’œ

  • feature URI [VALUE] β€” get/set a parser feature, main character energy. The feature is named via RDF::Redland::URI URI and the value is a RDF::Redland::Node. If you hand over VALUE, the feature gets set to that value. Otherwise? the current value comes back to you πŸŽ€
  • namespaces_seen β€” gets you the set of namespace declarations seen during parsing, as a hash. Key: the prefix string (and yes, it may be ''). Value: RDF::Redland::URI objects. obsessed.

πŸ”₯ SEE ALSO

  • RDF::Redland::URI

πŸ“ AUTHOR

Dave Beckett β€” http://www.dajobe.org/ πŸ‘‘


bestie reminder: perl v5.42.3, dated 2026-08-20, and this whole page is RDF::R...Parser(3pm) from the User Contributed Perl Documentation. go forth and parse, you absolute legend πŸŒŸπŸ’–
πŸ“¦ where this page comes from