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/12 15:19:01 UTC

svn commit: r898337 - in /incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main: java/org/apache/clerezza/platform/concepts/core/ resources/META-INF/ resources/META-INF/static-we...

Author: hasan
Date: Tue Jan 12 14:19:01 2010
New Revision: 898337

URL: http://svn.apache.org/viewvc?rev=898337&view=rev
Log:
CLEREZZA-60: improved doc, moved staticweb to META-INF/static-web folder

Added:
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-provider-manipulation.js
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/form.css
Removed:
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/
Modified:
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/LocalConceptProvider.java
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/SimpleConceptProviderManager.java
    incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/manage-concept-providers-page.ssp

Modified: incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/LocalConceptProvider.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/LocalConceptProvider.java?rev=898337&r1=898336&r2=898337&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/LocalConceptProvider.java (original)
+++ incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/LocalConceptProvider.java Tue Jan 12 14:19:01 2010
@@ -41,8 +41,10 @@
 	/**
 	 * Constructs a {@link LocalConceptProvider} with the specified parameters.
 	 *
-	 * @param conceptProviderManager
-	 *		A reference to the manager of this provider.
+	 * @param tcManager
+	 *		Reference to the {@link TcManager}
+	 * @param contentGraphProvider
+	 *		Reference to a {@link ContentGraphProvider}
 	 * @param selectedScheme
 	 *		The scheme in which concepts are to be searched.
 	 */

Modified: incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/SimpleConceptProviderManager.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/SimpleConceptProviderManager.java?rev=898337&r1=898336&r2=898337&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/SimpleConceptProviderManager.java (original)
+++ incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/SimpleConceptProviderManager.java Tue Jan 12 14:19:01 2010
@@ -28,7 +28,6 @@
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -58,12 +57,8 @@
 import org.apache.clerezza.rdf.utils.GraphNode;
 import org.apache.clerezza.rdf.utils.RdfList;
 import org.apache.clerezza.rdf.utils.UnionMGraph;
-import org.apache.clerezza.web.fileserver.BundlePathNode;
-import org.apache.clerezza.web.fileserver.FileServer;
 import org.apache.felix.scr.annotations.Services;
-import org.osgi.framework.Bundle;
 import org.osgi.service.component.ComponentContext;
-import org.wymiwyg.commons.util.dirbrowser.PathNode;
 
 /**
  * This service manages concept providers. Concept providers are prioritized.
@@ -81,8 +76,6 @@
 @Path("/concepts/provider-manager")
 public class SimpleConceptProviderManager implements ConceptProviderManager {
 
-	private FileServer fileServer;
-
 	@Reference
 	private TcManager tcManager;
 
@@ -107,12 +100,6 @@
 			throws IOException,
 			URISyntaxException {
 
-		Bundle bundle = context.getBundleContext().getBundle();
-		URL resourceDir = getClass().getResource("staticweb");
-		PathNode pathNode = new BundlePathNode(bundle, resourceDir.getPath());
-
-		fileServer = new FileServer(pathNode);
-
 		URL template = getClass().getResource("manage-concept-providers-page.ssp");
 		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
 				new UriRef(template.toURI().toString()),
@@ -293,20 +280,6 @@
 		return Response.status(Status.OK).build();
 	}
 
-	/**
-	 * Returns a PathNode of a static file from the staticweb folder.
-	 *
-	 * @param path specifies the path param of a URI
-	 *
-	 * @return {@link PathNode}
-	 */
-	@GET
-	@Path("{path:.+}")
-	public PathNode getStaticFile(@PathParam("path") String path) {
-		final PathNode node = fileServer.getNode(path);
-		return node;
-	}
-
 	@Override
 	public List<ConceptProvider> getConceptProviders() {
 		return conceptProviderList;

Added: incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-provider-manipulation.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-provider-manipulation.js?rev=898337&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-provider-manipulation.js (added)
+++ incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-provider-manipulation.js Tue Jan 12 14:19:01 2010
@@ -0,0 +1,213 @@
+/*
+ * 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 ConceptProviderGui(){};
+
+ConceptProviderGui.isModified = false;
+
+ConceptProviderGui.query = "PREFIX owl: <http://www.w3.org/2002/07/owl#> \n" +
+	"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" +
+	"PREFIX skos08: <http://www.w3.org/2008/05/skos#> \n" +
+	"PREFIX skos04: <http://www.w3.org/2004/02/skos/core#> \n" +
+	"CONSTRUCT { ?concept a skos08:Concept; skos08:prefLabel ?prefLabel; " +
+		"rdfs:comment ?comment; owl:sameAs ?sameConcept . } \n" +
+	"WHERE { ?concept a skos04:Concept; skos04:prefLabel ?prefLabel . \n" +
+	"OPTIONAL { ?concept rdfs:comment ?comment . } \n" +
+	"OPTIONAL { ?concept owl:sameAs ?sameConcept . } \n" +
+	"FILTER (REGEX(STR(?prefLabel), '${searchTerm}', 'i'))}";
+
+ConceptProviderGui.initButtons = function() {
+
+	ConceptProviderGui.updateButtonState();
+
+	$("#deleteButton").click(function(event) {
+		$("input:checked").each(function() {
+			$(this).parent().parent().remove();
+		});
+		$(this).addClass("tx-inactive");
+		ConceptProviderGui.isModified = true;
+	});
+
+	$("#addProvider").click(function(event) {
+		ConceptProviderGui.addProvider($("#type").val(),
+					$("#conceptScheme").val(),
+					$("#sparqlEndPoint").val(),
+					$("#defaultGraph").val(),
+					$("#query").val());
+		$("#conceptScheme").val("");
+		$("#sparqlEndPoint").val("");
+		$("#defaultGraph").val("");
+		$("#query").val("");
+	});
+
+	$("#addButton").click(function(event) {
+		if($(this).text() == "Save") {
+			var options = new AjaxOptions("update-providers", "updating providers", function(obj) {
+			});
+			$("textarea[id!=query]").each(function() {
+				$(this).removeAttr("disabled");
+			});
+			options.type = "POST";
+			options.url = "update-concept-provider-list";
+			options.data = $("#providers").serialize();
+			$.ajax(options);
+		}
+	});
+}
+
+ConceptProviderGui.addProvider = function(rdfType, conceptScheme, sparqlEndPoint, defaultGraph, query) {
+	var tr = $("<tr/>").attr("id", "");
+	var td1 = $("<td/>");
+	var div = $("<div/>").text("Provider:");
+	var td2 = $("<td/>");
+
+	var selection = $("<select/>").attr("name","types");
+
+	$("#type > option:not(:selected)").each(function() {
+		selection.append($(this).clone());
+	});
+	$("#type > option:selected").each(function() {
+		var option = $(this).clone();
+		option.attr("selected", "selected");
+		selection.append(option);
+	});
+
+	td2.append(div);
+	td2.append(selection);
+	
+	var inputText = $("<input/>").attr({
+				"type":"text",
+				"name":"conceptSchemes",
+				"value": conceptScheme
+				});
+	
+	div = $("<div/>").text("Concept Scheme:");
+	td2.append(div);
+	td2.append(inputText);
+
+	inputText = $("<input/>").attr({
+				"type":"text",
+				"name":"sparqlEndPoints",
+				"value": sparqlEndPoint
+				});
+
+	div = $("<div/>").text("SPARQL End Point");
+	td2.append(div);
+	td2.append(inputText);
+
+	inputText = $("<input/>").attr({
+				"type":"text",
+				"name":"defaultGraphs",
+				"value": defaultGraph
+				});
+
+	div = $("<div/>").text("Default Graph:");
+	td2.append(div);
+	td2.append(inputText)
+	var inputCheckbox = $("<input/>").attr({
+				"type":"checkbox",
+				"value": rdfType
+				});
+
+	inputCheckbox.appendTo(td1);
+
+	td1.appendTo(tr);
+	
+	var textArea = $("<textarea/>").attr({
+				"rows":"8",
+				"name":"queryTemplates"
+				}).val(query);
+	div = $("<div/>").text("Query Template:");
+	td2.append(div);
+	td2.append(textArea);
+	td2.append($("<br/>"));
+	td2.append($("<br/>"));
+	td2.appendTo(tr);
+	tr.insertBefore("#last");
+	ConceptProviderGui.isModified = true;
+
+	$("select[name=types] > option:selected").each(function() {
+		ConceptProviderGui.updateDropDown($(this), "conceptSchemes");
+	});
+}
+
+ConceptProviderGui.updateDropDown = function (obj, name) {
+	if(obj.val().indexOf("Local") != -1) {
+		obj.parent().parent().find("input[name!=" + name + "]").each(function() {
+			$(this).prev().hide();
+			$(this).hide();
+		});
+		obj.parent().parent().find("input[name=" + name + "]").each(function() {
+			$(this).prev().show();
+			$(this).show();
+		});
+		obj.parent().parent().find("textarea").each(function() {
+			$(this).prev().hide();
+			$(this).hide();
+		});
+	} else {
+		obj.parent().parent().find("input[name!=" + name + "]").each(function() {
+			$(this).prev().show();
+			$(this).show();
+		});
+		obj.parent().parent().find("input[name=" + name + "]").each(function() {
+			$(this).prev().hide();
+			$(this).hide();
+		});
+		obj.parent().parent().find("textarea").each(function() {
+			$(this).prev().show();
+			$(this).show();
+		});
+	}
+}
+
+ConceptProviderGui.updateButtonState = function() {
+	var counter = $("input:checked").length;
+	if(counter == 0) {
+		$("#deleteButton").addClass("tx-inactive");
+	} else {
+		$("#deleteButton").removeClass("tx-inactive");
+	}
+}
+
+$(document).ready(function () {
+
+	$("select[name=types]").live("change", function() {
+		$("select[name=types] > option:selected").each(function(){
+			ConceptProviderGui.updateDropDown($(this), "conceptSchemes");
+		});
+	});
+	$("select[name=types] > option:selected").each(function() {
+		ConceptProviderGui.updateDropDown($(this), "conceptSchemes");
+	});
+	$("#type").live("change", function() {
+		$("#type > option:selected").each(function(){
+			ConceptProviderGui.updateDropDown($(this), "conceptScheme");
+			$("#query").val(ConceptProviderGui.query);
+		});
+	});
+	$("#type > option:selected").each(function() {
+		ConceptProviderGui.updateDropDown($(this), "conceptScheme");
+		$("#query").val(ConceptProviderGui.query);
+	});
+	$("input:checkbox").live("change",function() {
+		ConceptProviderGui.updateButtonState();
+	});
+
+	ConceptProviderGui.initButtons();
+});

Added: incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/form.css
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/form.css?rev=898337&view=auto
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/form.css (added)
+++ incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/form.css Tue Jan 12 14:19:01 2010
@@ -0,0 +1,3 @@
+input, select, textarea {
+	width: 32em;
+}

Modified: incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/manage-concept-providers-page.ssp
URL: http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/manage-concept-providers-page.ssp?rev=898337&r1=898336&r2=898337&view=diff
==============================================================================
--- incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/manage-concept-providers-page.ssp (original)
+++ incubator/clerezza/issues/CLEREZZA-60/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/manage-concept-providers-page.ssp Tue Jan 12 14:19:01 2010
@@ -1,5 +1,5 @@
 def skos(s: Any) = new UriRef("http://www.w3.org/2008/05/skos#"+s)
-def cpt(s: Any) = new UriRef("http://clerezza.org/2010/01/concept#"+s)
+def cpt(s: Any) = new UriRef("http://clerezza.org/2010/01/concepts#"+s)
 def lingvoj(s: Any) = new UriRef("http://www.lingvoj.org/ontology#"+s)
 def rdfs(s: Any) = new UriRef("http://www.w3.org/2000/01/rdf-schema#"+s)
 def rdf(s: Any) = new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#"+s)
@@ -38,12 +38,12 @@
 									}}
 						</select>
 
-resultDocModifier.addStyleSheet("style/form.css");
+resultDocModifier.addStyleSheet("/static/concepts/style/form.css");
 resultDocModifier.addScriptReference("/jquery/jquery.tooltip.pack.js");
 resultDocModifier.addScriptReference("/jquery/jquery.ajaxQueue.js");
 resultDocModifier.addScriptReference("/jquery/jquery.autocomplete.min.js");
 resultDocModifier.addScriptReference("/scripts/ajax-options.js");
-resultDocModifier.addScriptReference("scripts/concept-provider-manipulation.js");
+resultDocModifier.addScriptReference("/static/concepts/scripts/concept-provider-manipulation.js");
 resultDocModifier.setTitle("Resource Tagging");
 resultDocModifier.addNodes2Elem("tx-module", <h1>Resource Tagging</h1>);