RDF::Endpoint(3pm)

πŸ“¦
version 0.11 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– RDF::Endpoint πŸ’–

okay bestie, gather round, because this is the RDF::Endpoint manual page from User Contributed Perl Documentation and it's literally the blueprint for a SPARQL Protocol Endpoint and you're gonna understand every word of it, no cap 🫢


✨ NAME ✨

RDF::Endpoint β€” a whole SPARQL Protocol Endpoint implementation, as a treat πŸ’…


🌸 VERSION 🌸

This doc is describing RDF::Endpoint version 0.11. periodt.


πŸŽ€ SYNOPSIS πŸŽ€

the way you just... run it:

plackup /usr/local/bin/endpoint.psgi

that's it. that's the whole vibe check. go off πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module implements the SPARQL Protocol for RDF using the PSGI interface that Plack hands you. it can be run with any Plack handler β€” any of them, iconic behavior. if you wanna know more about that whole situation, go peek at Plack::Handler.

when you use this module to spin up a SPARQL endpoint, the configuration variables get loaded via Config::ZOMG. there's an example config file, rdf_endpoint.json, shipped right inside this package, so you're not out here guessing. the valid top-level configuration keys are:

  • store β€” defines the underlying RDF::Trine::Store for the endpoint. it can be a hashref of the kind you'd hand to RDF::Trine::Store->new_with_config, but ngl a plain simple string works too. flexible queen ✨
  • endpoint β€” a hash of endpoint-specific config variables. the valid keys inside this hash are:
    • update β€” a boolean that says whether Update operations are allowed to be executed by the endpoint. lowercase: can this endpoint be changed? 😳
    • load_data β€” a boolean that says whether the endpoint should use the URLs showing up in FROM and FROM NAMED clauses to construct a SPARQL dataset, by dereferencing those URLs and loading up whatever RDF content comes back.
    • service_description β€” an associative array (a hash) with the details on which info and how much info goes into the service description the endpoint hands out when no query is included for execution. the boolean values 'default' and 'named_graphs' indicate that the respective SPARQL dataset graphs should be described by the service description. so cute, so informative πŸ₯°
    • html β€” an associative array (a hash) with the details on how results should be serialized when the output media type is HTML. the boolean value 'resource_links' specifies whether URI values get serialized as HTML anchors (you know, links). the boolean value 'embed_images' specifies whether URI values typed as foaf:Image get serialized as HTML images. and if 'embed_images' is true, the integer value 'image_width' says what image width to use in the HTML markup β€” and it lets the image height scale appropriately, because we respect aspect ratios in this household πŸ’…

🌈 EXAMPLE CONFIGURATIONS 🌈

🧚 Using Plack::Handler::Apache2 🧚

using Plack::Handler::Apache2, you can configure mod_perl2 to serve an endpoint with the following configuration:

<Location /sparql>
  SetHandler perl-script
  PerlResponseHandler Plack::Handler::Apache2
  PerlSetVar psgi_app /path/to/endpoint.psgi
  PerlSetEnv RDF_ENDPOINT_CONFIG /path/to/rdf_endpoint.json
</Location>

and if you want syntax highlighting and other pretty pretty features, drop these three aliases into the VirtualHost section of your server:

Alias /js/ /path/to/share/www/js/
Alias /favicon.ico /path/to/share/www/favicon.ico
Alias /css/ /path/to/share/www/css/

how do you find the exact location? by finding where the file "sparql_form.js" lives. that's your little treasure map πŸ—ΊοΈβœ¨


πŸ’œ METHODS πŸ’œ

  • new ( \%conf )
  • new ( $model, \%conf )

returns a fresh new Endpoint object. \%conf should be a HASH reference full of configuration settings. two ways to call it, both slay.

  • run ( $req )

handles the request specified by the supplied Plack::Request object, and returns an appropriate Plack::Response object. in and out, baby 🫢

  • run_tag

returns a unique key for each instantiation of this service. every instance gets its own little name tag 🏷️

  • service_description ( $request, $model )

returns a brand-new RDF::Trine::Model object holding a service description of this endpoint, generating dataset statistics from $model. main character energy fr fr πŸ‘‘


⭐ SEE ALSO ⭐

(that IRC one is a whole hangout spot, iykyk πŸ’¬)


πŸ‘‘ AUTHOR πŸ‘‘

Gregory Todd Williams <gwilliams@cpan.org>


copyright (c) 2010-2014 Gregory Todd Williams.

this software is provided 'as-is', without any express or implied warranty. in no event will the authors be held liable for any damages arising from the use of this software. (translation: it's free, be normal about it πŸ™ˆ)

permission is granted to anyone to use this software for any purpose β€” including commercial applications β€” and to alter it and redistribute it freely, subject to the following restrictions:

  1. the origin of this software must not be misrepresented; you must not claim that you wrote the original software. if you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. (nice but optional, bestie πŸ’–)
  2. altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. don't be shady 🚫
  3. this notice may not be removed or altered from any source distribution.

with the exception of the CodeMirror files, the files in this package may also be redistributed and/or modified under the same terms as Perl itself.

the CodeMirror (Javascript and CSS) files contained in this package are copyright (c) 2007-2010 Marijn Haverbeke, and licensed under the terms of the same zlib license as this code.

⚠️ heads up: that last bit means CodeMirror is doing its own licensing thing, separate from the Perl-terms party the rest of the package is having. keep both notes intact!

aaaand that's the whole page, we ate and left no crumbs πŸ’…βœ¨ this was perl v5.36.0, dated 2022-10-14, closing out the RDF::Endpoint manual page. byeee, go build an endpoint πŸ¦‹πŸŽ€πŸ’œ

πŸ“¦ where this page comes from