File: README

package info (click to toggle)
librdf-aref-perl 0.28-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 464 kB
  • sloc: perl: 729; sh: 6; makefile: 2
file content (112 lines) | stat: -rw-r--r-- 3,449 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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 @lastmod = aref_query $rdf, 'foaf_homepage.dct_modified^';
    
        my $model = RDF::Trine::Model->new;
        decode_aref( $rdf, callback => $model );
        print RDF::Trine::Serializer->new('Turtle')->serialize_model_to_string($model);
    
        my $model = RDF::Trine::Model->new;
        RDF::Trine::Parser->parse_url_into_model($url, $model);
        my $aref = encode_aref $model;

DESCRIPTION

    aREF (another RDF Encoding Form <http://gbv.github.io/aREF/>) is an
    encoding of RDF graphs in form of arrays, hashes, and Unicode strings.
    This module provides methods for decoding from aREF data to RDF triples
    (RDF::aREF::Decoder), for encoding RDF data in aREF
    (RDF::aREF::Encoder), and for querying parts of an RDF graph
    (RDF::aREF::Query).

WARNING

    aREF has been an attempt to solve problems that meanwhile have largely
    been solved by JSON-LD <https://json-ld.org/>. Despite aRef having its
    own benefits, please consider using a more established technology
    (JSON-LD) instead!

EXPORTED FUNCTIONS

    The following functions are exported by default.

 decode_aref $aref [, %options ]

    Decodes an aREF document given as hash reference with
    RDF::aREF::Decoder. Equivalent to
    RDF::aREF::Decoder->new(%options)->decode($aref).

 encode_aref $graph [, %options ]

    Construct an aREF subject mapfrom an RDF graph. The RDF::aREF::Encoder
    for possible options. The $graph can be supplied as:

      * instance of RDF::Trine::Model

      * instance of RDF::Trine::Model::Iterator

      * an URL or a filename (only if RDF::Trine is installed)

      * instance of Attean::API::TripleIterator (experimental)

      * instance of Attean::API::TripleStore (experimental)

      * hash reference with RDF/JSON <http://www.w3.org/TR/rdf-json/>
      format (as returned by method as_hashref in RDF::Trine::Model)

 aref_query $graph, [ $origin ], @queries

    Query parts of an aREF data structure by aREF query expressions
    <http://gbv.github.io/aREF/aREF.html#aref-query> and return a list. See
    RDF::aREF::Query for details.

 aref_query_map( $graph, [ $origin ], $query_map )

    Map parts of an aREF data structure to a flat key-value structure.

SEE ALSO

      * aREF is specified at http://github.com/gbv/aREF.

      * See Catmandu::RDF for an application of this module.

      * Usee RDF::Trine for more elaborated handling of RDF data in Perl.

      * See RDF::YAML for a similar (outdated) RDF encoding in YAML.

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.