You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by ha...@apache.org on 2010/01/13 19:28:42 UTC

svn commit: r898870 - in /incubator/clerezza/issues/CLEREZZA-59: ./ org.apache.clerezza.platform.concepts/ org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/ org.apache.clerezza.platform.concepts/org.apache.clerezza.platf...

Author: hasan
Date: Wed Jan 13 18:28:41 2010
New Revision: 898870

URL: http://svn.apache.org/viewvc?rev=898870&view=rev
Log:
CLEREZZA-59: added widget to search concepts and add free concepts

Added:
    incubator/clerezza/issues/CLEREZZA-59/
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/
      - copied from r898782, incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.webapp.parent/org.apache.clerezza.platform.concepts/
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptManipulator.java
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-suggestions.js
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/selected-concepts.js
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-suggestions.ssp
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concepts-search-results.ssp
Modified:
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/README.txt
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/pom.xml
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptsFinder.java
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ResourceTagger.java
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/generic-resource-page.ssp
    incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/selected-concepts.ssp

Modified: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/README.txt
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/README.txt?rev=898870&r1=898782&r2=898870&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/README.txt (original)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/README.txt Wed Jan 13 18:28:41 2010
@@ -1,7 +1,18 @@
-This JAX-RS resource can be used to retrieve a resource and its associated concepts. 
+JAX-RS resource called GenericResourcePage can be used to retrieve a resource and its associated concepts. 
 Go to http://[your.server]/concepts/generic-resource?uri=[resource] where [resource] 
-specifies the UriRef of the resource. Furthermore there is a method for associating 
-concepts with resources. POST to http://[your.server]/concepts/tagger/set a form 
+specifies the UriRef of the resource. Furthermore there is a JAX-RS resource called ResourceTagger
+ for associating concepts with resources. POST to http://[your.server]/concepts/tagger/set a form 
 with form parameter uri which specifies the UriRef of the resource and a form parameter 
 concepts which contains the UriRefs of the concepts.
 
+JAX-RS resource called ConceptManipulator can be used to add concept into the content graph
+The resource path is "/concepts/manipulator/add-concept" and the form parameters are
+search-term, lang, and comment.
+
+On the client side there is a ConceptManipulator widget to add free concepts to the content graph
+and there is also a ConceptFinder widget to find exisiting concepts to be suggested for a specified search term.
+ 
+In ConceptManipulator widget and ConceptFinder widget a developer can register a callback function
+which is called when a concept is added to the list of selected concept.
+
+

Modified: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/pom.xml?rev=898870&r1=898782&r2=898870&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/pom.xml (original)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/pom.xml Wed Jan 13 18:28:41 2010
@@ -56,6 +56,10 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.clerezza</groupId>
+			<artifactId>org.apache.clerezza.platform.config</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
 			<artifactId>org.apache.clerezza.triaxrs</artifactId>
 			<scope>test</scope>
 		</dependency>

Added: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptManipulator.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptManipulator.java?rev=898870&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptManipulator.java (added)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptManipulator.java Wed Jan 13 18:28:41 2010
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.clerezza.platform.concepts.core;
+
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import org.apache.clerezza.platform.config.PlatformConfig;
+import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
+import org.apache.clerezza.rdf.core.Language;
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.PlainLiteral;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
+import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.rdf.ontologies.RDF;
+import org.apache.clerezza.rdf.ontologies.RDFS;
+import org.apache.clerezza.rdf.ontologies.SKOS;
+import org.apache.clerezza.rdf.utils.UriRefUtil;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+
+/**
+ * This JAX-RS resource can be used to add free concepts to the content graph.
+ * The URI path of this resource is /concepts/manipulator.
+ * 
+ * @author hasan
+ */
+@Component
+@Service(Object.class)
+@Property(name = "javax.ws.rs", boolValue = true)
+@Path("/concepts/manipulator")
+public class ConceptManipulator {
+
+	@Reference
+	protected ContentGraphProvider cgProvider;
+
+	@Reference
+	private PlatformConfig platformConfig;
+
+	/**
+	 * Creates and stores a concept with the specified prefLabel and comment
+	 * into the content graph if a concept with this prefLabel does not already
+	 * exist in the graph.
+	 *
+	 * @param prefLabel
+	 *		if it is an empty string no concept is generated
+	 * @param lang
+	 *		the language of the prefLabel
+	 * @param comment
+	 *		is a human-readable description of the concept
+	 * @return
+	 *		- BAD REQUEST response if prefLabel is undefined or empty
+	 *		- CONFLICT response if a concept with the same prefLabel and lang exists
+	 *		- CREATED if everything is ok
+	 */
+	@POST
+	@Path("add-concept")
+	public Response addConcept(@FormParam("search-term") String prefLabel,
+			@FormParam("lang") String lang,
+			@FormParam("comment") String comment) {
+
+		if ((prefLabel == null) || (prefLabel.isEmpty())) {
+			return Response.status(Status.BAD_REQUEST)
+					.entity("A concept must have a label!")
+					.build();
+		}
+		MGraph contentGraph = cgProvider.getContentGraph();
+		PlainLiteral preferredLabel = new PlainLiteralImpl(prefLabel,
+				new Language(lang));
+
+		if (contentGraph.filter(null, SKOS.prefLabel, preferredLabel).hasNext()) {
+			return Response.status(Status.CONFLICT)
+					.entity("A concept with the same label and language already exists!")
+					.build();
+		}
+		String baseUri = platformConfig.getDefaultBaseUri().getUnicodeString();
+		UriRef concept = new UriRef(baseUri + UriRefUtil.stripNonUriRefChars(prefLabel));
+		contentGraph.add(new TripleImpl(concept, RDF.type,
+				SKOS.Concept));
+		contentGraph.add(new TripleImpl(concept, SKOS.prefLabel, preferredLabel));
+		if (!comment.isEmpty()) {
+			contentGraph.add(new TripleImpl(concept, RDFS.comment,
+					new PlainLiteralImpl(comment, new Language(lang))));
+		}
+		return Response.status(Status.CREATED).entity(concept.getUnicodeString())
+				.build();
+	}
+}
+
+
+
+

Modified: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptsFinder.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptsFinder.java?rev=898870&r1=898782&r2=898870&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptsFinder.java (original)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptsFinder.java Wed Jan 13 18:28:41 2010
@@ -18,11 +18,16 @@
  */
 package org.apache.clerezza.platform.concepts.core;
 
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.Iterator;
 import java.util.List;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import org.apache.clerezza.platform.typerendering.RenderletManager;
+import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
@@ -42,6 +47,7 @@
 import org.apache.clerezza.rdf.ontologies.RDFS;
 import org.apache.clerezza.rdf.ontologies.SKOS;
 import org.apache.clerezza.rdf.utils.GraphNode;
+import org.osgi.service.component.ComponentContext;
 
 /**
  * This JAX-RS resource can be used to search concepts accessible through
@@ -61,8 +67,19 @@
 public class ConceptsFinder {
 
 	@Reference
+	private RenderletManager renderletManager;
+
+	@Reference
 	protected ConceptProviderManager conceptProviderManager;
 
+	protected void activate(ComponentContext context) throws URISyntaxException {
+		URL template = getClass().getResource("concepts-search-results.ssp");
+		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
+				new UriRef(template.toURI().toString()),
+				SKOS.Collection, null,
+				MediaType.APPLICATION_JSON_TYPE, true);
+	}
+
 	/**
 	 * Searches concepts for a specified search term. The actual search task
 	 * is delegated to each {@link ConceptProvider} instance. The results from

Modified: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ResourceTagger.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ResourceTagger.java?rev=898870&r1=898782&r2=898870&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ResourceTagger.java (original)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ResourceTagger.java Wed Jan 13 18:28:41 2010
@@ -65,8 +65,13 @@
 	protected void activate(ComponentContext context)
 			throws URISyntaxException {
 
+		URL template = getClass().getResource("concept-suggestions.ssp");
+		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
+				new UriRef(template.toURI().toString()),
+				RDFS.Resource, "tagging",
+				MediaType.APPLICATION_XHTML_XML_TYPE, true);
 
-		URL template = getClass().getResource("selected-concepts.ssp");
+		template = getClass().getResource("selected-concepts.ssp");
 		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
 				new UriRef(template.toURI().toString()),
 				RDFS.Resource, "selectedconcepts",

Added: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-suggestions.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-suggestions.js?rev=898870&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-suggestions.js (added)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-suggestions.js Wed Jan 13 18:28:41 2010
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+function ConceptFinder(){};
+
+ConceptFinder.callback;
+
+ConceptFinder.setAddConceptCallback = function (callback) {
+	this.callback = callback;
+}
+
+ConceptFinder.search = function () {
+	$("#system-suggested-concepts").empty();
+	var searchTerm = $(":text[name=\"search-term\"]").val();
+	if (searchTerm.length > 0) {
+		var options = new AjaxOptions("find-concepts", "finding concepts", function(data) {
+			var concepts = data.concepts;
+			ConceptFinder.addSuggestions(concepts);
+			$("#add-button-label")
+				.html("<div>or</div><div>Add '"+searchTerm
+					+"' as new Free Concept</div>");
+			$("#system-suggested-concepts-area").show();
+			$("#user-defined-concept-area").show();
+		});
+		options.url = "/concepts/find";
+		options.data = "searchTerm=" + encodeURIComponent(searchTerm);
+		options.dataType = "json";
+		$.ajax(options);
+	}
+	return false;
+}
+
+ConceptFinder.addSuggestions = function (concepts) {
+	var selectedConceptsExists = false;
+	if (typeof(SelectedConcepts) != "undefined") {
+		selectedConceptsExists = true;
+	}
+	for (var i = 0; i < concepts.length; i++) {
+		if (!selectedConceptsExists || !SelectedConcepts.exists(concepts[i].uri)) {
+			var div = $("<div/>").appendTo("#system-suggested-concepts");
+			$("<div/>").text(concepts[i].prefLabel)
+			.appendTo(div);
+			$("<div/>").text(concepts[i].uri)
+			.appendTo(div);
+			$("<a/>").addClass("tx-icon tx-icon-plus add-suggested-concept")
+			.attr({
+				href: "#"
+			})
+			.text("Add")
+			.click(function () {
+				var searchTerm = $(this).prev().prev().text();
+				var uri = $(this).prev().text();
+				if (typeof(SelectedConcepts) != "undefined") {
+					SelectedConcepts.addConcept(searchTerm, uri);
+				}
+				if (typeof(ConceptFinder.callback) == "function") {
+					ConceptFinder.callback(searchTerm, uri);
+				}
+				$(this).parent().remove();
+			})
+			.appendTo(div);
+			$("<br/>").appendTo(div);
+			$("<br/>").appendTo(div);
+		}
+	}
+}
+
+function ConceptManipulator(){};
+
+ConceptManipulator.callback;
+
+ConceptManipulator.setAddConceptCallback = function (callback) {
+	this.callback = callback;
+}
+
+ConceptManipulator.addConcept = function () {
+	var searchTerm = $(":text[name='search-term']").val();
+	if (searchTerm.length > 0) {
+		var options = new AjaxOptions("add-concepts", "adding concepts", function(uri) {
+			$("#concept-description").val("");
+			if (typeof(SelectedConcepts) != "undefined") {
+				SelectedConcepts.addConcept(searchTerm, uri);
+			}
+			if (typeof(this.callback) == "function") {
+				this.callback(searchTerm, uri);
+			}
+		});
+		options.type = "POST";
+		options.url = "/concepts/manipulator/add-concept";
+		options.data = $("#suggestions-form").serialize();
+		$.ajax(options);
+	}
+	return false;
+}
+
+$(document).ready(function () {
+	$("#go-button").click(function() {
+		ConceptFinder.search();
+	});
+	$("#add-user-defined-concept").click(function() {
+		ConceptManipulator.addConcept();
+	});
+	$("#system-suggested-concepts-area").hide();
+	$("#user-defined-concept-area").hide();
+});

Added: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/selected-concepts.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/selected-concepts.js?rev=898870&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/selected-concepts.js (added)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/selected-concepts.js Wed Jan 13 18:28:41 2010
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+function SelectedConcepts(){};
+
+SelectedConcepts.exists = function (concept) {
+	var exists = false;
+	$("input[name='concepts']").each( function () {
+		if ($(this).val() == concept) {
+			exists = true;
+		}
+	});
+	return exists;
+}
+
+SelectedConcepts.addConcept = function (prefLabel, uri) {
+	var div = $("<div/>");
+	$("<div/>").text("PrefLabel: " + prefLabel).appendTo(div);
+	$("<div/>").text("Uri: " + uri).appendTo(div);
+	$("<input/>").attr({
+		"type": "hidden",
+		"name": "concepts"
+	}).val(uri).appendTo(div);
+	$("<a/>").attr("href", "#").addClass("tx-icon tx-icon-delete").text("Add")
+		.appendTo(div);
+	$("<br />").appendTo(div);
+	$("<br />").appendTo(div);
+	$("#selected-concepts").append(div);
+}
+
+$(document).ready(function () {
+	$(".tx-icon-delete").click(function() {
+		$(this).parent().remove();
+	});
+});

Added: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-suggestions.ssp
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-suggestions.ssp?rev=898870&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-suggestions.ssp (added)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-suggestions.ssp Wed Jan 13 18:28:41 2010
@@ -0,0 +1,28 @@
+resultDocModifier.addScriptReference("/scripts/ajax-options.js");
+resultDocModifier.addScriptReference("/static/concepts/scripts/concept-suggestions.js");
+
+<div>Manually Add Concepts</div>
+<form onsubmit="return ConceptFinder.search()" id="suggestions-form">
+	<br/>
+	<input type="text" value="" name="search-term"/>
+	<a href="#" id="go-button" class="tx-icon tx-icon-search">Go</a>
+	<br/>
+	<br/>
+	<div id="system-suggested-concepts-area">
+		<div>
+			Suggestions of existing concepts
+		</div>
+		<br/>
+		<div id="system-suggested-concepts"></div>
+	</div>
+	<br/>
+	<div id="user-defined-concept-area">
+		<div id="add-button-label"></div>
+		<div>Description (optional):</div>
+		<textarea rows="8" id="concept-description" name="comment"/>
+		<input type="hidden" value="en" name="lang"/>
+		<div>
+			<a href="#" class="tx-icon tx-icon-plus" id="add-user-defined-concept">Add</a>
+		</div>
+	</div>
+</form>

Added: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concepts-search-results.ssp
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concepts-search-results.ssp?rev=898870&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concepts-search-results.ssp (added)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concepts-search-results.ssp Wed Jan 13 18:28:41 2010
@@ -0,0 +1,12 @@
+import org.json.simple.JSONObject
+
+def skos(s: Any) = new UriRef("http://www.w3.org/2008/05/skos#"+s)
+
+"{\"concepts\":" +
+	(for (concept <- (res/skos("member"))) yield {
+		"{" +
+			"\"prefLabel\":\"" + JSONObject.escape(concept/skos("prefLabel")*) + "\"," +
+			"\"uri\":\"" + JSONObject.escape(concept*) + "\"" +
+		"}"
+	}).mkString("[", ",", "]") +
+"}";

Modified: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/generic-resource-page.ssp
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/generic-resource-page.ssp?rev=898870&r1=898782&r2=898870&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/generic-resource-page.ssp (original)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/generic-resource-page.ssp Wed Jan 13 18:28:41 2010
@@ -11,15 +11,16 @@
 	<script type="text/javascript">
 		$(document).ready(function() {{
 			$("#addButton").click(function() {{
-				$("form").submit();
+				$("#selected-concepts-form").submit();
 			}});
 		}});
 	</script>
 	<h4>About: {res/cpt("resource")*}</h4>
 	<div><object width="200" data={res/cpt("resource")*}></object></div>
 	<br/>
-	<form method="post" action="/concepts/tagger/set">
+	<form method="post" action="/concepts/tagger/set" id="selected-concepts-form">
 		<input type="hidden" name="uri" value={res/cpt("resource")*}></input>
 		{render(res/cpt("resource"), "selectedconcepts")}
 	</form>
+	{render(res,"tagging")}
 </div>

Modified: incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/selected-concepts.ssp
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/selected-concepts.ssp?rev=898870&r1=898782&r2=898870&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/selected-concepts.ssp (original)
+++ incubator/clerezza/issues/CLEREZZA-59/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/selected-concepts.ssp Wed Jan 13 18:28:41 2010
@@ -1,23 +1,20 @@
 def skos(s: Any) = new UriRef("http://www.w3.org/2008/05/skos#"+s)
 def dct(s: Any) = new UriRef("http://purl.org/dc/terms/"+s)
 
+resultDocModifier.addScriptReference("/static/concepts/scripts/selected-concepts.js");
+
 <div>
-	<script type="text/javascript">
-		$(document).ready(function() {{
-			$(".tx-icon-delete").click(function() {{
-				$(this).parent().remove();
-			}});
-		}});
-	</script>
-	{for (concept <- (res/dct("subject"))) yield {
-	<div>
-		<div><strong>PrefLabel: </strong>{concept/skos("prefLabel")*}</div>
-		<div><strong>Uri: </strong>{concept*}</div>
-		<input type="hidden" name="concepts" value={concept*}></input>
-		<a href="#" class="tx-icon tx-icon-delete" >Add</a>
-		<br />
-		<br />
+	<div id="selected-concepts">
+		{for (concept <- (res/dct("subject"))) yield {
+		<div>
+			<div>PrefLabel: {concept/skos("prefLabel")*}</div>
+			<div>Uri: {concept*}</div>
+			<input type="hidden" name="concepts" value={concept*}></input>
+			<a href="#" class="tx-icon tx-icon-delete" >Add</a>
+			<br />
+			<br />
+		</div>
+		}
+		}
 	</div>
-	}
-	}
 </div>