trusty (3) RDF::Helper::Object.3pm.gz

Provided by: librdf-helper-perl_2.0-1_all bug

NAME

       RDF::Helper::Object - Perl extension to use RDF property names as methods

SYNOPSIS

         use RDF::Helper;
         my $rdf = RDF::Helper->new(
             BaseInterface => 'RDF::Trine',
             namespaces => {
               dc => 'http://purl.org/dc/terms/',
               rdf => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
               '#default' => "http://xmlns.com/foaf/0.1/"
            }
         );
         my $obj = $rdf->get_object('http://dahut.pm.org/dahut_group.rdf#bender');
         $obj->rdf_type('http://xmlns.com/foaf/0.1/Person');
         $obj->name("Bender");
         $obj->dc_description("A description of Bender");
         print $rdf->serialize(format => 'rdfxml')

DESCRIPTION

       An object of this class is returned by the RDF::Helper "get_object" method, which takes a subject URI as
       the first argument, and optionally a hash or hashref of options as the second argument.

       On this object, you may then call methods that correspond to property names of the properties you want to
       get or set.

       For properties in the default namespace, you may use them without any regard to prefixes, whereas with
       properties in other namespaces, you need to use the prefix and an underscore before the property name.

       This class does not make any attempt to verify whether the methods are actually valid properties within
       the used schema, it just blindly does what you tell it to. It is suitable for creating relatively simple
       RDF.

       To set more than one object, use an arrayref as argument, e.g.

         $obj->rdfs_label(['Foo', 'Bar'])

       will result in two triples, one for each "rdfs:label".