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::RdfExport - Role for exporting Moose objects to RDF

SYNOPSIS

package My::Model::Person;
use Moose;
with qw(MooseX::Semantic::Role::RdfExport);
has name => (
    traits => ['Semantic'],
    is => 'rw',
    isa => 'Str',
    uri => 'http://xmlns.com/foaf/0.1/name',
    uri_writer => ['http://myont.org/onto#name'],
);
package main;
my $p = My::Model::Person->new(
    rdf_about => 'http://myont.org/data/John',
    name      => 'John'
);
print $p->export_to_string(format=>'turtle');
# <http://myont.org/data/John> <http://myont.org/onto#name>     "John"^^<http://www.w3.org/2001/XMLSchema#string> ;
#                              <http://xmlns.com/foaf/0.1/name> "John"^^<http://www.w3.org/2001/XMLSchema#string> .

METHODS

export_to_model

export_to_model($model, %opts)

Exports the object to RDF in model $model.

For %opts see "EXPORT OPTIONS" below.

export_to_string

export_to_string( %opts )

For %opts, see "EXPORT OPTIONS" below.

export_to_file

TODO

export_to_web

TODO

export_to_hash

TODO

rdf_serialize

TODO

EXPORT OPTIONS

format

Format string to be passed to RDF::Trine::Parser, e.g. turtle or rdfxml. Defaults to nquads.

serializer_opts

Additional options for the RDF::Trine::Serializer to be used.

context

Optional URI of the named graph this export should be exported into.

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.