[VIVO-1312] Implement Linked Data Fragment Server (#53)
* [VIVO-1312] Linked Data Fragments initial implementation * [VIVO-1312] Use known ontologies in the prefixes config * [VIVO-1312] Simplify SPARQL as when restricted to specific values, they don’t need ordering * [VIVO-1312] Freemarker fixes * [VIVO-1312] Remove blank nodes * [VIVO-1312] Add access control header and standard prefixes for TPF * [VIVO-1312] Render literals in form so that they will work on resubmit * [VIVO-1312] Minor template update * [VIVO-1312] Minor template update
This commit is contained in:
parent
e9cb3de52e
commit
68a462b05a
63 changed files with 5215 additions and 0 deletions
30
api/src/main/resources/tpf/base.ftl.html
Normal file
30
api/src/main/resources/tpf/base.ftl.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
|
||||
<#macro display_page>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" prefix="hydra: http://www.w3.org/ns/hydra/core# void: http://rdfs.org/ns/void#">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Linked Data Fragments Server ${ (title!header)?ensure_starts_with("(")?ensure_ends_with(")") }</title>
|
||||
<link rel="stylesheet" href="${ assetsPath }style.css" />
|
||||
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans:700italic,400,700|Droid+Sans+Mono" type="text/css" />
|
||||
<meta name="viewport" content="width=device-width,minimum-scale=1,maximum-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1><a href="${homePath}">Linked Data Fragments Server</a></h1>
|
||||
<figure class="logo">
|
||||
<a href="http://linkeddatafragments.org/"><img src="${ assetsPath }logo.svg" alt="Linked Data Fragments" /></a>
|
||||
</figure>
|
||||
</header>
|
||||
<main>
|
||||
<@contents/>
|
||||
</main>
|
||||
<footer>
|
||||
<p>
|
||||
Powered by a <a href="https://github.com/LinkedDataFragments/Server.java" target="_blank">Linked Data Fragments Server</a>
|
||||
©2013–${date?string.yyyy} Multimedia Lab – iMinds – Ghent University
|
||||
</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
</#macro>
|
7
api/src/main/resources/tpf/datasource.ftl.html
Normal file
7
api/src/main/resources/tpf/datasource.ftl.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
|
||||
<#assign title = datasource.getTitle() + ' | ' + title!"">
|
||||
<#include "base.ftl.html">
|
||||
<#macro contents>
|
||||
<#include "fragment.ftl.html">
|
||||
</#macro>
|
||||
<@display_page/>
|
11
api/src/main/resources/tpf/error.ftl.html
Normal file
11
api/src/main/resources/tpf/error.ftl.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
|
||||
<#include "base.ftl.html">
|
||||
<#macro contents>
|
||||
<h2>Error executing your request</h2>
|
||||
<p>Your request could not be executed due to an internal server error.</p>
|
||||
<p>Please try reloading the page or return to the <a href="/">index page</a>.</p>
|
||||
|
||||
<h3>Error details</h3>
|
||||
<p><#if error??>${(error.getMessage())!error!""}</#if><p>
|
||||
</#macro>
|
||||
<@display_page/>
|
83
api/src/main/resources/tpf/fragment.ftl.html
Normal file
83
api/src/main/resources/tpf/fragment.ftl.html
Normal file
|
@ -0,0 +1,83 @@
|
|||
<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
|
||||
<#setting url_escaping_charset='UTF-8'>
|
||||
<div resource="${datasourceUrl}" typeof="void:datasource hydra:Collection">
|
||||
<h2><a href="${datasourceUrl}">${datasource.getTitle()?cap_first}</a></h2>
|
||||
|
||||
<form action="?" method="GET" property="hydra:search" resource="#triplePattern">
|
||||
<fieldset resource="#triplePattern">
|
||||
<legend>Query ${datasource.getTitle()} by triple pattern</legend>
|
||||
<ul>
|
||||
<#list ['subject', 'predicate', 'object'] as component>
|
||||
<li property="hydra:mapping" resource="#${component}">
|
||||
<label for="${component}>"
|
||||
about="#${component}" property="hydra:variable" lang="">${component}</label>
|
||||
<input class="uri" id="${component}" name="${component}"
|
||||
about="#${component}" property="hydra:property" resource="rdf:${component}" value="${(query[component]?html)!""}" />
|
||||
</li>
|
||||
</#list>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<p>
|
||||
<input type="submit" value="Find matching triples" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h3>Matches in ${datasource.getTitle()} for <em class="pattern">${ (query["pattern"]?html)!"" }</em></h3>
|
||||
|
||||
<div class="counts">
|
||||
<#if (triples?size > 0)>
|
||||
Showing triples ${ start } to ${ end } of
|
||||
<#if totalEstimate != end>±</#if>
|
||||
<span property="void:triples hydra:totalItems" datatype="xsd:integer" content="${ totalEstimate }">${ totalEstimate }</span>
|
||||
with <span property="hydra:itemsPerPage" datatype="xsd:integer" content="${ itemsPerPage }">${
|
||||
itemsPerPage
|
||||
}</span> triples per page.
|
||||
<@pageLinks/>
|
||||
<#else>
|
||||
<p>
|
||||
${datasource.getTitle()} contains
|
||||
<span property="void:triples hydra:totalItems" datatype="xsd:integer" content="0">
|
||||
no <#if (totalEstimate > 0) >more</#if>
|
||||
</span>
|
||||
triples that match this pattern.
|
||||
</p>
|
||||
</#if>
|
||||
</div>
|
||||
|
||||
<ul class="triples">
|
||||
<#list triples as triple>
|
||||
<#assign subject = triple.getSubject().asNode().toString()>
|
||||
<#assign predicate = triple.getPredicate().asNode().toString()>
|
||||
<#assign object = triple.getObject().asNode().toString()>
|
||||
<li>
|
||||
<a href="?subject=${subject?url}">
|
||||
<abbr title="${ subject }">${subject?keep_after_last("/")}</abbr>
|
||||
</a>
|
||||
<a href="?predicate=${predicate?url}">
|
||||
<abbr title="${ predicate }">${predicate?keep_after_last("/")}</abbr>
|
||||
</a>
|
||||
<#if !triple.getObject().isLiteral()>
|
||||
<a href="?object=${object?url}" resource="${ subject}">
|
||||
<abbr title="${ object }" property="${ predicate }" resource="${ object }">${object?keep_after_last("/")}</abbr>
|
||||
</a>.
|
||||
<#else>
|
||||
<a href="?object=${object?url}" resource="${ subject}">${object}</a>.
|
||||
</#if>
|
||||
</li>
|
||||
</#list>
|
||||
</ul>
|
||||
|
||||
<@pageLinks/>
|
||||
|
||||
<#macro pageLinks>
|
||||
<ul class="links">
|
||||
<#if previousPage??>
|
||||
<li><a href="${ firstPage }" rel="first" property="hydra:firstPage">first</a></li>
|
||||
<li><a href="${ previousPage }" rel="prev" property="hydra:previousPage">previous</a></li>
|
||||
</#if>
|
||||
<#if nextPage??>
|
||||
<li><a href="${ nextPage }" rel="next" property="hydra:nextPage">next</a></li>
|
||||
</#if>
|
||||
</ul>
|
||||
</#macro>
|
21
api/src/main/resources/tpf/index.ftl.html
Normal file
21
api/src/main/resources/tpf/index.ftl.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
|
||||
<#include "base.ftl.html">
|
||||
<#macro contents>
|
||||
<div class="index">
|
||||
<h2>Available datasets</h2>
|
||||
<p>Browse the following datasets as <a href="http://linkeddatafragments.org/in-depth/#tpf">Triple Pattern Fragments</a>:</p>
|
||||
<dl class="datasets">
|
||||
<#if datasources??>
|
||||
<#list datasources?keys as datasourceName>
|
||||
<dt><a href="${homePath}/${datasourceName}">${datasources[datasourceName].getTitle() }</a></dt>
|
||||
<dd>${ datasources[datasourceName].getDescription()!"" }</dd>
|
||||
</#list>
|
||||
</#if>
|
||||
</dl>
|
||||
<p>The current dataset <em class="dataset">index</em> contains metadata about these datasets.</p>
|
||||
</div>
|
||||
|
||||
<#include "fragment.ftl.html">
|
||||
</#macro>
|
||||
|
||||
<@display_page/>
|
16
api/src/main/resources/tpf/notfound.ftl.html
Normal file
16
api/src/main/resources/tpf/notfound.ftl.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
|
||||
<#include "base.ftl.html">
|
||||
<#macro contents>
|
||||
<h2>Resource not found</h2>
|
||||
<p>
|
||||
No resource with URL <code>${ url!"" }</code> was found.
|
||||
</p>
|
||||
|
||||
<h3>Available datasets</h3>
|
||||
<ul>
|
||||
<#list datasources?keys as datasourceName>
|
||||
<li><a href="/${datasourceName}">${datasources[datasourceName].getTitle() }</a></li>
|
||||
</#list>
|
||||
</ul>
|
||||
</#macro>
|
||||
<@display_page/>
|
Loading…
Add table
Add a link
Reference in a new issue