datasources, String mimeType) throws IOException {
+ switch (mimeType) {
+ case HTML:
+ return new HtmlTriplePatternFragmentWriterImpl(prefixes, datasources);
+ default:
+ return new RdfWriterImpl(prefixes, datasources, mimeType);
+ }
+ }
+}
diff --git a/api/src/main/resources/org/vivoweb/linkeddatafragments/servlet/favicon.ico b/api/src/main/resources/org/vivoweb/linkeddatafragments/servlet/favicon.ico
new file mode 100644
index 000000000..65418193a
Binary files /dev/null and b/api/src/main/resources/org/vivoweb/linkeddatafragments/servlet/favicon.ico differ
diff --git a/api/src/main/resources/org/vivoweb/linkeddatafragments/servlet/logo.svg b/api/src/main/resources/org/vivoweb/linkeddatafragments/servlet/logo.svg
new file mode 100644
index 000000000..dce588f7e
--- /dev/null
+++ b/api/src/main/resources/org/vivoweb/linkeddatafragments/servlet/logo.svg
@@ -0,0 +1,67 @@
+
+
+
diff --git a/api/src/main/resources/org/vivoweb/linkeddatafragments/servlet/style.css b/api/src/main/resources/org/vivoweb/linkeddatafragments/servlet/style.css
new file mode 100644
index 000000000..4728a61f4
--- /dev/null
+++ b/api/src/main/resources/org/vivoweb/linkeddatafragments/servlet/style.css
@@ -0,0 +1,247 @@
+/*! @license ©2013 Ruben Verborgh - Multimedia Lab / iMinds / Ghent University */
+
+html, input, th, td {
+ font-family: "Open Sans", Verdana, Arial, sans-serif;
+ font-size: 11pt;
+}
+
+html {
+ background: #f6f6f6;
+}
+
+body {
+ max-width: 800px;
+ margin: 0 auto;
+ line-height: 1.3;
+ color: #333333;
+ background-color: white;
+ padding: 10px 40px;
+ box-shadow: 2px 2px 15px 0px rgba(50, 50, 50, 0.75);
+}
+
+h1, h2, h3, legend {
+ margin: .4em 0 .2em;
+ overflow: hidden;
+}
+h1 {
+ margin-right: 180px;
+}
+h1 a {
+ color: black;
+}
+h2 {
+ color: #be1622;
+}
+h3 {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+p {
+ margin: 0;
+}
+
+a {
+ color: #be1622;
+ text-decoration: none;
+ border-bottom: none 1px;
+}
+a:hover {
+ color: #be1622 !important;
+ border-bottom-style: solid;
+}
+
+ul {
+ padding: 0;
+ margin: 0 0 .5em 1.5em;
+ list-style: none;
+}
+
+pre {
+ margin: 0;
+}
+
+form {
+ margin: 0 0 1.5em;
+}
+
+fieldset {
+ border: none;
+ padding: .5em 0 0 20px;
+}
+fieldset ul {
+ margin-left: 0;
+}
+fieldset li {
+ line-height: 2em;
+}
+
+legend {
+ font-size: 1.17em;
+ font-weight: bold;
+ padding: 0;
+ margin-left: -20px;
+}
+
+label {
+ width: 100px;
+ display: block;
+ float: left;
+ clear: both;
+ font-weight: bold;
+}
+label:after {
+ content: ":";
+}
+
+input {
+ outline: none;
+ font-size: .95em;
+}
+fieldset input {
+ width: 500px;
+ color: #be1622;
+ background-color: transparent;
+ border: none;
+ border-bottom: 1px solid #bbbbbb;
+ cursor: pointer;
+}
+input[type=submit] {
+ font-weight: bold;
+ color: #be1622;
+ background-color: #f6f6f6;
+ border-radius: 3px;
+ padding: 5px 8px;
+ border: 1px solid #999999;
+ cursor: pointer;
+}
+input[type=submit]:hover {
+ border-color: #666666;
+}
+input[type=submit]:active {
+ padding: 6px 7px 4px 9px;
+}
+.uri {
+ font-family: "Droid Sans Mono", monospace;
+}
+
+header .logo {
+ text-align: right;
+}
+header .logo a {
+ position: absolute;
+ top: 20px;
+ margin-left: -100px;
+ border-bottom-width: 0px;
+}
+header .logo img {
+ width: 160px;
+}
+
+footer {
+ clear: both;
+ margin: 1.5em 0 .5em;
+ font-size: small;
+}
+footer * {
+ color: gray;
+ margin-right: 5px;
+}
+
+.counts {
+ color: gray;
+}
+ul.links {
+ margin: 0;
+ padding: 0;
+ display: inline;
+}
+ul.links li {
+ display: inline;
+ padding-left: 20px;
+ font-weight: bold;
+}
+
+ul.triples {
+ margin: .3em 0 1em 20px;
+ font-size: .95em;
+ line-height: 1.5;
+ font-family: "Droid Sans Mono", monospace;
+ overflow-x: hidden;
+}
+ul.triples li {
+ text-indent: -20px;
+ padding-left: 20px;
+ max-width: 100%;
+ max-height: 1.5em;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+}
+ul.triples li:hover {
+ max-height: 100em;
+ white-space: normal;
+ transition: max-height .5s ease-in;
+ transition-delay: .5s;
+}
+ul.triples li:not(:hover) a {
+ color: inherit;
+}
+ul.triples a:nth-child(2) {
+ margin: 0 1em;
+}
+abbr {
+ border: none;
+}
+
+.index {
+ margin-bottom: 2em;
+}
+.datasets {
+ margin: .5em 20px;
+}
+dt {
+ font-weight: bold;
+ display: block;
+ float: left;
+ clear: left;
+}
+dd {
+ color: gray;
+ margin: .1em 0 0 12em;
+ font-size: .95em;
+}
+
+#about {
+ margin-top: 1.5em;
+ font-size: .9em;
+}
+
+@media screen and (max-width: 700px) {
+ html, input, th, td {
+ font-size: 10pt;
+ }
+ body {
+ padding: 15px;
+ }
+ header figure {
+ display: none;
+ }
+ h1, legend {
+ margin: 0;
+ }
+ fieldset, ul.triples {
+ padding: .5em 0;
+ margin: 0;
+ }
+ fieldset input {
+ width: 70%;
+ }
+ label {
+ width: 80px;
+ }
+ ul.triples li {
+ margin: 1em 0;
+ }
+}
diff --git a/api/src/main/resources/tpf/base.ftl.html b/api/src/main/resources/tpf/base.ftl.html
new file mode 100644
index 000000000..8952ccf1c
--- /dev/null
+++ b/api/src/main/resources/tpf/base.ftl.html
@@ -0,0 +1,30 @@
+<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
+<#macro display_page>
+
+
+
+
+ Linked Data Fragments Server ${ (title!header)?ensure_starts_with("(")?ensure_ends_with(")") }
+
+
+
+
+
+
+
+
+
+
+
+
+ <@contents/>
+
+
+
+
+#macro>
\ No newline at end of file
diff --git a/api/src/main/resources/tpf/datasource.ftl.html b/api/src/main/resources/tpf/datasource.ftl.html
new file mode 100644
index 000000000..97cd09985
--- /dev/null
+++ b/api/src/main/resources/tpf/datasource.ftl.html
@@ -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/>
diff --git a/api/src/main/resources/tpf/error.ftl.html b/api/src/main/resources/tpf/error.ftl.html
new file mode 100644
index 000000000..84ce65876
--- /dev/null
+++ b/api/src/main/resources/tpf/error.ftl.html
@@ -0,0 +1,11 @@
+<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
+<#include "base.ftl.html">
+<#macro contents>
+Error executing your request
+Your request could not be executed due to an internal server error.
+Please try reloading the page or return to the index page.
+
+Error details
+<#if error??>${(error.getMessage())!error!""}#if>
+#macro>
+<@display_page/>
\ No newline at end of file
diff --git a/api/src/main/resources/tpf/fragment.ftl.html b/api/src/main/resources/tpf/fragment.ftl.html
new file mode 100644
index 000000000..32ce716bf
--- /dev/null
+++ b/api/src/main/resources/tpf/fragment.ftl.html
@@ -0,0 +1,83 @@
+<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
+<#setting url_escaping_charset='UTF-8'>
+
+
+Matches in ${datasource.getTitle()} for ${ (query["pattern"]?html)!"" }
+
+
+<#if (triples?size > 0)>
+ Showing triples ${ start } to ${ end } of
+ <#if totalEstimate != end>±#if>
+
${ totalEstimate }
+ with
${
+ itemsPerPage
+ } triples per page.
+ <@pageLinks/>
+<#else>
+
+ ${datasource.getTitle()} contains
+
+ no <#if (totalEstimate > 0) >more#if>
+
+ triples that match this pattern.
+
+#if>
+
+
+
+
+<@pageLinks/>
+
+<#macro pageLinks>
+
+#macro>
\ No newline at end of file
diff --git a/api/src/main/resources/tpf/index.ftl.html b/api/src/main/resources/tpf/index.ftl.html
new file mode 100644
index 000000000..568db4ab5
--- /dev/null
+++ b/api/src/main/resources/tpf/index.ftl.html
@@ -0,0 +1,21 @@
+<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
+<#include "base.ftl.html">
+<#macro contents>
+
+
Available datasets
+
Browse the following datasets as Triple Pattern Fragments:
+
+ <#if datasources??>
+ <#list datasources?keys as datasourceName>
+ - ${datasources[datasourceName].getTitle() }
+ - ${ datasources[datasourceName].getDescription()!"" }
+ #list>
+ #if>
+
+
The current dataset index contains metadata about these datasets.
+
+
+<#include "fragment.ftl.html">
+#macro>
+
+<@display_page/>
\ No newline at end of file
diff --git a/api/src/main/resources/tpf/notfound.ftl.html b/api/src/main/resources/tpf/notfound.ftl.html
new file mode 100644
index 000000000..363b8abd9
--- /dev/null
+++ b/api/src/main/resources/tpf/notfound.ftl.html
@@ -0,0 +1,16 @@
+<#-- @license ©2015 Miel Vander Sande - Multimedia Lab / iMinds / Ghent University -->
+<#include "base.ftl.html">
+<#macro contents>
+Resource not found
+
+ No resource with URL ${ url!"" }
was found.
+
+
+Available datasets
+
+#macro>
+<@display_page/>
\ No newline at end of file
diff --git a/dependencies/pom.xml b/dependencies/pom.xml
index df30c3970..856f37d30 100644
--- a/dependencies/pom.xml
+++ b/dependencies/pom.xml
@@ -284,6 +284,11 @@
antisamy
1.5.3
+
+ com.google.code.gson
+ gson
+ 2.5
+