From f770cd2937e6627fe7f02a915d1e8c55ef0b2870 Mon Sep 17 00:00:00 2001
From: root <root@hindustan.uib.no>
Date: Thu, 5 Dec 2013 23:23:08 +0100
Subject: [PATCH] Loads of fixes. Redesign based around bibo:Document. Added
 search on person, topic and collection. Timeline on collection started, but
 broken.

---
 .htaccess                                     |   1 +
 classes/Utils.php                             |   3 +
 classes/modules/staticModule.php              |   3 +-
 components/includes/footer.inc                |   3 +-
 components/includes/header.inc                |  73 +--
 components/includes/persons/for_row.inc       |   6 +-
 components/includes/search.inc                |   8 +-
 .../queries/main.query                        |   2 +-
 .../instance%2Fcharter/queries/places.query   |   6 -
 .../html.template                             |   4 +-
 .../queries/collections.query                 |   0
 .../queries/description.query                 |   0
 .../queries/dzi.query                         |   0
 .../queries/image.query                       |   0
 .../queries/internalnote.query                |   0
 .../queries/main.query                        |   2 +-
 .../queries/maker.query                       |   0
 .../queries/physicalcondition.query           |   0
 .../queries/physicaldescription.query         |   0
 .../instance%2FcharterX/queries/places.query  |   5 +
 .../queries/po.query                          |   0
 .../queries/relatedresources.query            |   0
 .../queries/sp.query                          |   0
 .../queries/subjects.query                    |   0
 .../queries/transcription.query               |   0
 .../html.template                             |   2 +-
 .../queries/haspart.query                     |   2 +-
 .../instance%2Fcollection/html.template       |  72 ++-
 .../queries/search.query                      |  12 +
 .../queries/timeline.query                    |  12 +
 .../instance%2Fperson/queries/main.query      |   4 +-
 .../instance%2Fperson/queries/related.query   |   7 +-
 components/services/persons/html.template     |  93 ++--
 .../services/persons/queries/count.query      |   3 +
 .../services/persons/queries/main.query       |  11 +-
 .../services/persons/queries/search.query     |  23 +-
 components/services/persons/queries/test.txt  |   0
 components/services/search/html.template      |  14 +-
 components/services/search/queries/main.query |  11 +-
 components/services/timeline/html.template    |  37 ++
 components/services/timeline/json.template    |  24 +
 .../services/timeline/queries/timeline.query  |  11 +
 components/services/topics/html.template      |  41 +-
 .../services/topics/queries/count.query       |   3 +
 .../services/topics/queries/search.query      |   9 +
 components/static/css/basic.css               |  30 +-
 components/static/index.html                  |  47 +-
 components/static/js/TimelineJS               |   1 +
 components/types/bibo__Document/html.template | 429 +++++++++++-------
 .../bibo__Document/queries/collections.query  |  15 +-
 .../bibo__Document/queries/depicted.query     |   9 +
 .../types/bibo__Document/queries/image.query  |   4 +-
 .../types/bibo__Document/queries/main.query   |  10 +-
 .../types/bibo__Document/queries/maker.query  |   5 +-
 .../types/bibo__Document/queries/places.query |   8 +-
 .../bibo__Document/queries/published.query    |  13 +
 .../bibo__Document/queries/publisher.query    |   8 +
 .../bibo__Document/queries/subjects.query     |   8 +-
 .../queries/transcription.query               |  17 +
 59 files changed, 737 insertions(+), 374 deletions(-)
 delete mode 100755 components/services/instance%2Fcharter/queries/places.query
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/html.template (97%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/collections.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/description.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/dzi.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/image.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/internalnote.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/main.query (95%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/maker.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/physicalcondition.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/physicaldescription.query (100%)
 create mode 100755 components/services/instance%2FcharterX/queries/places.query
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/po.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/relatedresources.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/sp.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/subjects.query (100%)
 rename components/services/{instance%2Fcharter => instance%2FcharterX}/queries/transcription.query (100%)
 create mode 100644 components/services/instance%2Fcollection/queries/search.query
 create mode 100644 components/services/instance%2Fcollection/queries/timeline.query
 create mode 100644 components/services/persons/queries/count.query
 delete mode 100755 components/services/persons/queries/test.txt
 create mode 100644 components/services/timeline/html.template
 create mode 100644 components/services/timeline/json.template
 create mode 100644 components/services/timeline/queries/timeline.query
 create mode 100644 components/services/topics/queries/count.query
 create mode 100644 components/services/topics/queries/search.query
 create mode 160000 components/static/js/TimelineJS
 create mode 100644 components/types/bibo__Document/queries/depicted.query
 create mode 100644 components/types/bibo__Document/queries/published.query
 create mode 100644 components/types/bibo__Document/queries/publisher.query
 create mode 100644 components/types/bibo__Document/queries/transcription.query

diff --git a/.htaccess b/.htaccess
index e7d21d5c..473ef9c2 100644
--- a/.htaccess
+++ b/.htaccess
@@ -7,6 +7,7 @@ RewriteCond %{SCRIPT_FILENAME} !.*/index.php$
 RewriteRule ^(.*)$ index.php?q=$1 [L]
 AddType application/xml .dzi
 AddType text/plain .log
+AddType application/javascript .jsonp
 
 ## EXPIRES CACHING ##
 <IfModule mod_expires.c>
diff --git a/classes/Utils.php b/classes/Utils.php
index e4129fe8..28c0be87 100755
--- a/classes/Utils.php
+++ b/classes/Utils.php
@@ -216,6 +216,9 @@ class Utils{
   	case 'json':
   	  $ser = ARC2::getRDFJSONSerializer();
   	  break;
+        case 'jsonp':
+          $ser = ARC2::getRDFJSONSerializer();
+          break;
   	case 'rdf':
   	  $ser = ARC2::getRDFXMLSerializer();
   	  break;
diff --git a/classes/modules/staticModule.php b/classes/modules/staticModule.php
index 17f58f2a..69a5501d 100755
--- a/classes/modules/staticModule.php
+++ b/classes/modules/staticModule.php
@@ -61,7 +61,8 @@ class StaticModule extends abstractModule{
                           'css'  => 'text/css',
                           'js'   => 'application/javascript',
                           'json' => 'application/json',
-                          'nt'   => 'text/plain',
+                          'jsonp'=> 'application/javascript',
+			  'nt'   => 'text/plain',
                           'ttl'  => 'text/turtle',
                           'png'  => 'image/png',
                           'jpg'  => 'image/jpeg',
diff --git a/components/includes/footer.inc b/components/includes/footer.inc
index a050fb3c..4c6fa004 100755
--- a/components/includes/footer.inc
+++ b/components/includes/footer.inc
@@ -89,6 +89,7 @@
 
 		</div>
 	</div>
+	</div>
 </footer>  
   
 <script type="text/javascript">
@@ -96,7 +97,7 @@ $('.bs-sidebar').affix({
     offset: {
       top: 0, 
       bottom: function () {
-        return (this.bottom = $('.footer').outerHeight(false))
+        return (this.bottom = $('.footer').outerHeight(false)+35)
       }
     }
   })
diff --git a/components/includes/header.inc b/components/includes/header.inc
index 3fbec40a..643630a0 100755
--- a/components/includes/header.inc
+++ b/components/includes/header.inc
@@ -3,7 +3,8 @@
  
   <head>
     <meta charset="utf-8">
-    <title>{{lodspk.title}}</title> 
+    <title>{{lodspk.title}}</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     <link rel="shortcut icon" type="image/x-icon" href="{{lodspk.home}}/img/favicon.ico">
 	
 	<!-- Latest compiled and minified CSS -->
@@ -26,18 +27,22 @@
     <meta name="author" content="">
     
     <!-- FACEBOOK OPEN GRAPH -->
-    <meta property=”og:title” content=”{{first.main.label.value}}”/>
-    <meta property=”og:type” content=”article”/>
-    <meta property=”og:description” content=”“/>
-    <meta property=”og:image” content=”{{ first.main.img.value }}”/>
-    <meta property=”og:url” content=”{{ uri }}”/>
-    <meta property=”og:site_name” content=”Marcus”/>
+    <meta property="og:title" content="{{first.main.label.value}}"/>
+    <meta property="og:type" content="article"/>
+    {% for row in models.description %}
+    <meta property="og:description" content="{{ row.description.value }}"/>
+    {% endfor %}
+    <meta property="og:image" content="{{ first.main.img.value }}"/>
+    <meta property="og:url" content="{{lodspk.local.curie}}"/>
+    <meta property="og:site_name" content="Marcus"/>
     
     <!-- TWITTER CARD -->
-    <meta name=”twitter:card” content=”photo”>
-    <meta name=”twitter:url” content=”{{ uri }}“>
-	<meta name=”twitter:description” content=”“>
-	<meta name=”twitter:image” content=”{{ first.main.img.value }}”>
+    <meta name="twitter:card" content="photo">
+    <meta name="twitter:url" content="{{lodspk.local.curie}}">
+    {% for row in models.description %}
+    <meta name="twitter:description" content="{{ row.description.value }}">
+    {% endfor %}
+	<meta name="twitter:image" content="{{ first.main.img.value }}">
 
 	<script src="//code.jquery.com/jquery.js"></script>
 	<!-- <script type="text/javascript" src="{{lodspk.home}}js/jquery.js"></script> -->
@@ -51,9 +56,6 @@
     <link rel="alternate" type="text/turtle" title="Turtle Version" href="{{lodspk.local.value}}.ttl" />
     <link rel="alternate" type="text/plain" title="N-Triples Version" href="{{lodspk.local.value}}.nt" />
     <link rel="alternate" type="application/json" title="RDFJSON Version" href="{{lodspk.local.value}}.json" />
-    <style>
-
-    </style>
     
     <script type="text/javascript" src="{{lodspk.home}}js/bootstrap-typeahead.js"></script>
     <script type="text/javascript">
@@ -72,7 +74,7 @@
               window.location = obj.uri;
             }
         });
-        $("input").on('keyup', function(){$("form").attr("action", 'http://marcus.uib.no/search/'+$(this).val())});
+        $(".header-search").on('keyup', function(){$("form").attr("action", 'http://marcus.uib.no/search/'+$(this).val())});
     });
     </script>
     
@@ -98,26 +100,7 @@
             </button>
             <a class="navbar-brand" href="{{lodspk.home}}">{{lodspk.title}}</a>
             <a class="nav-subtitle hidden-xs hidden-sm" href="{{lodspk.home}}"><small>Spesialsamlingene ved <br>Universitetet i Bergen</small></a>
-          </div>
-
-          
-          <nav class="collapse navbar-collapse">
-            <ul class="nav navbar-nav">
-<!--            <li><a href="{{lodspk.home}}">Hjem</a></li> -->
-              	<li class="dropdown">
-				  	<a id="browse1" class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="#"> Meny <span class="caret"></span></a>              							<ul class="dropdown-menu" aria-labelledby="browse1" role="meny">
-					  	{%include "../../includes/nav.inc"%}
-					</ul>
-				</li>
-			</ul>
-
-			<form class="navbar-form navbar-right" role="search" action="">
-            <div class="form-group">
-              <input type="text" data-provide="typeahead" class="typeahead form-control search-query" placeholder="Søk"/>
-            </div>
-            </form>
-			
-			<div id="popover-beta-head" style="display: none;">
+             <div id="popover-beta-head" style="display: none;">
 				<strong>Marcus - Beta</strong>
 			</div>
 			<div id="popover-beta-content" style="display: none;">
@@ -136,6 +119,26 @@
 				    }
 				});
 			</script>
+          </div>
+
+          
+          <nav class="collapse navbar-collapse">
+            <ul class="nav navbar-nav">
+<!--            <li><a href="{{lodspk.home}}">Hjem</a></li> -->
+              	<li class="dropdown">
+				  	<a id="browse1" class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="#"> Manuskript- og librarsamlingen <span class="caret"></span></a>
+				  	<ul class="dropdown-menu" aria-labelledby="browse1" role="meny">
+					  	{%include "../../includes/nav.inc"%}
+					</ul>
+				</li>
+				<li><a href="http://marcus.app.uib.no/">Billedsamlingen</a></li>
+			</ul>
+
+			<form class="navbar-form navbar-right" role="search" action="">
+            <div class="form-group">
+              <input class="header-search" type="text" data-provide="typeahead" class="typeahead form-control search-query" placeholder="Søk"/>
+            </div>
+            </form>
 	            
             <!--
             <ul class="nav navbar-nav navbar-right">
diff --git a/components/includes/persons/for_row.inc b/components/includes/persons/for_row.inc
index b0f60c2c..2fed814a 100755
--- a/components/includes/persons/for_row.inc
+++ b/components/includes/persons/for_row.inc
@@ -1,5 +1 @@
-<li><a href="{{ row.x.value }}"><span class="glyphicon glyphicon-user"></span>  {{row.name.value}}</a><br />
-                                                {% if row.imgUriUri.value %}
-                                                <a href="{{ row.imgUriUri.value }}"><img class="col-md-10 thumbnail" data-src="holder.js/300x200" src="{{row.depictionImage.value}}" alt=""></a>
-                                        {% endif %}
-                                </li>
+<li><a href="{{ row.uri.value }}"><span class="glyphicon glyphicon-user"></span>  {{row.label.value}}</a></li>
diff --git a/components/includes/search.inc b/components/includes/search.inc
index 616b36b3..def5a66f 100755
--- a/components/includes/search.inc
+++ b/components/includes/search.inc
@@ -1,11 +1,9 @@
-<form action="{{uri}}" method="POST">
-  <div class="col-lg-6">
+<form action="{{lodspk.this.local}}" method="POST">
     <div class="input-group">
-      <input type="text" class="form-control" name="query">
       <span class="input-group-btn">
-        <button class="btn btn-default" type="submit">Søk</button>
+        <button class="btn btn-info" type="submit"><span class="glyphicon glyphicon-search"></span></button>
       </span>
+      <input type="text" class="form-control" name="query">
     </div><!-- /input-group -->
-</div><!--col-lg-6-->
 </form>
 
diff --git a/components/services/instance%2Fcataloguecard/queries/main.query b/components/services/instance%2Fcataloguecard/queries/main.query
index 7222b6db..723834d3 100755
--- a/components/services/instance%2Fcataloguecard/queries/main.query
+++ b/components/services/instance%2Fcataloguecard/queries/main.query
@@ -1,6 +1,6 @@
 SELECT DISTINCT ?title ?description ?identifier ?reference ?spatial WHERE {
     <{{ uri }}> ubbont:showWeb true ;
-    dct:title ?title .
+    rdfs:label ?title .
 	OPTIONAL { <{{ uri }}> dct:description ?description . }
 	OPTIONAL { <{{ uri }}> dct:identifier ?identifier . }
 	OPTIONAL { <{{ uri }}> dct:reference ?reference . }
diff --git a/components/services/instance%2Fcharter/queries/places.query b/components/services/instance%2Fcharter/queries/places.query
deleted file mode 100755
index b52793ba..00000000
--- a/components/services/instance%2Fcharter/queries/places.query
+++ /dev/null
@@ -1,6 +0,0 @@
-SELECT DISTINCT ?place ?placeName ?lat ?long WHERE {
-
-	OPTIONAL { <{{ uri|deurifier }}> dct:spatial ?place . ?place skos:prefLabel ?placeName . 
-	OPTIONAL { ?place geo:lat ?lat ; geo:long ?long .}}
-}
-
diff --git a/components/services/instance%2Fcharter/html.template b/components/services/instance%2FcharterX/html.template
similarity index 97%
rename from components/services/instance%2Fcharter/html.template
rename to components/services/instance%2FcharterX/html.template
index 7d713ffa..10e14275 100755
--- a/components/services/instance%2Fcharter/html.template
+++ b/components/services/instance%2FcharterX/html.template
@@ -160,7 +160,7 @@
 						    		
 	    		<ul class="places-inline-list">
 				{% for row in models.places %}
-		        	<li><a href="{{ row.place.value }}" /><span class="glyphicon glyphicon-map-marker"></span> {{row.placeName.value}}</a></li>
+		        	<li><a href="{{ row.uri.value }}" /><span class="glyphicon glyphicon-map-marker"></span> {{row.label.value}}</a></li>
 				{% endfor %} 
 				</ul>
 
@@ -188,7 +188,7 @@
 	
 			{% for row in models.places %}
 				{% if row.long.value != null %}
-	        	L.marker([{{ row.lat.value }}, {{ row.long.value }}]).addTo(map).bindPopup("<b><a href=\"{{ row.place.value }}\">{{row.placeName.value}}</a></b>").openPopup();
+	        	L.marker([{{ row.lat.value }}, {{ row.long.value }}]).addTo(map).bindPopup("<b><a href=\"{{ row.uri.value }}\">{{row.label.value}}</a></b>").openPopup();
 	        	{% endif %} 
 			{% endfor %} 
 	</script>
diff --git a/components/services/instance%2Fcharter/queries/collections.query b/components/services/instance%2FcharterX/queries/collections.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/collections.query
rename to components/services/instance%2FcharterX/queries/collections.query
diff --git a/components/services/instance%2Fcharter/queries/description.query b/components/services/instance%2FcharterX/queries/description.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/description.query
rename to components/services/instance%2FcharterX/queries/description.query
diff --git a/components/services/instance%2Fcharter/queries/dzi.query b/components/services/instance%2FcharterX/queries/dzi.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/dzi.query
rename to components/services/instance%2FcharterX/queries/dzi.query
diff --git a/components/services/instance%2Fcharter/queries/image.query b/components/services/instance%2FcharterX/queries/image.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/image.query
rename to components/services/instance%2FcharterX/queries/image.query
diff --git a/components/services/instance%2Fcharter/queries/internalnote.query b/components/services/instance%2FcharterX/queries/internalnote.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/internalnote.query
rename to components/services/instance%2FcharterX/queries/internalnote.query
diff --git a/components/services/instance%2Fcharter/queries/main.query b/components/services/instance%2FcharterX/queries/main.query
similarity index 95%
rename from components/services/instance%2Fcharter/queries/main.query
rename to components/services/instance%2FcharterX/queries/main.query
index d41d2b4f..ec4dbd30 100755
--- a/components/services/instance%2Fcharter/queries/main.query
+++ b/components/services/instance%2FcharterX/queries/main.query
@@ -1,4 +1,4 @@
-SELECT DISTINCT ?title ?created ?available ?identifier ?hasLong WHERE {
+SELECT DISTINCT ?title ?created ?available ?identifier ?hasLong ?hasLong WHERE {
 
     <{{ uri }}> rdfs:label|dct:title ?title .
     OPTIONAL { <{{ uri }}> dct:identifier ?identifier . }
diff --git a/components/services/instance%2Fcharter/queries/maker.query b/components/services/instance%2FcharterX/queries/maker.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/maker.query
rename to components/services/instance%2FcharterX/queries/maker.query
diff --git a/components/services/instance%2Fcharter/queries/physicalcondition.query b/components/services/instance%2FcharterX/queries/physicalcondition.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/physicalcondition.query
rename to components/services/instance%2FcharterX/queries/physicalcondition.query
diff --git a/components/services/instance%2Fcharter/queries/physicaldescription.query b/components/services/instance%2FcharterX/queries/physicaldescription.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/physicaldescription.query
rename to components/services/instance%2FcharterX/queries/physicaldescription.query
diff --git a/components/services/instance%2FcharterX/queries/places.query b/components/services/instance%2FcharterX/queries/places.query
new file mode 100755
index 00000000..344b78eb
--- /dev/null
+++ b/components/services/instance%2FcharterX/queries/places.query
@@ -0,0 +1,5 @@
+SELECT DISTINCT ?uri ?label ?lat ?long WHERE {
+	OPTIONAL { <{{ uri|deurifier }}> dct:spatial ?uri . ?uri skos:prefLabel ?label . 
+	OPTIONAL { ?uri geo:lat ?lat ; geo:long ?long .}}
+}
+
diff --git a/components/services/instance%2Fcharter/queries/po.query b/components/services/instance%2FcharterX/queries/po.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/po.query
rename to components/services/instance%2FcharterX/queries/po.query
diff --git a/components/services/instance%2Fcharter/queries/relatedresources.query b/components/services/instance%2FcharterX/queries/relatedresources.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/relatedresources.query
rename to components/services/instance%2FcharterX/queries/relatedresources.query
diff --git a/components/services/instance%2Fcharter/queries/sp.query b/components/services/instance%2FcharterX/queries/sp.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/sp.query
rename to components/services/instance%2FcharterX/queries/sp.query
diff --git a/components/services/instance%2Fcharter/queries/subjects.query b/components/services/instance%2FcharterX/queries/subjects.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/subjects.query
rename to components/services/instance%2FcharterX/queries/subjects.query
diff --git a/components/services/instance%2Fcharter/queries/transcription.query b/components/services/instance%2FcharterX/queries/transcription.query
similarity index 100%
rename from components/services/instance%2Fcharter/queries/transcription.query
rename to components/services/instance%2FcharterX/queries/transcription.query
diff --git a/components/services/instance%2Fcollection%2Fbrosing-topologiske-katalogkort/html.template b/components/services/instance%2Fcollection%2Fbrosing-topologiske-katalogkort/html.template
index f8eace58..578a6400 100755
--- a/components/services/instance%2Fcollection%2Fbrosing-topologiske-katalogkort/html.template
+++ b/components/services/instance%2Fcollection%2Fbrosing-topologiske-katalogkort/html.template
@@ -20,7 +20,7 @@
 			
     <h1>{{first.main.label.value}} <span class="badge">{{ first.count.total.value }}</span></h1>
        	{% for row in models.main %}
-    	<p>{{ row.description.value }}</p>
+    	<p class="lead">{{ row.description.value }}</p>
 		{% endfor %}
     
    {% if first.haspart.part.value != null %}
diff --git a/components/services/instance%2Fcollection%2Fbrosing-topologiske-katalogkort/queries/haspart.query b/components/services/instance%2Fcollection%2Fbrosing-topologiske-katalogkort/queries/haspart.query
index 9589af89..aa41e4d3 100755
--- a/components/services/instance%2Fcollection%2Fbrosing-topologiske-katalogkort/queries/haspart.query
+++ b/components/services/instance%2Fcollection%2Fbrosing-topologiske-katalogkort/queries/haspart.query
@@ -2,7 +2,7 @@ SELECT * WHERE {
 	{ SELECT DISTINCT ?part ?title ?description WHERE {
 	<http://data.ub.uib.no/instance/collection/brosing-topologiske-katalogkort> dct:hasPart ?part .
 
-	OPTIONAL { ?part dct:title ?title . }
+	OPTIONAL { ?part rdfs:label ?title . }
 	OPTIONAL { ?part dct:description ?description . }
     }
     ORDER BY ?part
diff --git a/components/services/instance%2Fcollection/html.template b/components/services/instance%2Fcollection/html.template
index dd8f1ef7..73e2280b 100755
--- a/components/services/instance%2Fcollection/html.template
+++ b/components/services/instance%2Fcollection/html.template
@@ -1,25 +1,68 @@
 {%include "../../includes/header.inc"%}
      <div class="container main-body">
     	<div class="row">
-			<div class="col-md-3 hidden-xs hidden-sm">
-			
-			<div id="bs-sidebar affix">
+			<div class="col-md-3">
+			<div class="bs-sidebar hidden-xs hidden-sm affix">
 			{% if first.main.logo != null %}
-				<img class="img-circle img-border img-responsive" src="{{first.main.logo.value}}">
+				<img class="collection-logo img-circle img-border img-responsive" src="{{first.main.logo.value}}">
 			{% endif %}
-				<div class="browse-sidebar">
-					<h4>Bla i:</h4>
-					<ul class="nav">
-						{%include "../../includes/nav.inc"%}
-					</ul>
-				</div>					
-				</div> <!-- End Sidebar -->
+			
+			<form action="{{lodspk.this.local}}" method="POST">
+			    <div class="input-group">
+			      <span class="input-group-btn">
+			        <button class="btn btn-info" type="submit"><span class="glyphicon glyphicon-search"></span></button>
+			      </span>
+			      <input type="text" class="form-control" name="query" placeholder="Søk i samlingen">
+			    </div><!-- /input-group -->
+			</form>
+			
+			<div class="browse-sidebar">
+				<h4>Bla i <span class="marcus-logo">Marcus</span></h4>
+				<ul class="list-unstyled">
+					{% include "../../includes/nav.inc" %}
+				</ul>
 			</div>
+							
+		</div> <!-- End Sidebar -->
+	</div>
 			
 			<div class="col-md-9">
 			
     <h1>{{first.main.label.value}} <span class="badge">{{ first.count.total.value }}</span></h1>
     <p class="lead">{{ first.main.description.value }}</p>
+  
+<!--
+    <div id="timeline-embed"></div>
+    <script type="text/javascript">
+        var timeline_config = {
+            width:              '100%',
+            height:             '450',
+            source:             'timeline.json',
+            embed_id:           'timeline-embed',               //OPTIONAL USE A DIFFERENT DIV ID FOR EMBED
+            start_at_end:       false,                          //OPTIONAL START AT LATEST DATE
+            start_at_slide:     '1',                            //OPTIONAL START AT SPECIFIC SLIDE
+            start_zoom_adjust:  '2',                            //OPTIONAL TWEAK THE DEFAULT ZOOM LEVEL
+            hash_bookmark:      true,                           //OPTIONAL LOCATION BAR HASHES
+            debug:              true,                           //OPTIONAL DEBUG TO CONSOLE
+            maptype:            'sterrain',                   //OPTIONAL MAP STYLE
+            lang:               'no',                           //OPTIONAL LANGUAGE
+            js:                 '{{lodspk.home}}js/TimelineJS/compiled/js/timeline-min.js',    //OPTIONAL PATH TO JS
+            css:                '{{lodspk.home}}js/TimelineJS/compiled/css/timeline.css'   //OPTIONAL PATH TO CSS
+        }
+    </script>
+    <script type="text/javascript" src="{{lodspk.home}}js/TimelineJS/compiled/js/storyjs-embed.js"></script>
+-->
+    
+    <h2>{% if lodspk.query %} / <small>"{{lodspk.query}}"</small> {%else%}/ <small>{{first.count.total.value}}</small>{%endif%}</h2>
+	{% if lodspk.query %}
+	<ul class="list-unstyled">
+		{% for row in models.search %}
+	   		<li><a href="{{ row.doc.value }}"><span class="glyphicon glyphicon-book"></span>  {{row.label.value}}</a></li>
+	   	{% endfor %}
+	</ul>
+	{% else %}
+
+
     
    {% if first.photographlist.imgUri != null %}
    {% for row in models.photographlist %}
@@ -45,8 +88,9 @@
 	</ul>
 	{% endif %}
     
-    
-        {% if first.count.total.value > 100 %}
+    	{% endif %}
+    	
+        {% if !lodspk.query && first.count.total.value > 100 %}
         <script>
 	    if ("{{lodspk.args.arg1}}".length < 1)
 	    	{page = 0;}
@@ -74,9 +118,7 @@
 				$("#next").attr("href",next_uri);
 			};
 		document.write('</ul>');
-		
 		</script>
-
 	{% endif %}
         
         </div></div></div>
diff --git a/components/services/instance%2Fcollection/queries/search.query b/components/services/instance%2Fcollection/queries/search.query
new file mode 100644
index 00000000..cc30e62d
--- /dev/null
+++ b/components/services/instance%2Fcollection/queries/search.query
@@ -0,0 +1,12 @@
+SELECT DISTINCT ?uri ?doc ?label WHERE {
+
+{% if lodspk.query %}
+?uri text:query ('{{lodspk.query}}') .
+?doc dct:isPartOf <{{uri}}> .
+?uri ?p ?doc .
+?doc a ?class .
+?class rdfs:subClassOf+ bibo:Document .
+OPTIONAL { ?doc rdfs:label ?label . }
+{% endif %}
+}
+LIMIT 100
diff --git a/components/services/instance%2Fcollection/queries/timeline.query b/components/services/instance%2Fcollection/queries/timeline.query
new file mode 100644
index 00000000..5463c049
--- /dev/null
+++ b/components/services/instance%2Fcollection/queries/timeline.query
@@ -0,0 +1,12 @@
+SELECT DISTINCT ?startDate ?media ?headline ?text ?thumbnail ?year ?month ?day WHERE { 
+?media a ubbont:Charter .
+?media dct:isPartOf <http://data.ub.uib.no/instance/collection/diplomsamlingen> .
+?media ubbont:hasPage/ubbont:hasThumbnail ?thumbnail;
+dct:created ?startDate ;
+rdfs:label ?headline ;
+dct:description ?text . 
+BIND ( year(?startDate) AS ?year ) 
+BIND ( month(?startDate) AS ?month ) 
+BIND ( day(?startDate) AS ?day ) 
+FILTER(regex(str(?thumbnail), "_1_thumb", "i"))
+}
diff --git a/components/services/instance%2Fperson/queries/main.query b/components/services/instance%2Fperson/queries/main.query
index e262c72f..bd9a3685 100755
--- a/components/services/instance%2Fperson/queries/main.query
+++ b/components/services/instance%2Fperson/queries/main.query
@@ -1,5 +1,7 @@
 SELECT ?name ?sameAs ?deathDate ?birthDate WHERE {
-    <http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> <http://xmlns.com/foaf/0.1/name> ?name .
+	<http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> a foaf:Person .
+	OPTIONAL { <http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> foaf:name ?name . }
+	OPTIONAL { <http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> ubbont:invertedName ?name . }
     OPTIONAL { <http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> <http://dbpedia.org/ontology/birthDate> ?birthDate . }
     OPTIONAL { <http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> <http://dbpedia.org/ontology/deathDate> ?deathDate . }
     OPTIONAL { <http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> owl:sameAs ?sameAs . }
diff --git a/components/services/instance%2Fperson/queries/related.query b/components/services/instance%2Fperson/queries/related.query
index e9f8fb85..19e5dd52 100755
--- a/components/services/instance%2Fperson/queries/related.query
+++ b/components/services/instance%2Fperson/queries/related.query
@@ -1,7 +1,10 @@
 SELECT * WHERE {
 	{
-	SELECT ?label ?uri ?image ?p WHERE {
-    <http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> ?p ?uri .
+	SELECT DISTINCT ?label ?uri ?image ?p WHERE {
+	{
+    <http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> ?p ?uri . } 
+    UNION 
+    {?uri ?p <http://data.ub.uib.no/instance/person/{{ lodspk.args.arg0 }}> .}
     ?uri a ?class .
     ?class rdfs:subClassOf+ bibo:Document .
 	OPTIONAL { ?uri ubbont:hasRepresentation/ubbont:hasURI ?image . }
diff --git a/components/services/persons/html.template b/components/services/persons/html.template
index 714d83f1..dc4df991 100755
--- a/components/services/persons/html.template
+++ b/components/services/persons/html.template
@@ -3,48 +3,52 @@
     	<div class="row">
 			<div class="col-md-3">
 			<div class="bs-sidebar hidden-xs hidden-sm affix">
-								
-					<h4>Bla i:</h4>
-					<ul class="nav">
-						{%include "../../includes/nav.inc"%}
-					</ul>
+			
+			<form action="{{lodspk.this.local}}" method="POST">
+			    <div class="input-group">
+			      <span class="input-group-btn">
+			        <button class="btn btn-info" type="submit"><span class="glyphicon glyphicon-search"></span></button>
+			      </span>
+			      <input type="text" class="form-control" name="query" placeholder="Søk etter person">
+			    </div><!-- /input-group -->
+			</form>
+			
+			<h5>Hvorfor er det mange dubletter?</h5>
+			<p>Siden vi har konvertert innholdet til <span class="marcus-logo">Marcus</span> fra mange kilder kan det oppstå dubletter. Det er heller ikke så lett å si med sikkerhet om det er samme person som er nevnes i de eldre delene av samlingene.</p>
+						
+			<div class="browse-sidebar">
+				<h4>Bla i <span class="marcus-logo">Marcus</span></h4>
+				<ul class="list-unstyled">
+					{% include "../../includes/nav.inc" %}
+				</ul>
+			</div>
 				</div> <!-- End Sidebar -->
 			</div>
 			
 			<div class="col-md-9">
 			
-			<div class="row service-search">
-			<h1>Personer {% if lodspk.query %} - <small>"{{lodspk.query}}"</small> {%endif%}</h1>
-
-			{% include "/../../includes/search.inc" %}
+			<div class="service-search">
+			<h1>Personer {% if lodspk.query %} / <small>"{{lodspk.query}}"</small> {%else%}/ <small>{{first.count.total.value}}</small>{%endif%}</h1>
 			</div>
 
-			<div class="row">
 			<ul class="agent-list list-unstyled">
 				{% if lodspk.query %} 
 					{% for row in models.search %}
-				   		<li><a href="{{ row.x.value }}"><span class="glyphicon glyphicon-user"></span>  {{row.name.value}}</a><br />
-                	                                {% if row.imgUriUri.value %}
-                                                <a href="{{ row.imgUriUri.value }}"><img class="col-md-10 thumbnail" data-src="holder.js/300x200" src="{{row.depictionImage.value}}" alt=""></a>
-                                        {% endif %}
-                                </li>
-				{% endfor %}
+				   		<li><a href="{{ row.uri.value }}"><span class="glyphicon glyphicon-user"></span>  {{row.label.value}}</a></li>
+				   	{% endfor %}
 				{% else %}
-			                {% for row in models.main %}
-				   	        <li><a href="{{ row.x.value }}"><span class="glyphicon glyphicon-user"></span>  {{row.name.value}}</a><br />
-                                                {% if row.imgUriUri.value %}
-                                                <a href="{{ row.imgUriUri.value }}"><img class="col-md-10 thumbnail" data-src="holder.js/300x200" src="{{row.depictionImage.value}}" alt=""></a>
-                                        {% endif %}
-                                </li>
-
-                                {% endfor %}
+			        {% for row in models.main %}
+				   	    <li><a href="{{ row.uri.value }}"><span class="glyphicon glyphicon-user"></span>  {{row.label.value}}</a></li>
+                    {% endfor %}
 				{% endif %}
 			</ul>
-      </div>
+			
+			{% if lodspk.query %}
+			<p><span class="glyphicon glyphicon-arrow-left"></span> <a href="{{lodspk.this.local}}">Tilbake til personlisten</a></p>
+			{% endif %}
 
-      
-     <div class="row">
-    <div class="col-md-9 col-lg-9 col-md-offset-3 col-lg-offset-3">
+    {% if !lodspk.query && first.count.total.value > 100 %}  
+    <div>
         <script>
 	    if ("{{lodspk.args.arg0}}".length < 1)
 	    	{page = 0;}
@@ -55,23 +59,26 @@
 	    var offset = 100;
 	  	
 	    var nextPage = page+offset;
-		var prevPage = page - offset;
+		var prevPage = page-offset;
 		var next_uri = '{{lodspk.home}}persons/'+ nextPage;
 	    var prev_uri = '{{lodspk.home}}persons/'+ prevPage;
-		</script>
-	    <ul class="pager">
-	    	<li><a href="" id="prev">Forrige 100</a></li>
-			<li><a href="" id="next">Neste 100</a></li>
-	    </ul>
-		<script>
-		$("#next").attr("href",next_uri);
-		$("#prev").attr("href",prev_uri);
-	</script>
-		
-		
- </div>
-    </div> <!-- End Row -->
-    
+		document.write('<ul class="pager">');
+			if (prevPage == 0){
+				document.write('<li><a href="http://marcus.uib.no/instance/collection/{{lodspk.args.arg0}}" id="prev">Forrige 100</a></li>');
+			}		
+			else if ("{{lodspk.args.arg1}}".length > 1 && !("{{lodspk.args.arg1}}".length === 0)){
+				document.write('<li><a href="" id="prev">Forrige 100</a></li>');
+				$("#prev").attr("href",prev_uri);
+			};
+	
+			if ({{first.count.total.value}} > nextPage){
+				document.write('<li><a href="" id="next">Neste 100</a></li>');
+				$("#next").attr("href",next_uri);
+			};
+		document.write('</ul>');
+		</script>	
+	 </div>
+	 {% endif %}
 
 </div></div></div>
 
diff --git a/components/services/persons/queries/count.query b/components/services/persons/queries/count.query
new file mode 100644
index 00000000..12d5f312
--- /dev/null
+++ b/components/services/persons/queries/count.query
@@ -0,0 +1,3 @@
+SELECT (COUNT(?uri) AS ?total) WHERE {
+	?uri a foaf:Person . 
+}  
diff --git a/components/services/persons/queries/main.query b/components/services/persons/queries/main.query
index 49978788..18ced80f 100755
--- a/components/services/persons/queries/main.query
+++ b/components/services/persons/queries/main.query
@@ -1,5 +1,8 @@
-SELECT ?x ?name WHERE {
-?x a foaf:Person ; foaf:name ?name . }
-GROUP BY ?x ?name
-    ORDER BY ?name
+SELECT DISTINCT ?uri ?label WHERE {
+	?uri a foaf:Person .
+	OPTIONAL { ?uri foaf:name ?label .}
+	OPTIONAL { ?uri ubbont:invertedName ?label . }
+}
+GROUP BY ?uri ?label
+ORDER BY ?label
 OFFSET {{lodspk.args.arg0|default:0}} LIMIT 100
diff --git a/components/services/persons/queries/search.query b/components/services/persons/queries/search.query
index 39e686bb..2a984143 100755
--- a/components/services/persons/queries/search.query
+++ b/components/services/persons/queries/search.query
@@ -1,21 +1,24 @@
-SELECT DISTINCT ?x ?name WHERE {
+SELECT DISTINCT ?uri ?label WHERE {
 
 {% if lodspk.query %}
-{ ?x text:query ( foaf:name '{{lodspk.query}}');
-a foaf:Person ;
-foaf:name ?name . 
+{ ?uri text:query ( foaf:name '{{lodspk.query}}');
+a foaf:Person .
+OPTIONAL { ?uri foaf:name ?label . }
+OPTIONAL { ?uri ubbont:invertedName ?label . }
 }
 UNION
 {
-?x text:query ( foaf:firstName '{{lodspk.query}}');
-a foaf:Person ;
-foaf:name ?name . 
+?uri text:query ( foaf:firstName '{{lodspk.query}}');
+a foaf:Person .
+OPTIONAL { ?uri foaf:name ?label . }
+OPTIONAL { ?uri ubbont:invertedName ?label . } 
 }
 UNION
 {
-?x text:query ( foaf:familyName '{{lodspk.query}}');
-a foaf:Person ;
-foaf:name ?name . 
+?uri text:query ( foaf:familyName '{{lodspk.query}}');
+a foaf:Person .
+OPTIONAL { ?uri foaf:name ?label . }
+OPTIONAL { ?uri ubbont:invertedName ?label . }
 }
 {% endif %}
 }
diff --git a/components/services/persons/queries/test.txt b/components/services/persons/queries/test.txt
deleted file mode 100755
index e69de29b..00000000
diff --git a/components/services/search/html.template b/components/services/search/html.template
index 88eb1bc1..ab073290 100755
--- a/components/services/search/html.template
+++ b/components/services/search/html.template
@@ -19,12 +19,16 @@
 			</div>
 			
 	<div class="col-md-9">
-      <h1>Treff på  "{{lodspk.args.arg0}}"</h1>
+      <h1><span class="text-muted">Du søkte på</span> "{{lodspk.args.arg0}}"</h1>
+        {% if models.main|length != 0 %}
         <ul class="nav">
-    {% for row in models.main %}
-        <li><a href="{{ row.resource.value }}">{{row.label.curie}}</a></li>
-    {% endfor %}
-    </ul>
+	    {% for row in models.main %}
+	        <li><a href="{{ row.resource.value }}">{{row.label.curie}} <span class="label label-primary">{{row.classLabel.value}}</span></a></li>
+	    {% endfor %}
+	    {% else %}
+	    	<h2>Ingen treff</h2>
+	    {% endif %}
+	    </ul>
    </div>
    
    </div></div>
diff --git a/components/services/search/queries/main.query b/components/services/search/queries/main.query
index 85b6b298..01ac78fc 100755
--- a/components/services/search/queries/main.query
+++ b/components/services/search/queries/main.query
@@ -1,7 +1,12 @@
-SELECT DISTINCT ?resource ?label WHERE {
+SELECT DISTINCT ?resource ?label ?classLabel WHERE {
   ?resource text:query ('{{lodspk.args.arg0}}') .
-
-  ?resource skos:prefLabel ?label .
+  OPTIONAL { ?resource skos:prefLabel ?label . }
+  OPTIONAL { ?resource foaf:name ?label . }
+  OPTIONAL { ?resource ubbont:invertedName ?label . }
+  OPTIONAL { ?resource rdfs:label ?label . }
+  ?resource rdf:type ?class .
+  ?class rdfs:label ?classLabel .
+  FILTER(langMatches(lang(?classLabel), ""))
   }
   
 
diff --git a/components/services/timeline/html.template b/components/services/timeline/html.template
new file mode 100644
index 00000000..ee6ef0b2
--- /dev/null
+++ b/components/services/timeline/html.template
@@ -0,0 +1,37 @@
+{%include "../../includes/header.inc"%}
+    <div class="container main-body">
+    	
+    	<div class="row">
+			
+			
+	<div class="col-md-12">
+      <h1>Tidslinje</h1>
+      <div id="timeline-embed"></div>
+    <script type="text/javascript">
+    	
+        var timeline_config = {
+            width:              '100%',
+            height:             '650',
+            source:             'timeline.json',
+            embed_id:           'timeline-embed',               //OPTIONAL USE A DIFFERENT DIV ID FOR EMBED
+            start_at_end:       false,                          //OPTIONAL START AT LATEST DATE
+            start_at_slide:     '1',                            //OPTIONAL START AT SPECIFIC SLIDE
+            start_zoom_adjust:  '2',                            //OPTIONAL TWEAK THE DEFAULT ZOOM LEVEL
+            hash_bookmark:      true,                           //OPTIONAL LOCATION BAR HASHES
+            debug:              true,                           //OPTIONAL DEBUG TO CONSOLE
+            maptype:            'sterrain',                   //OPTIONAL MAP STYLE
+            lang:               'no',                           //OPTIONAL LANGUAGE
+            js:                 '{{lodspk.home}}js/TimelineJS/compiled/js/timeline-min.js',    //OPTIONAL PATH TO JS
+            css:                '{{lodspk.home}}js/TimelineJS/compiled/css/timeline.css'   //OPTIONAL PATH TO CSS
+        }
+    </script>
+    <script type="text/javascript" src="{{lodspk.home}}js/TimelineJS/compiled/js/storyjs-embed.js"></script>
+          
+   </div>
+   
+   </div>
+   </div>
+   {%include "../../includes/footer.inc"%}
+
+  </body>
+</html>
diff --git a/components/services/timeline/json.template b/components/services/timeline/json.template
new file mode 100644
index 00000000..ea9b26b2
--- /dev/null
+++ b/components/services/timeline/json.template
@@ -0,0 +1,24 @@
+{
+	"timeline":
+	{
+	"headline":"Diplomsamlingen - tidslinje",
+        "type":"default",
+        "text":"<p>Se våre diplom på tidslinjen.</p>",
+        "asset": {
+            "media":"http://marcus.uib.no/instance/collection/diplomsamlingen"
+        },
+               
+            "date": [
+            {%for row in models.timeline%}{%if !forloop.first && models.timeline|length > 1%},{%endif%}
+            {
+                "startDate":"{% if row.year %}{{row.year.value}}{% else %}1654{% endif %}{% if row.month %},{{row.month.value}}{% if row.day %}{% endif %},{{row.day.value}}{% endif %}",
+                "headline":"{{row.headline.value}}",
+                "text":"<p>{{row.text.value}}</p><p><a href=\"{{row.media.value}}\">Se mer</a></p>",
+                "asset": {
+                    "media":"{{row.thumbnail.value}}",
+                    "thumbnail":"{{row.thumbnail.value}}"
+                }
+            }{%endfor%}
+        ]
+    }
+}
\ No newline at end of file
diff --git a/components/services/timeline/queries/timeline.query b/components/services/timeline/queries/timeline.query
new file mode 100644
index 00000000..cef0a249
--- /dev/null
+++ b/components/services/timeline/queries/timeline.query
@@ -0,0 +1,11 @@
+SELECT DISTINCT ?startDate ?media ?headline ?text ?thumbnail ?year ?month ?day WHERE { 
+?media dct:isPartOf <{{uri}}> .
+?media ubbont:hasPage/ubbont:hasThumbnail ?thumbnail;
+dct:created ?startDate ;
+rdfs:label ?headline ;
+dct:description ?text . 
+BIND ( year(?startDate) AS ?year ) 
+BIND ( month(?startDate) AS ?month ) 
+BIND ( day(?startDate) AS ?day ) 
+FILTER(regex(str(?thumbnail), "_1_thumb", "i"))
+}
diff --git a/components/services/topics/html.template b/components/services/topics/html.template
index b6073f03..b4580210 100755
--- a/components/services/topics/html.template
+++ b/components/services/topics/html.template
@@ -2,22 +2,49 @@
 	<div class="container main-body">
     	<div class="row">
 			<div class="col-md-3">
-				<div class="sidebar hidden-xs hidden-sm affix">
-					<h4>Bla i:</h4>
-					<ul class="nav">
-						{%include "../../includes/nav.inc"%}
-					</ul>
+				<div class="bs-sidebar hidden-xs hidden-sm affix">
+
+			<form action="{{lodspk.this.local}}" method="POST">
+			    <div class="input-group">
+			      <span class="input-group-btn">
+			        <button class="btn btn-info" type="submit"><span class="glyphicon glyphicon-search"></span></button>
+			      </span>
+			      <input type="text" class="form-control" name="query" placeholder="Søk etter emne">
+			    </div><!-- /input-group -->
+			</form>
+			
+			<div class="browse-sidebar">
+				<h4>Bla i <span class="marcus-logo">Marcus</span></h4>
+				<ul class="list-unstyled">
+					{% include "../../includes/nav.inc" %}
+				</ul>
+			</div>
+
 				</div> <!-- End Sidebar -->
 			</div>
 			
 			<div class="col-md-9">
-				<h1>Emner</h1>
-				
+			<h1>Emner {% if lodspk.query %} / <small>"{{lodspk.query}}"</small> {%else%}/ <small>{{first.count.total.value}}</small>{%endif%}</h1>
+
+		
+				{% if lodspk.query %} 
+				<ul class="agent-list list-unstyled">
+					{% for row in models.search %}
+				   		<li><a href="{{ row.uri.value }}"><span class="glyphicon glyphicon-user"></span>  {{row.label.value}}</a></li>
+				   	{% endfor %}
+				</ul>
+				{% else %}
 				<ul class="nav nav-stacked">
 			    {% for row in models.main %}
 			        <li><a href="{{ row.uri.value }}"><span class="glyphicon glyphicon-tag"></span> {{row.label.value}}</a></li>
 			    {% endfor %}
 			    </ul>
+				{% endif %}
+		
+			{% if lodspk.query %}
+			<p><span class="glyphicon glyphicon-arrow-left"></span> <a href="{{lodspk.this.local}}">Tilbake til emnelisten</a></p>
+			{% endif %}
+
 			</div>
 		</div>
     </div>
diff --git a/components/services/topics/queries/count.query b/components/services/topics/queries/count.query
new file mode 100644
index 00000000..8aa7a749
--- /dev/null
+++ b/components/services/topics/queries/count.query
@@ -0,0 +1,3 @@
+SELECT (COUNT(?uri) AS ?total) WHERE { 
+	?uri a skos:Concept .
+}  
diff --git a/components/services/topics/queries/search.query b/components/services/topics/queries/search.query
new file mode 100644
index 00000000..acf52174
--- /dev/null
+++ b/components/services/topics/queries/search.query
@@ -0,0 +1,9 @@
+SELECT DISTINCT ?uri ?label WHERE {
+
+{% if lodspk.query %}
+?uri text:query ( skos:prefLabel '{{lodspk.query}}') .
+?uri a skos:Concept .
+OPTIONAL { ?uri skos:prefLabel ?label . }
+{% endif %}
+}
+LIMIT 100
diff --git a/components/static/css/basic.css b/components/static/css/basic.css
index 0823afa9..c910acbe 100755
--- a/components/static/css/basic.css
+++ b/components/static/css/basic.css
@@ -49,8 +49,14 @@
   }
 
 }
+.bs-sidebar { margin-top: 20px;}
+.bs-sidebar h3 {border-bottom: solid 1px #ddd; padding-bottom: 5px; font-size: 1.4em;}
+.bs-sidebar p.maker { font-size: 1.3em; font-style: oblique; margin-bottom: 20px; }
+.bs-sidebar ul span { color: black !important; padding-left: 2px; margin-right: 3px; }
+.bs-sidebar ul.nav li a { padding: 10px 15px 10px 0; }
+.marcus-logo { font-family: 'IM Fell Great Primer', serif; text-transform: uppercase; }
 
-#resource-metadata { border-top: 1px solid #eee;}
+#resource-metadata { }
 
 /* HEADER */
 .navbar-brand { font-family: 'IM Fell Great Primer', serif; font-size: 2.6em !important; text-transform: uppercase; color: white !important; }
@@ -59,14 +65,16 @@
 .beta { color: white !important; padding: 5px 15px 5px 15px; margin-bottom: 0 !important; background-color: #e05435; margin-top: 10px !important; font-style: italic; font-family: georgia,  serif;}
 
 /* MAP */
-.map-wrap, #map-wrap { width: 100%; margin: 15px 0 15px 0; padding: 10px; background-color: #fffffa; border: 1px solid #ccc; -moz-box-shadow: 0px 0px 10px #bbb;
+.map-wrap, #map-wrap { width: 100%;  background-color: #fffffa; border: 1px solid #eee; 
+	/*-moz-box-shadow: 0px 0px 10px #bbb;
 	-webkit-box-shadow: 0px 0px 10px #bbb;
-        box-shadow: 0px 0px 10px #bbb; clear: both;}
+        box-shadow: 0px 0px 10px #bbb; */
+        clear: both;}
 #map {width: 100%; height: 450px;}
 .no-map { background-image: url(../img/no-map-bg.png); }
 
 /* DISQUS */
-#disqus_thread { margin-top: 50px; padding-top: 20px; border-top: dotted 1px #bbb;}
+#disqus_thread { margin-top: 50px; padding-top: 20px; border-top: dotted 1px #bbb; clear: both;}
 
 
 /* CATALOGUE CARD */
@@ -95,6 +103,11 @@ column-count:2;
 .list-centered { text-align: center; }
 .list-centered li { margin: 0 10px; }
 
+/* DEPICTED */
+#depicted { margin-bottom: 25px;}
+#depicted .depicted { text-align: center; background-color: #eef9ff; padding: 20px 10px 10px 10px; }
+#depicted .depicted img { width: 100px; margin-bottom: 10px; }
+
 /* SPO view */
 .full-metadata-div { margin: 15px 0 ;}
 
@@ -105,7 +118,7 @@ figure { margin-left: 0; }
 figcaption { font-size: 1.1em; }
 .img-border { border: 1px solid #999; }
 img.img-resource { margin: 10px 0 20px 0; border: #bbb solid 1px; padding: 10px; background-color: #fffffa; border: 1px solid #ccc; -moz-box-shadow: 0px 0px 10px #bbb; -webkit-box-shadow: 0px 0px 10px #bbb; box-shadow: 0px 0px 10px #bbb; }
-        
+.collection-logo { margin-bottom: 30px; }
 /* iphone */
 @media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
 	img.img-resource { max-width: 98%; }
@@ -224,7 +237,7 @@ footer {
 
 /* DZI */
 .dzi-wrap {
-	margin: 0; padding: 0 !important;
+	padding: 0 !important;
 }
 #dzi1 {
     height: 800px;
@@ -242,6 +255,11 @@ input[id="pagenum"] {
   display: inline;
 }
 
+p.beta {
+	cursor: hand;
+	cursor: pointer;
+}
+
 /*  SimpleCart.js styles
 -------------------------------------------------- */
 .item_Quantity {width: 40px;}
diff --git a/components/static/index.html b/components/static/index.html
index d0d108e0..13bdac28 100755
--- a/components/static/index.html
+++ b/components/static/index.html
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html lang="no" prefix="og: http://ogp.me/ns#">
   <head>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     <meta charset="utf-8">
     
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -52,12 +53,14 @@
     <link rel="alternate" type="application/json" title="RDFJSON Version" href="{{lodspk.local.value}}.json" />
     <style>
       body {padding-top: 50px;}
+/*
       .wait{
         background-image:url('{{lodspk.home}}img/wait.gif');
         background-repeat:no-repeat;
         padding-right:20px;
         background-position: right;
       }
+*/
     </style>
 <!--     <link href="{{lodspk.home}}css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css" media="screen" /> -->
 
@@ -102,6 +105,26 @@
             </button>
             <a class="navbar-brand" href="{{lodspk.home}}">{{lodspk.title}}</a>
             <a class="nav-subtitle hidden-xs hidden-sm" href="{{lodspk.home}}"><small>Spesialsamlingene ved <br>Universitetet i Bergen</small></a>
+            
+            <div id="popover-beta-head" style="display: none;">
+			<strong>Marcus - Beta</strong>
+			</div>
+			<div id="popover-beta-content" style="display: none;">
+				<p>Marcus har fått en grundig overhaling og nettsidene kan ha noen feil. Vi jobber daglig med å gjøre sidene bedre.</p> 
+			</div>
+			<p rel="popover" class="navbar-text pull-right hidden-xs hidden-sm beta">Beta</p> 
+			<script>
+				$('.beta').popover({ 
+					placement : 'bottom',
+				    html : true,
+				    title: function() {
+				      return $("#popover-beta-head").html();
+				    },
+				    content: function() {
+				      return $("#popover-beta-content").html();
+				    }
+				});
+			</script>  
           </div>
 
           
@@ -109,11 +132,12 @@
             <ul class="nav navbar-nav">
 <!--               <li><a href="{{lodspk.home}}">Hjem</a></li> -->
               <li class="dropdown">
-				  <a id="browse1" class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="#">Meny <span class="caret"></span></a>              				
+				  <a id="browse1" class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="#"> Manuskript- og librarsamlingen <span class="caret"></span></a>              				
 				  <ul class="dropdown-menu list-unstyled" aria-labelledby="browse1" role="meny">
 					  {%include "../includes/nav.inc"%}
 					</ul>
 				</li>
+				<li><a href="http://marcus.app.uib.no/">Billedsamlingen</a></li>
 			</ul>
 						
 			<form class="navbar-form navbar-right" role="search" action="">
@@ -129,25 +153,7 @@
             	}
             </script>
 
-            <div id="popover-beta-head" style="display: none;">
-				<strong>Marcus - Beta</strong>
-			</div>
-			<div id="popover-beta-content" style="display: none;">
-				<p>Marcus har fått en grundig overhaling og nettsidene kan ha noen feil. Vi jobber daglig med å gjøre sidene bedre.</p> 
-			</div>
-			<p rel="popover" class="navbar-text pull-right hidden-xs hidden-sm beta">Beta</p> 
-			<script>
-				$('.beta').popover({ 
-					placement : 'bottom',
-				    html : true,
-				    title: function() {
-				      return $("#popover-beta-head").html();
-				    },
-				    content: function() {
-				      return $("#popover-beta-content").html();
-				    }
-				});
-			</script>                        
+                      
           </nav><!--/.nav-collapse -->
         
       </header>
@@ -270,7 +276,6 @@
 	
 	<div class="row inline-browse-menu hidden-xs hidden-sm">
 		<ul class="list-unstyled list-centered list-inline">
-		<li><strong>Se også:</strong></li>
 			{%include "../includes/nav.inc"%}
 		</ul>
 	</div>
diff --git a/components/static/js/TimelineJS b/components/static/js/TimelineJS
new file mode 160000
index 00000000..974c19d1
--- /dev/null
+++ b/components/static/js/TimelineJS
@@ -0,0 +1 @@
+Subproject commit 974c19d19bad13ba0003a7c9afec477cfea2548d
diff --git a/components/types/bibo__Document/html.template b/components/types/bibo__Document/html.template
index 9ef9830e..4671ae8b 100755
--- a/components/types/bibo__Document/html.template
+++ b/components/types/bibo__Document/html.template
@@ -1,52 +1,141 @@
 {% include "../../includes/header.inc" %}
-    <div class="container main-body">
+    <div itemscope itemtype="http://schema.org/CreativeWork" class="container main-body">
     	
-    	<div class="row">
-    	
-    	</div>
-    	
-    	<div class="row">
-			<div class="col-md-3">
+    <div class="row">
+	<div class="col-md-3">
 			<div class="bs-sidebar hidden-xs hidden-sm affix">
-				<ul class="nav">
-				
-					<li><a href="#image"><span class="glyphicon glyphicon-picture"></span> Foto</a></li>
-					{% if first.transcription.html.value != null %}
-						<li><a href="#transcription"><span class="glyphicon glyphicon-align-left"></span> Transkripsjon</a></li>
-					{% endif %}
-					{% if first.subjects.subject.value != null %}
-						<li><a href="#subjects"><span class="glyphicon glyphicon-tags"></span> Emner</a></li>
-					{% endif %}
-					{% if first.depicted.depicts.value != null %}
-						<li><a href="#places"><span class="glyphicon glyphicon-user"></span> Personer</a></li>
-					{% endif %} 
-					{% if models.places|length != 0 %}
-						<li><a href="#places"><span class="glyphicon glyphicon-map-marker"></span> Steder</a></li>
-					{% endif %} 
-					<li><a href="#disqus_thread"><span class="glyphicon glyphicon-bullhorn"></span> Kommentarer</a></li>
-				</ul>
-				
-				<div class="feedback-error alert alert-warning">
-					<p><a href="mailto:billed@uib.no"><span class="glyphicon glyphicon-exclamation-sign"></span> Feil!? Gi oss beskjed!</a></p>
-				</div>
+			
+		    <p>
+		    	{% for row in models.main %}
+			    <strong>{{ row.classLabel.value }}</strong>
+				{% endfor %} 
+				{% if first.maker.maker.value == null %}</p>{% endif %}
 				
-				<div class="browse-sidebar">
-					<h4>Bla i:</h4>
-					<ul class="nav">
-						{% include "../../includes/nav.inc" %}
-					</ul>
-				</div>	
-				</div> <!-- End Sidebar -->
+		    {% if first.maker.maker.value != null %}
+		    	<small>skapt av</small></p>
+			    <p class="maker"><span class="glyphicon glyphicon-pencil"></span> 
+			    {% for row in models.maker %}
+			    	<span itemprop="creator" itemscope itemtype="http://schema.org/Person"><a itemprop="url" href="{{ row.maker.value }}">{{ row.makerName.value }}</a></span> {% if !forloop.last %}, {% endif %}
+			    {% endfor %}
+			    </p>
+		    {% endif %}
+		    
+		    {% if first.main.created.value != null || first.main.date.value != null %}
+				    <p><strong><span class="glyphicon glyphicon-calendar"></span> 
+				    	Dato: <span itemprop="dateCreated">{% if first.main.date.value %}{{ first.main.date.value }} {% endif %}{{ first.main.created.value }}</span>
+				    </strong></p>
+					<hr>
+			{% endif %}
+		    
+		    {% for row in models.published %}
+	    	<p><small>Publisert i</small><br><a href="{{row.uri.value}}">{{row.label.value}}</a> {% if row.vol %} vol. {{row.vol.value}} {% endif %}{% if row.issue %} nr. {{row.issue.value}} {% endif %} {% if row.pageStart && row.pageEnd %}(s. {{row.pageStart.value}}-{{row.pageEnd.value}}){% endif %}<br>{% if row.issn %}<small>ISSN: {{row.issn.value}}{% endif %}</small></p>
+			{% endfor %}
+	    
+	    	{% for row in models.publisher %}
+	    	<p><small>Utgitt av</small><br><a href="{{row.uri.value}}">{{row.label.value}}</a> {% if first.main.isbn %}<br><small>ISBN: {{first.main.isbn.value}}</small>{% endif %}</p>
+			{% endfor %}
+		    
+		    {% if models.recipient|length != 0 %}
+		    	<p><small>Mottaker</small></p>
+			    {% for row in models.recipient %}
+				    <p><a href="{{row.uri.value}}">{{ row.label.value }}</a></p>
+			    {% endfor %}
+		    {% endif %}
+		    
+		    <hr>
+					
+			<ul class="nav">
+				<li><a href="#imageTab"><span class="glyphicon glyphicon-picture"></span> Bilde</a></li>
+				{% if first.transcription.html.value != null %}
+					<li><a href="#transcription"><span class="glyphicon glyphicon-align-left"></span> Transkripsjon</a></li>
+				{% endif %}
+				{% if models.subjects|length != 0 %}
+					<li><a href="#subjects"><span class="glyphicon glyphicon-tags"></span> Emner</a></li>
+				{% endif %}
+				{% if models.depicted|length != 0 %}
+					<li><a href="#depicted"><span class="glyphicon glyphicon-user"></span> Avbildet</a></li>
+				{% endif %} 
+				{% if models.places|length != 0 %}
+					<li><a href="#places"><span class="glyphicon glyphicon-map-marker"></span> Steder</a></li>
+				{% endif %} 
+				<li><span style="padding-right: 4px;" class="glyphicon glyphicon-bullhorn"></span><a style="display: inline-block;" href="#disqus_thread"> Kommentarer</a></li>
+			</ul>
+			
+			<hr>
+
+			<ul class="list-unstyled">
+				<li><small>Signatur <!--<a href="#" data-toggle="tooltip" data-placement="top" title="test"><span class="glyphicon glyphicon-question-sign"></span></a>--></small><br>
+				<span class="glyphicon glyphicon-bookmark"></span> <a href="{{lodspk.local.curie}}">{{ first.main.identifier.value }}</a></li>
+		    
+		   {% if models.pdf|length != 0 %}
+				{% for row in models.pdf %}
+					<li><small>Last ned</small><br><span class="glyphicon glyphicon-save"></span> <a href="{{row.uri.value }}">PDF</a></li>
+				{% endfor %}
+			{% endif %}
+			{% if models.transcription|length != 0 %}
+		    	<li><small>Last ned</small><br><span class="glyphicon glyphicon-save"></span> <a href="{{first.transcription.xml.value}}">XML</a></li>
+		    {% endif %}
+		    </ul>
+		    
+			<hr>
+			
+			<div class="feedback-error">
+				<p><span class="glyphicon glyphicon-exclamation-sign"></span> <a href="mailto:billed@uib.no?subject=Marcus - tilbakemelding på {{first.main.identifier.value}}&body=Tilbakemeldingen gjelder: {{lodspk.local.curie}} (la lenken være med, vi trenger den for å svare)">Feil? Gi oss beskjed!</a></p>
 			</div>
 			
+			<div class="browse-sidebar">
+				<h4>Bla i <span class="marcus-logo">Marcus</span></h4>
+				<ul class="list-unstyled">
+					{% include "../../includes/nav.inc" %}
+				</ul>
+			</div>	
+		</div> <!-- End Sidebar -->
+	</div>
+			
 	<div class="col-md-9">
-    {% for row in models.main %}
-	    <h1>{{ row.title.value }} - {{ row.classLabel.value }}</h1>
-    {% endfor %}
-        
+	<div class="col-md-12">
+    	{% for row in models.main %}
+	    <h1 itemprop="name">{{ row.label.value }}</h1>
+	    {% if row.alternative %}
+	    	<h2><small>{{row.alternative.value}}</small></h2>
+	    {% endif %}
+		{% endfor %}
+    
+	    {% for row in models.description %}
+	    <p class="lead">{{ row.description.value }}</p>
+	    {% endfor %}
+    </div>
+    
+    {% if models.dzi|length != 0 && models.image|length != 0 %}
+    <div class="col-md-12">
+    <ul id="imageTab" class="nav nav-tabs">
+    	<li class="active"><a href="#dzi" data-toggle="tab">Zoom</a></li>
+    	<li><a href="#image" data-toggle="tab">Jpeg</a></li>
+    </ul>
+    <script>
+		$('#imageTab .nav-tabs a').click(function (e) {
+			 e.preventDefault();
+			 $(this).tab('show');
+		});
+		
+		// Javascript to enable link to tab
+		var url = document.location.toString();
+		if (url.match('#')) {
+		    $('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show') ;
+		} 
+		
+		// Change hash for page-reload
+		$('.nav-tabs a').on('shown', function (e) {
+		    window.location.hash = e.target.hash;
+		})
+	</script>
+    </div>
+    {% endif %}
+
+    <div class="tab-content col-md-12">
 	{% if models.dzi|length != 0 %}
     <!-- Contains the OpenSeadragon viewer -->
-	<div class="container dzi-wrap"> 
+	<div id="dzi" class="container dzi-wrap active tab-pane"> 
 		<div class="dzi-wrap">
             <div id="dzi1"></div>
             <div class="hidden-md hidden-lg hidden-xs hidden-sm" id="dzi2"></div>
@@ -60,7 +149,6 @@
 				</ul>
 			</div> -->
 		</div>
-	</div> 
 	 
     <script type="text/javascript" src="{{lodspk.home}}files/js/openseadragon/openseadragon.js"></script>
 	<script type="text/javascript" src="{{lodspk.home}}files/js/ubbdstjfl/ubbdst.js"></script>
@@ -105,28 +193,30 @@
             minPixelRatio: 0.5
         });
     </script>	
-    {% endif %}
-
-	{% if models.pdf|length != 0 %}
-	{% for row in models.pdf %}
-	<p><a href="{{row.uri.value }}">Last ned PDF</a></p>
-	{% endfor %}
-	{% endif %}
-<!--     <p>Signatur: <a href="{{lodspk.this.value}}">{{ first.main.identifier.value }}</a></p> -->
+    </div> 
+    {% endif %}   
     
-    {% if first.maker.maker.value != null %}
-    <p><span class="glyphicon glyphicon-pencil"></span> 
-    {% for row in models.maker %}
-    <a href="{{ row.maker.value }}">{{ row.makerName.value }}</a> {% if !forloop.last %}, {% endif %}
+    {% if models.image|length != 0 %}
+    <div id="image" class="container {% if models.dzi|length == 0 %}
+active{% endif %} tab-pane">
+    {% for row in models.image %}
+    	<div class="col-xs-12 col-sm-6 col-md-6 col-lg-4">
+        	<div class="thumbnail">
+				<a href="{{row.imageHigh.value}}"><img src="{{row.imageLow.value}}" alt=""/></a>
+<!--
+      		<div class="caption">
+      		<h3>{{ row.title.value }}</h3>
+      		</div>
+-->
+	  		</div>
+      	</div>
     {% endfor %}
-    </p>
+    </div>
     {% endif %}
-   
-    
-    {% for row in models.description %}
-    <p class="lead">{{ row.description.value }}</p>
-    {% endfor %}
+    </div> <!-- END tab-content -->
+
 	
+	<div class="col-lg-12">
     {% for row in models.physicalcondition %}
     <p>{{ row.physicalCondition.value }}</p>
     {% endfor %}
@@ -138,163 +228,161 @@
     {% for row in models.internalnote %}
     <p>{{ row.internalNote.value }}</p>
     {% endfor %}
-    
-    {% if models.image|length != 0 %}
-    <div class="row">
-    {% for row in models.image %}
-    	<div class="col-md-4 col-lg-4">
-        	
-				<a class="thumbnail" href="{{ row.imageHigh.value }}"><img class="img-responsive" src="{{row.imageLow.value}}" alt=""></img></a>
-<!--
-      		<div class="caption">
-      		<h3>{{ row.title.value }}</h3>
-      		</div>
--->
-	  		
-      	</div>
-    {% endfor %}
     </div>
-    {% endif %}
+
     
 	{% if first.transcription.html.value != null %}
-    <div id="transcription" class="row well">
+    <div id="transcription" class="col-md-12 well">
     	<iframe src="{{first.transcription.html.value}}" width="100%" height="300"></iframe>
-    	<p>Last ned XML: <a href="{{first.transcription.xml.value}}">{{first.transcription.xml.value}}</a></p>
     </div>
     {% endif %}
-  
-    
-    
-    <div id="resource-metadata" class="row">	
     
+    {% if models.subjects|length != 0 %}
+	<div id="subjects" class="col-md-12">
+		<ul class="subjects-inline-list">
+			{% for row in models.subjects %}
+	    	<li class="tags"><a href="{{ row.uri.value }}" ><i class="icon-tag"></i> {{ row.label.value }}</a></li>
+			{% endfor %} 
+		</ul>
+	</div>
+	{% endif %}
+    	
     {% if models.recipient|length != 0 %}
-    <div class="col-md-4 letter-info">
-    	<h4><span class="glyphicon glyphicon-envelope"></span> Brev</h4>
+    <div id="recipient" class="col-md-4 visible-xs">
     	{% for row in models.sender %}
-		    <p>Fra: <a href="{{row.uri.value}}">{{ row.label.value }}</a></p>
+		<p>Fra: <span itemprop="creator" itemscope itemtype="http://schema.org/Person"><a itemprop="url" href="{{row.uri.value}}">{{ row.label.value }}</a></span></p>
 	    {% endfor %}
 	    {% for row in models.recipient %}
-		    <p>Til: <a href="{{row.uri.value}}">{{ row.label.value }}</a></p>
+		<p>Til: <a href="{{row.uri.value}}">{{ row.label.value }}</a></p>
 	    {% endfor %}
     </div>
     {% endif %}
-
-    {% if first.main.created.value != null || first.main.date.value != null %}
-    <div class="col-md-4">
-	    <h4><span class="glyphicon glyphicon-calendar"></span> 
-	    	Dato: <span>{% if first.main.date.value %}{{ first.main.date.value }} {% endif %}{{ first.main.created.value }}</span><br/>
-	    </h4>
+		
+	{% if first.main.created.value != null || first.main.date.value != null %}
+    <div class="col-md-4 visible-xs visible-sm">
+	    <h4><span class="glyphicon glyphicon-calendar"></span> Dato: <span itemprop="dateCreated">{% if first.main.date.value %}{{ first.main.date.value }} {% endif %}{{ first.main.created.value }}</span></h4>
 	</div>
 	{% endif %}
-	
+		
     {% if models.collections|length != 0  %}
-    <div class="col-md-4">
+    <div class="col-md-12">
     	<h4><span class="glyphicon glyphicon-th"></span> Del av:</h4>
-        <ul class="list-unstyled">
+    	<div class="row">
         {% for row in models.collections %}
-        	<li><a href="{{ row.collection.value }}">{{row.collectionName.value}}</a></li>
+        <div class="col-md-6">
+	        <div class="col-lg-3">
+	        	<a href="{{row.uri.value}}"><img class="img-responsive img-border img-circle" src="{{row.logo.value}}"/></a>
+	        </div>
+	        <div class="col-lg-9">
+	        	<p><strong><a href="{{row.uri.value}}">{{row.label.value}}</a></strong>{% if row.description %}<br>
+	        	<small>{{row.description.value|truncatewords:25}} <a href="{{row.uri.value}}">se mer</a></small>{%endif%}</p>
+	        </div>
+	    </div>
         {% endfor %}
-        </ul>
+        </div>
 	</div>
     {% endif %}  
-    
-    {% if models.relatedresources|length != 0  %}
+	    
+<!--
+    {% if models.relatedresources|length != 0 %}
 	<div class="col-md-4">
 		<h4>Relatert:</h4>
-			<ul class="list-unstyled">
-	    		{% for row in models.relatedresources %}
-	        	<li><span class="glyphicon glyphicon-user"></span> <a href="{{ row.uri.value }}" >{{row.label.value}}</a></li>
-				{% endfor %} 
-			</ul>
-	</div>
-	{% endif %} 
-
-    </div>
-		
-	{% if models.subjects|length != 0 %}
-	<div id="subjects">
-		<ul class="subjects-inline-list">
-			{% for row in models.subjects %}
-	    	<li class="tags"><a href="{{ row.subject.value }}" ><i class="icon-tag"></i> {{ row.subjectLabel.value }}</a></li>
+		<ul class="list-unstyled">
+    		{% for row in models.relatedresources %}
+        	<li><span class="glyphicon glyphicon-user"></span> <a href="{{ row.uri.value }}" >{{row.label.value}}</a></li>
 			{% endfor %} 
 		</ul>
 	</div>
 	{% endif %}
-		
-	{% if models.depicted %}
-	<div class="col-md-4" id="depicted">	
-		<h4>Avbildet:</h4>
-		<ul class="list-unstyled">
+--> 
+    
+    {% if models.depicted|length != 0 %}
+		<div id="depicted" class="col-md-12">	
+			<h4>Avbildet:</h4>
 			{% for row in models.depicted %}
-    		<li><span class="glyphicon glyphicon-user"></span> <a href="{{ row.depicts.value }}" >{{row.depictsName.value}}</a></li>
+			<div class="col-md-3 depicted">
+			{% if row.img %}<img class="img-border img-circle" src="{{row.img.value}}" />{% endif %}
+	    		<p><strong><a href="{{ row.uri.value }}" >{{row.label.value}}</a></strong><br>
+	    		{% if row.birthDate.value || row.deathDate.value %}
+    	{% if row.birthDate %}<small>({{ row.birthDate.value }}{% else %}<small>(&nbsp;&nbsp;&nbsp;&nbsp;-{% endif %}
+    	{% if row.deathDate %}- {{ row.deathDate.value }})</small>{% else %}-&nbsp;&nbsp;&nbsp;&nbsp;)</small>{% endif %}
+    	{% else %})</small>{% endif %}</p>	
+	    		{% if row.bio %}<p>{{row.bio.value}}</p>{% endif %}
+    		</div>
 			{% endfor %}
-		</ul>
-	</div>
+					
+		</div>
 	{% endif %}
 		
-		
-	{% if first.places.place.value != null %}
-		<div id="places">
-			{% if first.places.long.value != null %}
-			 	<div id="map-wrap">
+	{% if models.places|length != 0 %}
+	<div id="places" class="col-md-12">
+		<div class="map-wrap">
+			{% if first.main.hasLong.value == "true" %}
 				<div id="map"></div>
-					<ul class="places-inline-list">
-						{% for row in models.places %}
-						<li><a href="{{ row.place.value }}" ><span class="glyphicon glyphicon-map-marker"></span> {{row.placeName.value}}</a></li>
-						{% endfor %} 
-					</ul>
+			{% endif %}
+			
+			{% if first.main.hasLong.value == "false" %}
+			<div id="no-map">
+	    		<div class="alert alert-warning">
+	    			<p><strong>Oi!</strong> Her har vi ikke plassert stedene på kartet. Vi jobber med saken!</p>
+	    		</div>
 				</div>
-			{% endif %} 
+			{% endif %}
+					    		
+    		<ul class="places-inline-list">
+			{% for row in models.places %}
+	        	<li><a href="{{ row.uri.value }}"><span class="glyphicon glyphicon-map-marker"></span> {{row.label.value}}</a></li>
+			{% endfor %} 
+			</ul>
 		</div>
+	</div>
 	{% endif %} 
 		
-		<script>			
-			var map = L.map('map');
-			var bounds = [{% for row in models.places %}{% if row.lat.value != null %}[{{ row.lat.value }}, {%endif%}{% if row.long.value != "" %}{{ row.long.value }}]{%if forloop.first && row.lat.value != null%}, {%endif%}{%if !forloop.last && row.lat.value != null%}, {%endif%}{%endif%}{% endfor %}];
-			bounds = $.grep(bounds,function(n){ return(n) });
-
-			if (bounds.length > 1) { map.fitBounds(new L.LatLngBounds(bounds)); } else { map.setView(bounds[0], 11);}
-
-			var defaultLayer = L.tileLayer.provider('OpenStreetMap.Mapnik').addTo(map);
-					
-			var baseLayers = [
-				'OpenStreetMap.Mapnik', 'MapQuestOpen.OSM', 'MapQuestOpen.Aerial', 'Stamen.Watercolor'		
-				];
-			
-			var overlayLayers = [
-				'Kartverket', 'Rodekart9', 'Rodekart4', 'Rodekart1'
-			];
-			
-			L.control.layers.provided(baseLayers, overlayLayers, {collapsed: true}).addTo(map);
-	
-			{% for row in models.places %}
-				{% if row.long.value != null %}
-	        	L.marker([{{ row.lat.value }}, {{ row.long.value }}]).addTo(map).bindPopup("<b><a href=\"{{ row.place.value }}\">{{row.placeName.value}}</a></b>").openPopup();
-	        	{% endif %} 
-			{% endfor %} 
+	<script>			
+		var map = L.map('map');
+		var bounds = [{% for row in models.places %}{% if row.lat.value != null %}[{{ row.lat.value }}, {%endif%}{% if row.long.value != "" %}{{ row.long.value }}]{%if forloop.first && row.lat.value != null%}, {%endif%}{%if !forloop.last && row.lat.value != null%}, {%endif%}{%endif%}{% endfor %}];
+		bounds = $.grep(bounds,function(n){ return(n) });
+		if (bounds.length > 1) { map.fitBounds(new L.LatLngBounds(bounds)); } else { map.setView(bounds[0], 11);}
+		var defaultLayer = L.tileLayer.provider('OpenStreetMap.Mapnik').addTo(map);
+		var baseLayers = [ 'OpenStreetMap.Mapnik', 'MapQuestOpen.OSM', 'MapQuestOpen.Aerial', 'Stamen.Watercolor' ];
+		var overlayLayers = [ 'Kartverket', 'Rodekart9', 'Rodekart4', 'Rodekart1' ];
+		L.control.layers.provided(baseLayers, overlayLayers, {collapsed: true}).addTo(map);
+		{% for row in models.places %}{% if row.long.value != null %}
+    	L.marker([{{ row.lat.value }}, {{ row.long.value }}]).addTo(map).bindPopup("<b><a href=\"{{ row.uri.value }}\">{{row.label.value}}</a></b>").openPopup();
+        {% endif %}{% endfor %} 
 	</script>
 	
-	    <div id="disqus_thread"></div>
+	<div id="disqus_thread" class="col-md-12"></div>
     <script type="text/javascript">
         /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
-        var disqus_shortname = 'ubblod'; // required: replace example with your forum shortname
-
+        var disqus_shortname = 'ubblod';
         /* * * DON'T EDIT BELOW THIS LINE * * */
         (function() {
             var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
             dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
             (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
         })();
+        /* * * DON'T EDIT BELOW THIS LINE * * */
+	    (function () {
+	        var s = document.createElement('script'); s.async = true;
+	        s.type = 'text/javascript';
+	        s.src = '//' + disqus_shortname + '.disqus.com/count.js';
+	        (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
+	    }());
     </script>
     <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
     <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
 	
-	    <div class="row full-metadata-div">
-    	<div class="col-lg-12">
+	<div class="col-lg-12">
+		<p>Ved sitering på Wikipedia bruk denne malen:</p>
+		<pre><ref>&#123;&#123;cite web |url={{lodspk.local.curie}} |title={{first.main.label.value}} |author=Avdeling for spesialsamlinger |accessdate={{lodspk.currentDate}} |publisher=University of Bergen Library&#125;&#125;</ref></pre>
+	</div>
+	
+    <div class="full-metadata-div">
+		<div class="col-lg-12">
 			<button type="button" class="btn btn-sm btn-info" data-toggle="collapse" data-target="#full-meta-view">
 				Vis all informasjon
 			</button>
-
 			<div id="full-meta-view" class="collapse">
 				<table class="table table-striped" about="{{uri}}">
 					<thead>
@@ -303,21 +391,15 @@
 			    {% for row in models.po %}
 						<tr>
 							<td>{% if forloop.first %}<a href='{{lodspk.this.value}}'>{{lodspk.this.curie}}</a>{% endif %}</td>
-							<td><a href='{{row.p.value}}'>{{row.p.curie}}</a></td>
-							<td>
-								{% if row.o.uri == 1 %}
-								<a rel='{{row.p.value}}' href='{{row.o.value}}'>{{row.o.curie}}</a>
-								{% else %}
-								<span property='{{row.p.value}}'>{{row.o.value}}</span>
-								{% endif %}
-							</td>
+							<td><a href='{{row.p.mirroredUri}}'>{{row.p.localname}}</a></td>
+							<td>{% if row.o.uri == 1 %}<a rel='{{row.p.mirroredUri}}' href='{{row.o.value}}'>{{row.o.curie}}</a>{% else %}<span property='{{row.p.value}}'>{{row.o.value}}</span>{% endif %}</td>
 						</tr>
 				{% endfor %}
-
+	
 				{% for row in models.sp %}
 						<tr>
 							<td><a href='{{row.s.value}}'>{{row.s.curie}}</a></td>
-							<td><a rev='{{row.s.value}}' href='{{row.p.value}}'>{{row.p.curie}}</a></td>
+							<td><a rev='{{row.s.value}}' href='{{row.p.mirroredUri}}'>{{row.p.localname}}</a></td>
 							<td>{% if forloop.first %}<a href='{{lodspk.this.value}}'>{{lodspk.this.curie}}</a>{% endif %}</td>
 						</tr>
 				{% endfor %}
@@ -327,13 +409,12 @@
 				</table>
 			</div>
 		</div>
-    </div>
+	</div> <!-- END full-metadata-div -->
 	
 	</div>
 	</div>
     </div>
 	{%include "../../includes/footer.inc"%}
    </div>
-	
   </body>
 </html>
diff --git a/components/types/bibo__Document/queries/collections.query b/components/types/bibo__Document/queries/collections.query
index 66d0bdce..11599dc2 100755
--- a/components/types/bibo__Document/queries/collections.query
+++ b/components/types/bibo__Document/queries/collections.query
@@ -1,7 +1,8 @@
-SELECT DISTINCT ?collection ?collectionName WHERE {
-	<{{ uri }}> dct:isPartOf ?collection . 
-	OPTIONAL { ?collection dct:title ?collectionName . }
-	OPTIONAL { ?collection rdfs:label ?collectionName .}
-	
-}
-
+SELECT DISTINCT ?uri ?label ?description ?logo WHERE {
+	<{{ uri }}> dct:isPartOf ?uri . 
+	?uri a bibo:Collection .
+	OPTIONAL { ?uri dct:title ?label . }
+	OPTIONAL { ?uri rdfs:label ?label .}
+	OPTIONAL { ?uri dct:description ?description .}
+	OPTIONAL { ?uri foaf:logo ?logo .}
+}
\ No newline at end of file
diff --git a/components/types/bibo__Document/queries/depicted.query b/components/types/bibo__Document/queries/depicted.query
new file mode 100644
index 00000000..e32ea956
--- /dev/null
+++ b/components/types/bibo__Document/queries/depicted.query
@@ -0,0 +1,9 @@
+SELECT DISTINCT ?uri ?label ?img ?bio ?birthDate ?deathDate WHERE {
+    <{{ uri }}> foaf:depicts ?uri . 
+    ?uri foaf:name ?label .
+    OPTIONAL { ?uri foaf:img ?img . }
+    OPTIONAL { ?uri bio:biography ?bio . }
+    OPTIONAL { ?uri dbo:birthDate ?birthDate . }
+	OPTIONAL { ?uri dbo:deathDate ?deathDate . }
+}
+
diff --git a/components/types/bibo__Document/queries/image.query b/components/types/bibo__Document/queries/image.query
index 86e86c1d..342543db 100755
--- a/components/types/bibo__Document/queries/image.query
+++ b/components/types/bibo__Document/queries/image.query
@@ -4,14 +4,14 @@ SELECT DISTINCT ?hasPage ?imageLow ?imageHigh WHERE
 	    <{{ uri }}> ubbont:hasPage ?hasPage .
 	    ?hasPage ubbont:hasRepresentation ?hasRepresentation .
 	    ?hasRepresentation ubbont:hasURI ?imageLow .
-		FILTER(regex(?imageLow, "low", "i"))		
+		FILTER(regex(str(?imageLow), "low", "i"))		
 	}
 }
 	{ SELECT DISTINCT ?imageHigh ?hasPage WHERE {
 	    <{{ uri }}> ubbont:hasPage ?hasPage .
 	    ?hasPage ubbont:hasRepresentation ?hasRepresentation .
 	    ?hasRepresentation ubbont:hasURI ?imageHigh .
-		FILTER(regex(?imageHigh, "high", "i"))
+		FILTER(regex(str(?imageHigh), "high", "i"))
 	}
 }
 }
diff --git a/components/types/bibo__Document/queries/main.query b/components/types/bibo__Document/queries/main.query
index 834211aa..80545ff0 100755
--- a/components/types/bibo__Document/queries/main.query
+++ b/components/types/bibo__Document/queries/main.query
@@ -1,13 +1,15 @@
-SELECT DISTINCT ?title ?created ?date ?available ?identifier ?classLabel WHERE {
+SELECT DISTINCT ?label ?alternative ?created ?date ?available ?identifier ?classLabel ?isbn ?hasLong WHERE {
     <{{ uri }}> rdf:type ?class .
 	?class rdfs:label ?classLabel .
 	FILTER(langMatches(lang(?classLabel), ""))
-    OPTIONAL { <{{ uri }}> rdfs:label ?title . }
-    OPTIONAL { <{{ uri }}> dct:title ?title . }
+    OPTIONAL { <{{ uri }}> rdfs:label ?label . }
+    OPTIONAL { <{{ uri }}> dct:title ?label . }
+    OPTIONAL { <{{ uri }}> dct:alternative ?alternative . }
     OPTIONAL { <{{ uri }}> dct:identifier ?identifier . }
     OPTIONAL { <{{ uri }}> dct:created ?created .}
     OPTIONAL { <{{ uri }}> dct:date ?date .}
 	OPTIONAL { <{{ uri }}> dct:available ?available .}
-
+	OPTIONAL { <{{ uri }}> bibo:isbn ?isbn . }
+	BIND ( EXISTS { <{{ uri }}> dct:spatial ?place . ?place geo:long ?long } AS ?hasLong )
 }
 
diff --git a/components/types/bibo__Document/queries/maker.query b/components/types/bibo__Document/queries/maker.query
index 37bc6c29..143e0f1b 100755
--- a/components/types/bibo__Document/queries/maker.query
+++ b/components/types/bibo__Document/queries/maker.query
@@ -1,6 +1,7 @@
 SELECT DISTINCT ?maker ?makerName WHERE {
 
-    OPTIONAL { <{{ uri|deurifier }}> foaf:maker ?maker . ?maker foaf:name ?makerName .}
-
+    <{{ uri|deurifier }}> foaf:maker ?maker . 
+    OPTIONAL { ?maker foaf:name ?makerName . }
+    OPTIONAL { ?maker ubbont:invertedName ?makerName . }
 }
 
diff --git a/components/types/bibo__Document/queries/places.query b/components/types/bibo__Document/queries/places.query
index 0398c7be..344b78eb 100755
--- a/components/types/bibo__Document/queries/places.query
+++ b/components/types/bibo__Document/queries/places.query
@@ -1,7 +1,5 @@
-SELECT DISTINCT ?place ?placeName ?lat ?long WHERE {
-
-	OPTIONAL { <{{ uri|deurifier }}> dct:spatial ?place . ?place rdfs:label ?placeName . OPTIONAL { ?place geo:lat ?lat ; geo:long ?long .}}
-	
-
+SELECT DISTINCT ?uri ?label ?lat ?long WHERE {
+	OPTIONAL { <{{ uri|deurifier }}> dct:spatial ?uri . ?uri skos:prefLabel ?label . 
+	OPTIONAL { ?uri geo:lat ?lat ; geo:long ?long .}}
 }
 
diff --git a/components/types/bibo__Document/queries/published.query b/components/types/bibo__Document/queries/published.query
new file mode 100644
index 00000000..58b58419
--- /dev/null
+++ b/components/types/bibo__Document/queries/published.query
@@ -0,0 +1,13 @@
+SELECT DISTINCT ?uri ?label ?issn ?pages ?vol ?issue ?pageStart ?pageEnd WHERE {
+	<{{ uri }}> dct:isPartOf ?uri . 
+	?uri a bibo:Journal .
+	OPTIONAL { ?uri dct:title ?label . }
+	OPTIONAL { ?uri rdfs:label ?label .}
+	OPTIONAL { <{{ uri }}> bibo:issn ?issn . }
+	OPTIONAL { <{{ uri }}> bibo:pages ?pages . }
+	OPTIONAL { <{{ uri }}> bibo:volume ?vol . }
+	OPTIONAL { <{{ uri }}> bibo:issue ?issue . }
+	OPTIONAL { <{{ uri }}> bibo:pageStart ?pageStart . }
+	OPTIONAL { <{{ uri }}> bibo:pageEnd ?pageEnd . }
+}
+
diff --git a/components/types/bibo__Document/queries/publisher.query b/components/types/bibo__Document/queries/publisher.query
new file mode 100644
index 00000000..7a423145
--- /dev/null
+++ b/components/types/bibo__Document/queries/publisher.query
@@ -0,0 +1,8 @@
+SELECT DISTINCT ?uri ?label ?description ?logo WHERE {
+	<{{ uri }}> dct:publisher ?uri . 
+	OPTIONAL { ?uri dct:title ?label . }
+	OPTIONAL { ?uri rdfs:label ?label .}
+	OPTIONAL { ?uri dct:description ?description .}
+	OPTIONAL { ?uri foaf:logo ?logo .}
+}
+
diff --git a/components/types/bibo__Document/queries/subjects.query b/components/types/bibo__Document/queries/subjects.query
index 4b25f5b2..b27db1bf 100755
--- a/components/types/bibo__Document/queries/subjects.query
+++ b/components/types/bibo__Document/queries/subjects.query
@@ -1,8 +1,8 @@
-SELECT DISTINCT ?subject ?subjectLabel WHERE {
+SELECT DISTINCT ?uri ?label WHERE {
 
-    <{{ uri }}> dct:subject ?subject . 
-    ?subject skos:prefLabel ?subjectLabel ; a skos:Concept .
-	OPTIONAL { ?subject rdfs:label ?subjectLabel ; a skos:Concept .}
+    <{{ uri }}> dct:subject ?uri . 
+    ?uri skos:prefLabel ?label ; a skos:Concept .
+	OPTIONAL { ?uri rdfs:label ?label ; a skos:Concept .}
     
 }
 
diff --git a/components/types/bibo__Document/queries/transcription.query b/components/types/bibo__Document/queries/transcription.query
new file mode 100644
index 00000000..28c9363e
--- /dev/null
+++ b/components/types/bibo__Document/queries/transcription.query
@@ -0,0 +1,17 @@
+SELECT DISTINCT ?html ?xml WHERE 
+{
+	{ SELECT DISTINCT ?html WHERE {
+	    <{{ uri }}> ubbont:hasTranscription ?transcription .
+	    ?transcription  ubbont:hasRepresentation ?hasRepresentation .
+	    ?hasRepresentation ubbont:hasURI ?html .
+		FILTER(regex(str(?html), "html", "i"))		
+	}
+}
+	{ SELECT DISTINCT ?xml WHERE {
+	    <{{ uri }}> ubbont:hasTranscription ?transcription .
+	    ?transcription  ubbont:hasRepresentation ?hasRepresentation .
+	    ?hasRepresentation ubbont:hasURI ?xml .
+		FILTER(regex(str(?xml), "xml", "i"))	
+	}
+}
+}
\ No newline at end of file
-- 
GitLab