The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MooseX::Semantic::Role::RdfBackend - Associate a class with a RDF::Trine::Store

SYNOPSIS

# My/Model/Person.pm
package My::Model::Person;
use Moose;
with qw(MooseX::Semantic::Role::RdfBackend);
__PACKAGE__->rdf_store({
    storetype => 'DBI',
    name => 'semantic_moose',
    dsn => 'dbi:SQLite:dbname=t/data/semantic_moose.sqlite',
    username => 'FAKE',
    password => 'FAKE',
});
...

# your script
my $p = My::Model::Person->new( rdf_about => 'http://mydomain.org/data/John' );
$p->store();
my $x = My::Model::Person->new_from_store( 'http://mydomain.org/data/John' );
print $x->rdf_about     # prints "<http://mydomain.org/data/John>"

DESCRIPTION

CLASS ATTRIBUTES

rdf_store

Reference to a lazily built RDF::Trine::Store object. Can be instantiated with everything that RDF::Trine::Store's new method accepts, i.e. a DSN-like string, a hash reference of options or a blessed object.

METHODS

new_from_store

new_from_store( $uri )

Searches the RDF store for a resource $uri and tries to instantiate an object using the new_from_model method of MooseX::Semantic::Role::RdfImport.

store

Exports an instance to RDF into the model underlying the RDF store.

CONSUMED ROLES

MooseX::Semantic::Role::WithRdfType
MooseX::Semantic::Role::Resource

AUTHOR

Konstantin Baierer (<kba@cpan.org>)

SEE ALSO

MooseX::Semantic
RDF::Trine::Store

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.