RDF::LinkedData(3pm)
π RDF::LinkedData β a Perl manual page, but make it slay π
okay bestie, sit down, hydrate, because we're about to talk about RDF::LinkedData, a Linked Data server implementation from the User Contributed Perl Documentation corner of the universe. no cap, this one's a whole vibe. π¦
β¨ VERSION β¨
Version 1.940 β yes she has a version number, she's got receipts, she's legit. π
πΈ SYNOPSIS πΈ
okay so if you just wanna set this up and get it to run, the move is to use the linked_data.psgi script that ships in this distribution. that's it. that's the whole assignment. the usage of that script is documented over in Plack::App::RDF::LinkedData, and the README is your quick start guide, your little map, your GPS. πΊοΈβ¨
but if you're feeling brave and want to use this directly, you'd do stuff like:
my $ld = RDF::LinkedData->new(store => $config->{store},
endpoint_config => $config->{endpoint},
base_uri => $config->{base_uri}
);
$ld->namespaces($config->{namespaces}) if ($config->{namespaces});
$ld->request($req);
return $ld->response($uri)->finalize;
and for a complete example, go look at Plack::App::RDF::LinkedData. she's got the full picture. π
π DESCRIPTION π
so what even is this. this module is used to create a Linked Data server that can serve RDF data out of an RDF::Trine::Model. it will look up URIs in the model and do the right thing (iconically known as the 303 dance π) and mint URLs for that, and it also does content negotiation. so basically you can concentrate on URIs for your things, and you do NOT need to be concerned about minting URLs for the pages that serve it. the pressure is off. you're free. ποΈ
on top of that, optional modules can provide other important functionality, like:
- Cross-origin resource sharing
- VoID description
- cache headers
- SPARQL Endpoint
- Triple Pattern Fragments
- etc.
so yeah, it encompasses a fair share of Semantic Web best practices, but possibly not in a very flexible "Big Data" manner. it's giving "does the thing beautifully, doesn't do the infinite-scale thing". π€·ββοΈ
π METHODS π
new ( store => $store, model => $model, base_uri => $base_uri, hypermedia => 1, namespaces_as_vocabularies => 1, request => $request, endpoint_config => $endpoint_config, void_config => $void_config, writes_enabled => 0 )
creates a new handler object based on the named parameters, given a store config (the recommended usage is to pass a hashref of the type that can be passed to RDF::Trine::Store->new_with_config, but a simple string can also be used) or a model and a base URI.
optionally, you may pass a Plack::Request object (which must be passed before you call "content", so don't be late bestie, timing matters) and an "endpoint_config" hashref if you want to have a SPARQL Endpoint running using the recommended module RDF::Endpoint.
this module can also provide additional triples to turn the response into a hypermedia type. if you don't want that, set the "hypermedia" argument to false. currently this entails setting the SPARQL endpoint and vocabularies used using the VoID vocabulary <http://vocab.deri.ie/void>.
finally, it can provide experimental Triple Pattern Fragments <http://www.hydra-cg.com/spec/latest/triple-pattern-fragments/> support. β¨
Read-write support is even MORE experimental, and is provided by RDF::LinkedData::RWHypermedia. like, proceed with your whole chest but know what you're doing. π
"BUILD"
Called by Moo to initialize an object. she's just doing her little setup routine. π
"BUILDARGS"
Called by Moo to ensure that some attributes can be left unset. flexible queen. π«Ά
"model"
The model that contains the entire database of linked data. This method returns a RDF::Trine::Model object.
"response_model"
This model contains response, it is used to build the response to one particular request. This method returns a RDF::Trine::Model object of a temporary model.
"base_uri"
Returns or sets the base URI for this handler.
"writes_enabled"
Attribute that indicates whether write operations are permitted.
"does_read_operation"
Returns or sets whether the current request is a read operation.
"request ( [ $request ] )"
Returns the Plack::Request object, if it exists; or sets it if a Plack::Request object is given as parameter.
"current_etag"
Returns the current Etag of the model suitable for use in a HTTP header. This is a read-only attribute. look but don't touch. π
"last_etag", "has_last_etag"
Returns or sets the last Etag of so that changes to the model can be detected. (yes, the original says "the last Etag of so that", we are not fixing the queen's grammar, we are respecting her.) π
namespaces ( $namespace_map )
Gets or sets the namespaces that some serializers use for pretty-printing. Should be handed a URI::NamespaceMap object.
"response ( $uri )"
Will look up what to do with the given URI object and populate the response object. the main character method, honestly. π
"helper_properties ( )"
Returns the RDF::Helper::Properties object. if it exists; or sets it if an RDF::Helper::Properties object is given as a parameter.
"type"
Returns or sets the type of result to return, i.e. "page", in the case of a human-intended page or "data" for machine consumption, or an empty string if it is an actual resource URI that should be redirected.
"my_node"
A node for the requested URI. This node is typically used as the subject to find which statements to return as data. This expects to get a URI object containing the full URI of the node.
"count ( $node)"
Returns the number of statements that has the $node as subject, or all if $node is undef.
"endpoint ( [ $endpoint ] )"
Returns the RDF::Endpoint object if it exists or sets it if a RDF::Endpoint object is given as parameter. In most cases, it will be created for you if you pass a "endpoint_config" hashref to the constructor, so you would most likely not use this method. she auto-assembles herself. β¨
"void ( [ $voidg ] )"
Returns the RDF::Generator::Void object, if it exists; or sets it if an RDF::Generator::Void object is given as parameter. Like "endpoint", it will be created for you if you pass a "void_config" hashref to the constructor, so you would most likely not use this method.
π AUTHOR π
Kjetil Kjernsmo, "<kjetilk@cpan.org>"
π«Ά CONTRIBUTORS π«Ά
Toby Inkster
π BUGS π
Please report any bugs using github <https://github.com/kjetilk/RDF-LinkedData/issues>
π SUPPORT π
You can find documentation for this module with the perldoc command.
perldoc RDF::LinkedData
The perlrdf IRC channel is the right place to seek help and discuss this module:
<irc://irc.perl.org/#perlrdf>
π TODO π
This module does what it is supposed to do rather well and has thus reached the 1.0 milestone. To support a wider variety of use cases, the current module isn't flexible enough, so future versions will need substantial changes, but the version number is intended to reflect that. she's honest about her growth arc. π±
π ACKNOWLEDGMENTS π
This module was started by Gregory Todd Williams "<gwilliams@cpan.org>" for RDF::LinkedData::Apache, but has been almost totally rewritten. glow-up of the century, honestly. π
β¨
βοΈ COPYRIGHT & LICENSE βοΈ
Copyright 2010 Gregory Todd Williams
Copyright 2010 ABC Startsiden AS
Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kjetil Kjernsmo
This program 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 was RDF::LinkedData, served up by perl v5.36.0, dated 2023-09-04. go forth and mint those URLs, you absolute legend. π¦π
π¦ where this page comes from
- debian trixie: librdf-linkeddata-perl 1.940-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-linkeddata-perl 1.940-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: librdf-linkeddata-perl 1.940-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: librdf-linkeddata-perl 1.940-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms