RDF::aREF(3pm)
π RDF::aREF π
okay bestie, gather round, because we're talking about RDF::aREF β that's Another RDF Encoding Form, from the User Contributed Perl Documentation β¨
β¨ NAME β¨
RDF::aREF β Another RDF Encoding Form. yes, that's the whole name, and yes, it's iconic π
πΈ SYNOPSIS πΈ
here's the vibe, no cap:
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;
likeβ¦ the whole graph in one little hash?? the way that just works π
π¦ DESCRIPTION π¦
aREF β short for another RDF Encoding Form (<http://gbv.github.io/aREF/>) β is a whole encoding of RDF graphs in the form of arrays, hashes, and Unicode strings. so like, your triples but make it cozy π«Ά
This module hands you the methods for:
- decoding from aREF data to RDF triples β that's
RDF::aREF::Decoder - encoding RDF data in aREF β that's
RDF::aREF::Encoder - querying parts of an RDF graph β that's
RDF::aREF::Query
three icons, one module, periodt β¨
π WARNING π
okay bestie, sit down, we need to talk. π
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!
fr fr, this is a real warning. aREF is a cute little vibe but JSON-LD is the main character now. use it. π
π EXPORTED FUNCTIONS π
The following functions are exported by default. so you don't even gotta ask, they just show up π
π decode_aref $aref [, %options ]
Decodes an aREF document given as a hash reference, using RDF::aREF::Decoder. π
Equivalent to:
RDF::aREF::Decoder->new(%options)->decode($aref)
π encode_aref $graph [, %options ]
Construct an aREF subject map from an RDF graph. πΈ
The RDF::aREF::Encoder for possible options. (yes, go look at that one for your options, bestie β this is your sign β¨)
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::Trineis installed) - instance of
Attean::API::TripleIterator(experimental) - instance of
Attean::API::TripleStore(experimental) - hash reference with RDF/JSON format (
<http://www.w3.org/TR/rdf-json/>) β as returned by methodas_hashrefinRDF::Trine::Model
not me listing six whole formats like a menu π two of them are experimental, iykyk π
π 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. so tidy. so clean. we love a flat structure π
π SEE ALSO π
- aREF is specified at
<http://github.com/gbv/aREF>. π - See
Catmandu::RDFfor an application of this module. π - See
RDF::Trinefor more elaborated handling of RDF data in Perl. π - See
RDF::YAMLfor 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. π
and that's the whole page bestie!! πβ¨ this one shipped as part of perl v5.36.0, dated 2022-12-07 β yeah it's giving vintage but it still ate π π«Ά go forth and encode responsibly, mwah π
π¦ where this page comes from
- debian bookworm: librdf-aref-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: librdf-aref-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-aref-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: librdf-aref-perl 0.28-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms