MooseX::Semantic::Role::RdfImportAll - Import all resources from a RDF source
# multiple_persons.ttl @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix schema: <http://schema.org/> . <alice> a foaf:Person ; foaf:name "Alice" . <bob> a schema:Person ; foaf:name "Bob" . # My/Model/Person.pm package My::Model::Person; use Moose; with qw( MooseX::Semantic::Role::RdfImportAll MooseX::Semantic::Role::WithRdfType ); __PACKAGE__->rdf_type([qw{http://xmlns.com/foaf/0.1/Person http://schema.org/Person}]); has name => ( is => 'rw', traits => ['Semantic'], uri => 'http://xmlns.com/foaf/0.1/name', uri_reader => [qw(http://schema.org/name)] ); ... # your script my $model = RDF::Trine::Model->new; RDF::Trine::Parser::Turtle->new->parse_file_into_model( 'http://example.com/', 'multiple_persons.ttl', $model ); my @people = My::Model::Person->import_all_from_model($model); print $people[0]->name; # prints 'Alice' print $people[1]->name; # prints 'Bob'
import_all( %opts )
For %opts see "IMPORT OPTIONS" below.
%opts
import_all_from_model( $model, %opts )
Imports all resources from $model.
$model
import_all_from_web( $uris, %opts )
TODO
rdf_type
Additional rdf:types
model
The model to import from
uris
uri
An array reference of URIs to import
skip_blank
If set to true, blank nodes (i.e. resources without a URI) are skipped.
Konstantin Baierer (<kba@cpan.org>)
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perldoc perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install MooseX::Semantic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::Semantic
CPAN shell
perl -MCPAN -e shell install MooseX::Semantic
For more information on module installation, please visit the detailed CPAN module installation guide.