|
NAMERDF::Trine - An RDF Framework for Perl VERSIONThis document describes RDF::Trine version 1.019 SYNOPSIS 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";
}
DESCRIPTIONRDF::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:
FUNCTIONS
BUGSPlease report any bugs or feature requests to through the GitHub web interface at <https://github.com/kasei/perlrdf/issues>. SEE ALSO<http://www.perlrdf.org/> AUTHORGregory Todd Williams "<gwilliams@cpan.org>" COPYRIGHTCopyright (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.
|