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

RDF::aREF - Another RDF Encoding Form

SYNOPSIS

    use RDF::aREF;

    my $rdf = {
      _id       => 'http://example.com/people#alice',
      foaf_name => 'Alice Smith',
      foaf_age  => '42^xsd:integer',
      foaf_homepage => [
         { 
           _id => 'http://personal.example.org/',
           dct_modified => '2010-05-29^xsd:date',
         },
        'http://work.example.com/asmith/',
      ],
      foaf_knows => {
        dct_description => 'a nice guy@en',
      },
    };

    decode_aref( $rdf,
        callback => sub {
            my ($subject, $predicate, $object, $language, $datatype) = @_;
            ...
        }
    );
    
    my $model = RDF::Trine::Model->new;
    decode_aref( $rdf, callback => $model );
    print RDF::Trine::Serializer->new('Turtle')->serialize_model_to_string($model);

DESCRIPTION

aREF (another RDF Encoding Form) is an encoding of RDF graphs in form of arrays, hashes, and Unicode strings. This module implements decoding from aREF data to RDF triples.

See RDF::aREF::Decoder and RDF::aREF::Encoder for usage of this module.

EXPORTED FUNCTIONS

decode_aref( $aref, [ %options ] )

Decodes an aREF document given as hash referece. This function is a shortcut for

    RDF::aREF::Decoder->new(%options)->decode($aref)

See RDF::aREF::Decoder for possible options.

EXPORTABLE FUNCTIONS (experimental!)

aref_iri( [ $decoder ], $uri )

Encode an URI in aREF.

aref_get_literal( $string | \@strings )

Converts a list of aREF objects to plain strings by removing language tags or datatypes.

aref_get_resource( $string | \@strings ] )

Decodes one or more resources (URI references or blank nodes)

SEE ALSO

COPYRIGHT AND LICENSE

Copyright Jakob Voss, 2014-

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.