Open bblfish opened 10 years ago
A good initial example of this is webid.mit.edu. This downloads tabulator code which we don't want to do. But it shows the example of a resource that publishes both turtle and html depending on the requested content type.
$ curl -i -H "Accept: text/html" https://webid.mit.edu/presbrey#
HTTP/1.1 200 OK
Date: Fri, 08 Nov 2013 10:57:45 GMT
Server: Apache
Content-Length: 999
Scripts-IP: 18.181.0.46
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Content-Type: text/html; charset=utf-8
<!doctype html><html id="docHTML"><head>
<link type="text/css" rel="stylesheet" href="https://w3.scripts.mit.edu/tabulator/tabbedtab.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://w3.scripts.mit.edu/tabulator/js/mashup/mashlib.js"></script>
<script type="text/javascript">
/* http://api.jquery.com/extending-ajax/#Prefilters */
jQuery.ajaxPrefilter(function(options) {
if (options.crossDomain) {
options.url = "https://w3.scripts.mit.edu/proxy?uri=" + encodeURIComponent(options.url);
}
});
jQuery(document).ready(function() {
var uri = window.location.href;
window.document.title = uri;
var kb = tabulator.kb;
var subject = kb.sym(uri);
tabulator.outline.GotoSubject(subject, true, undefined, true, undefined);
});
</script>
</head>
<body>
<div class="TabulatorOutline" id="DummyUUID">
<table id="outline"></table>
</div>
</body>
</html>
11:52:14 - ~/Programming/w3.org/git/banana-rdf
hjs@bblfish[0] (ldp)$ curl -H "Accept: text/turtle" https://webid.mit.edu/presbrey#
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix cert: <http://www.w3.org/ns/auth/cert#> .
<presbrey#> rdfs:seeAlso <http://presbrey.mit.edu/foaf#presbrey> ; cert:key
[ a cert:RSAPublicKey ; cert:exponent "65537" ; cert:modulus "ac62c2b6bf77c8d2a389c5b620b94fd0ff84ef3de7773c9d257bdb727cac0ce8fed4748bbc301329327a2d284d6b89318cbe54d2c0270867d7a6a12aa1f4a35b257dffc20f81d5a1cebc5a286045b863504be83db37a533f2617f64103fbdf58f1e92858182fc3282796f1442f1656131af793468a34311f9eb11fa43fdba1701c4fc40e9daddb9b9f6f149c4f4061b634ad3a45dabd575727b2c7376e5ae6f6c47615575ed83fc044d5b1aa742e4bc084549aff71f37a09364537ce6fc5b9c2217669dab4d0b630bb7e7d81e8b0e49836949c243a29c984f4648f661aaa054c7f98ee1440e065dd555245052b2105605d2f3d343a8309233d72c461ed8397bd" ],
[ a cert:RSAPublicKey ; cert:exponent "65537" ; cert:modulus "e30474334808712b0ae83f26a5d5a6e974d1c4b887fc6f76f7dbb2a874ff1ed100662518295c6ff8979cbeea3ca54078f2a3c0bfb94c93a495e08cecdee837fa63ba6a55602ae8fd3f694a0fb125b1bd688467d66904c11d066bcc85209a05b3a7816521add217c319a57816aa6a4f539f5c752325538a5c2bac3baca2a0d1fa8ddd8385950e3b6801116a1de54d887af3dbf4e3bbbe0faaa3978fa83b102d360bdc50b7b818ca2aa32e18fcadb93fc29bacc2fac61f9b5b10a5197443ba8c7dd8503eacd07e76a510f555df0fc660f4ebd82238c30606ee9c8d1e28e3663a107250f4b7f57914374ed3648156b67d2d75a3d6f4d6357cca405645b4e0e41405" ],
[ a cert:RSAPublicKey ; cert:exponent "65537" ; cert:modulus "da16ae696b74cde3ba2911cd68b6198cc5d63fb5d6d2612a1d94f0f3e3b44ba0a73690dcc484355b59745eb1c269dd9261314a34249e14359a3849f0d382a3d7d027d2ef67c82d27b3000130eda4c0f7d59cebd0eccf70d29211799c23f6a1255b94686c1587c21d89efdcf3c377184edf4455c27c43f7200a975705e596f43ecd0a43f8880465fd7d124ba453b13f8ececba1e99c079b8e52969ce25bf58655c49b4099b33b85716327a8ec02d705b4328f6944389f991664eacc1368aa2eaa417f54ba447b581809ee5a4040de718ea332942b38bf46e57613dfa6fe71ac9409c076565ad93b8673af27bc2a7ce1cf8761a860e20472b9100fc4e98fa662c1" ],
[ a cert:RSAPublicKey ; cert:exponent "65537" ; cert:modulus "ba774d2ed204eb3f01358cf03d672aac0cd0151420617bbaaf41eab6f82a9ac9b8ec48d3e2ead13db41721d00109be2ea41d1eb6bcc758d1b0990d7812731c666245a7a74579d3553800ff1fe306db72c6c2d2c9bbb5b7edcac15b92c25b10317a166950d4207956f0732def278c2b130f1b88d01d757e133e14ebce27c42c1dc7d147234e776d8fbd16c4b123d075c0ee92bad6246c4a90841ed6040cb536ae368c2a04b4dcf38bcc314327fd7f80a067a50cbef4bc64ca81d9ea0e54fc07c160d15656d98a79006376b0cf4d2a499294ace09a46911bbb19054ebf2a678b5b6b67520ff9a545e150407489e7315b090ee522542dd04f3f22a24cd39bc693f5" ],
[ a cert:RSAPublicKey ; cert:exponent "65537" ; cert:modulus "dcb58c62f69c31e78590bf858f6b4be475fc5dff0edcb7a303bbddb3484838e0af3311dcd1cbf48902e8baef9adf3337df81998d959dfd48cf8b90215c8a9bc0411d3ccfd38e2785f4dae14803e90ffbed489ee250651012bed4063330c02494f99dac88d094e3663f8e9e6cab28965423119b4c92be7455e06180c691eb43b38587b17834d0de6b77e21870943462f9ffd8a0aa2a0cf488d101d0e4ee11d1c282d1729a2012e85b13a6be32db5d0fd9ce1c1e92975c6481542e6ca8acc41ed009802a703a1d7cb1540e6508f6c60b328a20965a722ab40a1135c00566c10e88ca43c58354de0a8992cb5dcadf6a616706a4a95c12f0933d72972d64cbb5386d" ] .
Imagine a browser ask for resource </2013/>
which contains the following
subgraph { <> a ldp:Container . }
when served as RDF.
rdflib.js
</public/viewer.ttl>
If those files do not exist html displays a nice error message.</public/viewer.ttl>
contains the following: @prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix stample: <http://ont.stample.co/2013/display#> .
ldp:Container stample:view </public/ldpviewer.js> .
ldp:Container
is,
and fetches it ( ie </public/ldpviewer.js>
).</2013/>
with a clear RDF Accept
header such as Accept: text/turtle
. The server the serves the RDF. </public/ldpviewer.js>
to display the resource it was meant to
display ie </2013/>
The previous fix does not work from the JS point of view because once the browser has downloaded the turtle, ( since that is the last thing it has downloaded for that resource ), then it will show the turtle the next time the user GETs it, for example when the user presses the back button in the browser.
As a result I have created a new route /srv/rdfViewer?url=$url
. An rdf resource ( such as /2013/
) that identifies a browser redirects the user to that resource. The rdfViewer then changes the string window.location.href
to the full url of the original turtle.
Every resource on the LDP should return the same minimal html page that contains
It should then use that info to build a view.