Debian Codegraph @

README

raw
1 RDF::LinkedData - A Linked Data server implementation
2
3 DESCRIPTION
4
5 This module is used to create a Linked Data server that can
6 serve RDF data out of an RDF::Trine::Model. It will look up URIs in
7 the model and do the right thing (known as the 303 dance) and mint
8 URLs for that, as well as content negotiation. Thus, you can
9 concentrate on URIs for your things, you need not be concerned about
10 minting URLs for the pages to serve it. In addition, optional modules
11 can provide other important functionality: Cross-origin resource
12 sharing, VoID description, cache headers, SPARQL Endpoint, Triple
13 Pattern Fragments, etc. As such, it encompasses a fair share of
14 Semantic Web best practices, but possibly not in a very flexible Big
15 Data manner.
16
17 INSTALLATION
18
19 On Debian and derivatives, such as Ubuntu, this module can be
20 installed with all its dependencies using
21
22 apt-get install librdf-linkeddata-perl
23
24 as root or using sudo.
25
26 To install the most recent module, it is likely that you already have
27 the cpan tool installed. Then just run it on the command line. If you
28 don't have it, see http://www.cpan.org/modules/INSTALL.html
29
30 Then, in the cpan tool, type
31
32 install RDF::LinkedData
33
34 The relevant scripts and modules will be install to different paths
35 depending on your system. To use it, you need to find the script
36 linked_data.psgi, e.g. using locate.
37
38 CONFIGURATION
39
40 *Quick setup for a demo*
41
42 One-liner
43
44 It is possible to make it run with a single command line, e.g.:
45
46 PERLRDF_STORE="Memory;path/to/some/data.ttl" plackup -host localhost script/linked_data.psgi
47
48 This will start a server with the default config on localhost on port
49 5000, so the URIs you're going serve from the file data.ttl will have
50 to have a base URI http://localhost:5000/.
51
52 Using perlrdf command line tool
53
54 A slightly longer example requires App::perlrdf, but sets up a
55 persistent SQLite-based triple store, parses a file and gets the
56 server with the default config running:
57
58 export PERLRDF_STORE="DBI;mymodel;DBI:SQLite:database=rdf.db"
59 perlrdf make_store
60 perlrdf store_load path/to/some/data.ttl
61 plackup -host localhost script/linked_data.psgi
62
63 *Configuration*
64
65 To configure the system for production use, create a configuration
66 file rdf_linkeddata.json that looks something like:
67
68 {
69 "base_uri" : "http://localhost:5000/",
70 "store" : {
71 "storetype" : "Memory",
72 "sources" : [ {
73 "file" : "/path/to/your/data.ttl",
74 "syntax" : "turtle"
75 } ]
76
77 },
78 "endpoint": {
79 "html": {
80 "resource_links": true
81 }
82 },
83 "cors": {
84 "origins": "*"
85 },
86 "void": {
87 "pagetitle": "VoID Description for my dataset"
88 },
89 "expires" : "A86400" ,
90 "fragments" : {
91 "fragments_path" : "/fragments" ,
92 "allow_dump_dataset" : 0
93 }
94 }
95
96 In your shell set
97
98 export RDF_LINKEDDATA_CONFIG=/to/where/you/put/rdf_linkeddata.json
99
100 If the linked_data.psgi script was installed in /usr/local/bin, go:
101
102 plackup /usr/local/bin/linked_data.psgi --host localhost --port 5000
103
104 The endpoint-part of the config sets up a SPARQL Endpoint. This requires
105 the RDF::Endpoint module, which is recommended by this module. To
106 use it, it needs to have some config, but will use defaults.
107
108 It is also possible to set an expires time. This needs
109 Plack::Middleware::Expires and uses Apache mod_expires syntax, in the
110 example above, it will set an expires header for all resources to
111 expire after 1 day of access. It is strongly recommended that this is
112 used, as it can potentially speed up access to resources that aren't
113 accessed frequently considerably, and take load off your server.
114
115 The cors-part of the config enables Cross-Origin Resource
116 Sharing, which is a W3C Recommendation for relaxing security
117 constraints to allow data to be shared across domains. In most cases,
118 this is what you want when you are serving open data, but in some
119 cases, notably intranets, this should be turned off by removing this
120 part.
121
122 The void-part generates some statistics and a description of the
123 dataset, using RDF::Generator::Void. It is strongly recommended to
124 install and run that, but it can take some time to generate, so you
125 may have to set the detail level.
126
127 Finally, fragments add support for Triple Pattern Fragments, a
128 work-in-progress, initiated by http://linkeddatafragments.org/
129 It is a more lightweight but less powerful way to query RDF data than
130 SPARQL. If you have this, it is recommended to have CORS enabled and
131 required to have at least a minimal VoID setup.
132
133 It is also worth noting that an environment variable LOG_ADAPTER can
134 be set to send log statements to the console. I recommend installing
135 Log::Any::Adapter::Screen, which can be used by setting this variable
136 like LOG_ADAPTER=Screen. Its documentation details more environment
137 variables that can be used to control log levels, etc.
138
139 This module now also contains some facilities to support read-write
140 hypermedia RDF, as well as the possibility to subclass RDF::LinkedData
141 itself. The read-write functionality is provided by a separate module,
142 RDF::LinkedData::RWHypermedia, but is highly experimental at this
143 point.
144
145 *Production server setup*
146
147 In addition to the configuration above, a production system should set
148 up a real Web server to run the Plack script. There are many ways to
149 do this (as Plack provides an elegant separation of concerns between
150 developers and system administrators).
151
152 To set this up under Apache, put this in the host configuration:
153
154 <Location />
155 SetHandler perl-script
156 PerlResponseHandler Plack::Handler::Apache2
157 SetEnv RDF_LINKEDDATA_CONFIG /to/where/you/put/rdf_linkeddata.json
158 PerlSetVar psgi_app /usr/local/bin/linked_data.psgi
159 </Location>
160
161 <Perl>
162 use Plack::Handler::Apache2;
163 $ENV{RDF_LINKEDDATA_CONFIG}='/to/where/you/put/rdf_linkeddata.json';
164 Plack::Handler::Apache2->preload("/usr/local/bin/linked_data.psgi");
165 </Perl>
166
167 <Location ~ "^/(dumps|js/|css/|favicon.ico)">
168 SetHandler default-handler
169 </Location>
170
171 Note that in some environments, for example if the Plack server
172 is dynamically configured and/or behind a proxy server, the server
173 may fail to bind to the address you give it as hostname. In this case,
174 it is wise to allow the server to bind to any public IP address,
175 i.e. set the host name to 0.0.0.0.
176
177
178
179 AUTHOR
180 Kjetil Kjernsmo, "<[email protected]>"
181
182 BUGS
183 Please report any bugs using github
184 <https://github.com/kjetilk/RDF-LinkedData/issues>
185
186 SUPPORT
187 You can find documentation for this module with the perldoc command.
188
189 perldoc RDF::LinkedData
190
191 The perlrdf IRC channel is the right place to seek help and discuss this module:
192
193 irc://irc.perl.org/#perlrdf
194
195 ACKNOWLEDGEMENTS
196 This module was started by Gregory Todd Williams "<[email protected]>"
197 for RDF::LinkedData::Apache, but has been almost totally rewritten.
198
199 COPYRIGHT & LICENSE
200 Copyright 2010 Gregory Todd Williams
201
202 Copyright 2010 ABC Startsiden AS
203
204 Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Kjetil Kjernsmo
205
206 This program is free software; you can redistribute it and/or modify it
207 under the same terms as Perl itself.
208