RDF::Trine(3pm)
β¨ 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 byRDF::Trine::Store,RDF::Trine::Model, andRDF::Query.RDF::Trine::Namespaceβ A convenience class for easily constructingRDF::Trine::Node::Resourceobjects from URI namespaces. π¦
π FUNCTIONS π
iri ( $iri )β Returns aRDF::Trine::Node::Resourceobject with the given IRI value. πblank ( $id )β Returns aRDF::Trine::Node::Blankobject with the given identifier.literal ( $value, $lang, $dt )β Returns aRDF::Trine::Node::Literalobject with the given value and optional language/datatype.variable ( $name )β Returns aRDF::Trine::Node::Variableobject with the given variable name.statement ( @nodes )β Returns aRDF::Trine::Statementobject with the supplied node objects.store ( $config )β Returns aRDF::Trine::Storeobject based on the supplied configuration string.default_useragent ( [ $ua ] )β Returns theLWP::UserAgentobject 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 β
go look. it's right there. iykyk.
π AUTHOR π
Gregory Todd Williams "<gwilliams@cpan.org>"
π COPYRIGHT π
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
- debian trixie: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: librdf-trine-perl 1.019-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: librdf-trine-perl 1.019-4 Β· 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