RDF::Trine(3pm) | User Contributed Perl Documentation | RDF::Trine(3pm) |
RDF::Trine - An RDF Framework for Perl
This document describes RDF::Trine version 1.019
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"; }
RDF::Trine provides an Resource Descriptive Framework (RDF) with an emphasis on extensibility, API stability, and the presence of a test suite. The package consists of several components:
If $ua is passed as an argument, sets the global default user agent to this object.
Please report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>.
<http://www.perlrdf.org/>
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.
2022-12-12 | perl v5.36.0 |