RDF::aREF::Query(3pm)
β¨ 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 ofRDF::aREF::Decoderthat 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 ofRDF::aREF::Decoderonly 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
- 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