RDF::aREF::Query(3pm)

πŸ“¦
version 0.28 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

✨ RDF::aREF::Query πŸ’…

okay bestie, welcome to RDF::aREF::Query β€” a lil Perl module (from the User Contributed Perl Documentation, iykyk) that's literally just the aREF query expression. she's small, she's focused, she slays. let's get into it πŸŽ€


🌸 NAME 🌸

RDF::aREF::Query β€” aREF query expression. that's it, that's the whole vibe. πŸ’–


✨ SYNOPSIS ✨

okay so here's the whole thing in action, no cap:

my $rdf = {
    'http://example.org/book' => {
        dct_creator => [
            'http://example.org/alice',
            'http://example.org/bob'
        ]
    },
    'http://example.org/alice' => {
        foaf_name => "Alice"
    },
    'http://example.org/bob' => {
        foaf_name => "Bob"
    }
};

my $getnames = RDF::aREF::Query->new(
    query => 'dct_creator.foaf_name'
);
my @names = $getnames->apply( $rdf, 'http://example.org/boo' );
$getnames->query; # 'dct_creator.foaf_name'

use RDF::aREF qw(aref_query_map);
my $record = aref_query_map( $rdf, $publication, {
    'dct_creator@' => 'creator',
    'dct_creator.foaf_name' => 'creator',
});

like, you build the object, you apply it, you get names. main character energy fr fr. πŸ¦‹


πŸ’œ DESCRIPTION πŸ’œ

so this module implements the aREF query (http://gbv.github.io/aREF/aREF.html#aref-query) β€” which is, like, a whole query language for reaching into a given RDF graph and pulling out strings and nodes. it's giving "treasure hunt but make it triples". πŸ‘‘

also! if you want the convenient application of all this, peep the functions aref_query and aref_query_map in RDF::aREF. they're the shortcut besties. 🫢


πŸŽ€ CONFIGURATION πŸŽ€

when you call the constructor, she expects these options, mkay:

  • query β€” the aREF query expression (http://gbv.github.io/aREF/aREF.html#aref-query). this is the actual thing you're asking for. the moment. πŸ’…
  • decoder β€” an instance of RDF::aREF::Decoder that maps qNames to URIs. if you don't hand one over, a brand new instance gets created for you. no decoder, no problem. ✨
  • ns β€” an optional namespace map (RDF::NS). this gets passed to the constructor of RDF::aREF::Decoder only if no decoder was given. so like, don't bother if you already brought your own decoder, she'll ignore it. πŸ™ˆ

πŸ¦‹ METHODS πŸ¦‹

apply( $graph [, $origin ] )

run the query against a given RDF graph, bestie. the graph can come in as either:

  • an aREF structure (that's a subject map or a predicate map), or
  • an instance of RDF::Trine::Model.
⚠️ heads up: you must provide an origin subject node β€” unless the RDF graph came in as a predicate map (http://gbv.github.io/aREF/aREF.html#predicate-maps). don't forget it, she will not be happy. 😭

query

returns the aREF query expression. literally just hands you back the thing you asked for. iconic. πŸ’–


🌈 SEE ALSO 🌈

if your queries are getting, like, a lot β€” more complex than this module wants to deal with β€” use SPARQL instead, for example with RDF::Trine::Store::SPARQL. she knows her limits and honestly? we respect that. πŸ‘‘


and that's the whole page, bestie!! this one's from perl v5.36.0, dated 2022-12-07, and it's RDF::aREF::Query(3pm) β€” go forth and query slay πŸ’…βœ¨πŸŒΈπŸ’–

πŸ“¦ where this page comes from