NAME

MooseX::Semantic::Role::RdfImportAll - Import all resources from a RDF source

SYNOPSIS

# 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'

DESCRIPTION

METHODS

import_all

import_all( %opts )

For %opts see "IMPORT OPTIONS" below.

import_all_from_model

import_all_from_model( $model, %opts )

Imports all resources from $model.

For %opts see "IMPORT OPTIONS" below.

import_all_from_web

import_all_from_web( $uris, %opts )

TODO

For %opts see "IMPORT OPTIONS" below.

IMPORT OPTIONS

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.

AUTHOR

Konstantin Baierer (<kba@cpan.org>)

SEE ALSO

MooseX::Semantic

LICENCE AND COPYRIGHT

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.