accurator/commit

Functional domain page.

authorChris Dijkshoorn
Wed Apr 13 17:01:45 2016 +0200
committerChris Dijkshoorn
Wed Apr 13 17:01:45 2016 +0200
commit5fc689c44405abf4f68cdbfe279048ed386618ad
tree38b39c7cd6ef92e6e13c3857df0b116de9b0e48d
parent2d2c600453a9d954185ce5fbf8b3eec136fa3afe
Diff style: patch stat
diff --git a/rdf/domain/bible/bible_domain.ttl b/rdf/domain/bible/bible_domain.ttl
index dab2cfd..1bd3a6c 100644
--- a/rdf/domain/bible/bible_domain.ttl
+++ b/rdf/domain/bible/bible_domain.ttl
@@ -12,17 +12,13 @@
 
 abib:domain a accu:Domain ;
 	rdfs:label "bible" ;
-	dcterms:requires <file:///Users/rasvaan/git/iconclass/iconclass.20121019.structure.ttl> ;
 	accu:hasTarget <http://accurator.nl/ubvu#Target> ;
-	skos:hasTopConcept ic:7 ;
 	accu:hasUI abibui: ;
 	accu:hasAnnotationUI aabib:smallBibleUI ;
-	accu:hasDescriptiveImage abib:jeremia ;
-	accu:hasMaximumExpertiseTopics "50" ;
-	accu:hasMaximumChildren "0" .
-
-<http://iconclass.org/> a skos:ConceptScheme .
+	accu:hasDescriptiveImage abib:jeremia .
 
 abib:jeremia a dctypes:StillImage ;
 	accu:hasFilePath "img/background/bible.jpg" ;
 	accu:brightness "dark" .
+
+<http://iconclass.org/> a skos:ConceptScheme .
diff --git a/rdf/domain/fashion/fashion_domain.ttl b/rdf/domain/fashion/fashion_domain.ttl
index becb30a..9e534a9 100644
--- a/rdf/domain/fashion/fashion_domain.ttl
+++ b/rdf/domain/fashion/fashion_domain.ttl
@@ -12,7 +12,6 @@
 
 afas:domain a accu:Domain ;
 	rdfs:label "fashion" ;
-	dcterms:requires <http://iconclass.org/iconclass.20121019.structure.ttl.gz> ;
 	accu:hasTarget <http://accurator.nl/fashion#Target> ;
 	accu:hasUI afasui: ;
 	accu:hasAnnotationUI aafas:fashionUI ;
diff --git a/web/js/components/domain.js b/web/js/components/domain.js
index d89f015..98825e8 100644
--- a/web/js/components/domain.js
+++ b/web/js/components/domain.js
@@ -3,13 +3,14 @@ Domain
 
 Code for representing domains
 *******************************************************************************/
-function Domain(id, title, image, imageBrightness, subDomains) {
+function Domain(id, title, image, imageBrightness, subDomains, topics) {
 	this.id = id; // id of domain
 	this.title = title; // title of domain
 	this.image = image; // image illustrating domain
 	this.imageBrightness = imageBrightness; // is the descriptive image dark or light
 	this.link = null; // URL of location where someone can show expertise of domain
 	this.subDomains = subDomains;
+	this.expertiseTopics = topics;
 	this.node = null;  // html of thumbnail
 
 	this.init();
@@ -32,7 +33,9 @@ Domain.prototype.init = function() {
 
 Domain.prototype.setLink = function() {
 	if (this.subDomains.length > 0) {
-		this.link = "topics.html";
+		this.link = "topic.html";
+	} else if (this.expertiseTopics != null) {
+		this.link = "expertise.html";
 	} else {
 		this.link = "results.html";
 	}
@@ -45,13 +48,14 @@ Domain.prototype.setTitleColor = function() {
 
 Domain.prototype.setClickEvent = function() {
 	var _domain = this;
-	console.log("Setting event to link ", this.link);
+
 	$(this.node).find("#domainImg" + this.id).click(function() {
 		setDomain(_domain.id)
 		.then(function() {
 			document.location.href = _domain.link;
 		});
 	});
+
 	$(this.node).find("#domainTxt" + this.id).click(function() {
 		setDomain(_domain.id)
 		.then(function() {
@@ -59,3 +63,10 @@ Domain.prototype.setClickEvent = function() {
 		});
 	});
 }
+
+function ExpertiseTopics(thesaurus, topConcept, maxTopics, maxChildren) {
+	this.thesaurus = thesaurus;
+	this.topConcept = topConcept;
+	this.maxTopics = maxTopics;
+	this.maxChildren = maxChildren;
+}
diff --git a/web/js/domain.js b/web/js/domain.js
index 07d40a1..c7274d5 100644
--- a/web/js/domain.js
+++ b/web/js/domain.js
@@ -63,31 +63,44 @@ function populateDomains(locale, domainLabels) {
 			);
 		}
 
-		// define function to keep stable track of row
-		var addDomain = function (row, locale) {
-			return function(domainData) {
-				getLabels(locale, domainData.hasUI + "domain")
-				.then(function(labels) {
-					var subDomains;
+		$.getJSON("domains", {domain:domainLabels[i]})
+		.then(addDomain(row, locale));
+	}
+}
 
-					domainData.subDomains ?
-						subDomains = domainData.subDomains
-						: subDomains = [];
+function addDomain(row, locale) {
+	return function(domainData) {
+		return getLabels(locale, domainData.hasUI + "domain")
+		.then(function(labels) {
+			var topics = null;
+			var subDomains;
 
-					var domain = new Domain (
-						domainData.domain,
-						labels.domainLabel,
-						domainData.image,
-						domainData.imageBrightness,
-						subDomains
-					);
+			// see if there are subdomains
+			domainData.subDomains ?
+				subDomains = domainData.subDomains
+				: subDomains = [];
 
-					$("#domainDiv" + row).append(domain.node);
-				});
+			// see if there is info about expertise topics
+			if (domainData.requires) {
+				topics = new ExpertiseTopics (
+					domainData.requires,
+					domainData.hasTopConcept,
+					domainData.hasMaximumExpertiseTopics,
+					domainData.hasMaximumChildren
+				);
 			}
-		}
 
-		$.getJSON("domains", {domain:domainLabels[i]})
-		.then(addDomain(row, locale));
+			// domainData
+			var domain = new Domain (
+				domainData.domain,
+				labels.domainLabel,
+				domainData.image,
+				domainData.imageBrightness,
+				subDomains,
+				topics
+			);
+
+			$("#domainDiv" + row).append(domain.node);
+		});
 	}
 }