RDF::Trine(3pm)

πŸ“¦
version 1.019 Β· 7 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ RDF::Trine ✨

okay bestie, welcome to RDF::Trine(3pm) β€” the User Contributed Perl Documentation page that's about to make RDF make sense πŸ’… (well, as much as RDF ever makes sense, which is a whole vibe of its own).


🌸 NAME 🌸

RDF::Trine β€” An RDF Framework for Perl πŸ¦‹

like… an actual whole framework. for perl. for RDF. iconic behavior, honestly.


πŸŽ€ VERSION πŸŽ€

This document describes RDF::Trine version 1.019 ✨


πŸ’– SYNOPSIS πŸ’–

here's the whole thing, verbatim, no cap:

  use RDF::Trine;

  my $store = RDF::Trine::Store::Memory->new();
  my $model = RDF::Trine::Model->new($store);

  # parse some web data into the model, and print the count of resulting RDF statements
  RDF::Trine::Parser->parse_url_into_model( 'http://kasei.us/about/foaf.xrdf', $model );
  print $model->size . " RDF statements parsed\n";

  # Create a namespace object for the foaf vocabulary
  my $foaf = RDF::Trine::Namespace->new( 'http://xmlns.com/foaf/0.1/' );

  # Create a node object for the FOAF name property
  my $pred = $foaf->name;
  # alternatively:
  # my $pred = RDF::Trine::Node::Resource->new('http://xmlns.com/foaf/0.1/name');

  # Create an iterator for all the statements in the model with foaf:name as the predicate
  my $iter = $model->get_statements(undef, $pred, undef);

  # Now print the results
  print "Names of things:\n";
  while (my $st = $iter->next) {
    my $s = $st->subject;
    my $name = $st->object;

    # $s and $name have string overloading, so will print correctly
    print "The name of $s is $name\n";
  }

like the way you just make a store, make a model, slurp a URL into it and print names?? it's giving "actually pleasant API" πŸ”₯


🌈 DESCRIPTION 🌈

So RDF::Trine gives you a Resource Descriptive Framework (RDF) with an emphasis on extensibility, API stability, and β€” plot twist β€” the presence of an actual test suite 😭 (revolutionary, we know).

The package is made of several components, and each one is kinda its own little main character:

  • RDF::Trine::Model β€” RDF model providing access to a triple store. This module would typically be used to access an existing store by a developer looking to "Just get stuff done." πŸ’…
  • RDF::Trine::Parser β€” RDF parsers for various serialization formats including RDF/XML, Turtle, RDFa, and RDF/JSON.
  • RDF::Trine::Store::Memory β€” An in-memory, non-persistant triple store. Typically used for temporary data. (yes, "non-persistant" β€” that's how it's spelled here, we don't gatekeep 🫢)
  • RDF::Trine::Store::DBI β€” A triple store for MySQL, PostgreSQL, and SQLite, based on the relational schema used by Redland. Typically used to for large, persistent data.
  • RDF::Trine::Iterator β€” Iterator classes for variable bindings and RDF statements, used by RDF::Trine::Store, RDF::Trine::Model, and RDF::Query.
  • RDF::Trine::Namespace β€” A convenience class for easily constructing RDF::Trine::Node::Resource objects from URI namespaces. πŸ¦‹

πŸ’… FUNCTIONS πŸ’…

  • iri ( $iri ) β€” Returns a RDF::Trine::Node::Resource object with the given IRI value. 🌟
  • blank ( $id ) β€” Returns a RDF::Trine::Node::Blank object with the given identifier.
  • literal ( $value, $lang, $dt ) β€” Returns a RDF::Trine::Node::Literal object with the given value and optional language/datatype.
  • variable ( $name ) β€” Returns a RDF::Trine::Node::Variable object with the given variable name.
  • statement ( @nodes ) β€” Returns a RDF::Trine::Statement object with the supplied node objects.
  • store ( $config ) β€” Returns a RDF::Trine::Store object based on the supplied configuration string.
  • default_useragent ( [ $ua ] ) β€” Returns the LWP::UserAgent object used by default for any operation requiring network requests.

Ordinarily, the calling code will obtain the default user agent, and clone it before further configuring it for a specific request, thus leaving the default object untouched. 🧚 (clone first, bestie β€” don't be out here mutating the global default πŸ™ˆ)

If $ua is passed as an argument, sets the global default user agent to this object.


😭 BUGS 😭

Please report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>.

(and yes, the original really does say "report … to through" β€” we're not fixing it, we're just acknowledging it, periodt πŸ’€)


⭐ SEE ALSO ⭐

<http://www.perlrdf.org/>

go look. it's right there. iykyk.


πŸ‘‘ AUTHOR πŸ‘‘

Gregory Todd Williams "<gwilliams@cpan.org>"


Copyright (c) 2006-2012 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole page, you ate that 🫢 This is perl v5.38.2, dated 2024-01-13, and that's the RDF::Trine(3pm) footer energy β€” go forth and triple-store, bestie πŸ’œβœ¨

πŸ“¦ where this page comes from