You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2015/03/22 13:11:42 UTC

[46/51] [partial] clerezza git commit: CLEREZZA-966: started hierarchical project structure, moved platform bundles to platform, only moved RDF artifacts ported to use commons to the rdf folder.

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/selected-concepts.ssp
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/selected-concepts.ssp b/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/selected-concepts.ssp
deleted file mode 100644
index 707c11a..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/selected-concepts.ssp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-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("/concepts/generic-resource/scripts/selected-concepts.js");
-
-<div>
-	<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" >Remove</a>
-			<br />
-			<br />
-		</div>
-		}
-		}
-	</div>
-</div>

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/skos-collection-json.ssp
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/skos-collection-json.ssp b/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/skos-collection-json.ssp
deleted file mode 100644
index 5ee4663..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/skos-collection-json.ssp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-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("[", ",", "]") +
-"}";

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/concept-find-create.js
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/concept-find-create.js b/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/concept-find-create.js
deleted file mode 100644
index e31bd88..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/concept-find-create.js
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * 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.
- * 
- * @author hasan, andre
- */
-function ConceptFinder(){
-};
-
-ConceptFinder.callback;
-
-ConceptFinder.setAddConceptCallback = function(callback){
-	this.callback = callback;
-}
-
-/**
- * Request the server concepts that match the search term in the input field "search-term"
- */
-ConceptFinder.search = function(){
-	$("#system-found-concepts").empty();
-	var queryResult = null;
-	var searchTerm = $(":text[name=\"search-term\"]").val();
-	if (searchTerm.length > 0) {
-		var options = new AjaxOptions("find-concepts", "finding concepts", function(data){
-			var databank = $.rdf.databank();
-			var store = databank.load(data, {});
-			var query = $.rdf({
-				databank: store
-			});
-			query.prefix('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
-			query.prefix('concepts', 'http://clerezza.org/2010/01/concepts#');
-			query.prefix('rdfs', 'http://www.w3.org/2000/01/rdf-schema#');
-			query.prefix('qr', 'http://clerezza.org/2010/04/queryresult#');
-			var resultSet = query.where('?subject rdf:type qr:QueryResult');
-			if (resultSet.size() != 1) {
-				AlertMessage.show(function(){
-				}, "The query results did not match what's expected: exactly 1 result");
-			}
-			var queryResult = query.node(resultSet.get(0).subject);
-			var conceptProperty = $.rdf.resource("<http://clerezza.org/2010/04/queryresult#concept>");
-			var conceptProperties = queryResult.get(conceptProperty);
-			if (conceptProperties) {
-				ConceptFinder.addFoundConcepts(conceptProperties);
-			}
-			$("#add-button-label").html("<div>Add '" + searchTerm + "' as new Free Concept</div>");
-			$("#system-found-concepts-area").show();
-			var newFreeConceptProperty = $.rdf.resource("<http://clerezza.org/2010/04/queryresult#creationOfNewFreeConceptSuggested>");
-			var creationOfNewFreeConceptSuggested = queryResult.get(newFreeConceptProperty)[0].value.toString() == "true";
-			if (creationOfNewFreeConceptSuggested) {
-				$("#user-defined-concept-area").show();
-			} else {
-				$("#user-defined-concept-area").hide();
-			}
-		});
-		options.url = "/concepts/find";
-		options.data = "searchTerm=" + encodeURIComponent(searchTerm) + "&xPropObj=http://clerezza.org/2010/04/queryresult%23concept";
-		options.dataType = "json";
-		options.beforeSend = function(req){
-			req.setRequestHeader("Accept", "application/rdf+json");
-		};
-		
-		$.ajax(options);
-	}
-	return false;
-}
-
-/**
- * Adds the given (array of) concepts to the UI (that's currently being displayed). Displays them by a 
- * +-button and labels (for each of them)
- *
- * @param Json array of concepts
- */
-ConceptFinder.addFoundConcepts = function(concepts){
-	var selectedConceptsExists = false;
-	if (typeof(SelectedConcepts) != "undefined") {
-		selectedConceptsExists = true;
-	}
-	var added = false;
-	for (var i = 0; i < concepts.length; i++) {
-		var concept = concepts[i];
-		if (!selectedConceptsExists || !SelectedConcepts.exists(concept.value)) {
-			added = true;
-			var prefLabelProperty = $.rdf.resource("<http://www.w3.org/2008/05/skos#prefLabel>"); 
-			var prefLabel = concept.get(prefLabelProperty).value;
-			var uri = concept.value;
-			ConceptFinder.createSystemFoundConcept(prefLabel, uri);
-		}
-	}
-	if (added) {
-		$("#label-for-search-results").text("Concepts found:");
-	}
-	else {
-		$("#label-for-search-results").text("No additional concepts found.");
-	}
-}
-
-/**
- * Creates the widget that show the user a concept that was found on the backend. Shows prefLabel, 
- * uri and a button to add the concept to the backend
- * 
- * @param {Object} prefLabel
- * @param {Object} uri
- */
-ConceptFinder.createSystemFoundConcept = function(prefLabel, uri) {
-	var div = $("<div/>");
-	ConceptFinder.createConceptWidgets(prefLabel, uri).appendTo(div)
-	$("<a/>").addClass("tx-icon tx-icon-plus").attr({
-		href: "#"
-	}).text("Add").click(ConceptFinder.onAddClicked(prefLabel, uri)).appendTo(div);
-	$("<br/>").appendTo(div);
-	$("<br/>").appendTo(div);
-	div.appendTo("#system-found-concepts")
-}
-
-ConceptFinder.onAddClicked = function(prefLabel, uri){
-	return function(){
-		if (typeof(SelectedConcepts) != "undefined") {
-			SelectedConcepts.addConcept(prefLabel, uri);
-		}
-		if (typeof(ConceptFinder.callback) == "function") {
-			ConceptFinder.callback(prefLabel, uri);
-		}
-		$(this).parent().remove();
-	};
-}
-
-/**
- * Creates html elements that show the given pref label and uri. Appends them to the given div.
- * 
- * @param {Object} prefLabel
- * @param {Object} uri
- * @param {Object} div
- */
-ConceptFinder.createConceptWidgets = function(prefLabel, uri) {
-	var div = $("<div/>");
-	if (prefLabel.substr(0,1) == "\"") {
-		prefLabel = prefLabel.substring(1, prefLabel.length - 1);
-	}
-	$("<div/>").text("PrefLabel: " + prefLabel).appendTo(div);
-	$("<div/>").text("Uri: " + uri).appendTo(div);
-	$("<input/>").attr({
-		"type": "hidden",
-		"name": "concepts"
-	}).val(uri).appendTo(div);
-	return div;
-}
-
-/**
- * Checks if a concept with the given uri already exists
- * @param {Object} uri
- */
-ConceptFinder.exists = function(uri){
-
-};
-
-function ConceptManipulator(){
-};
-
-ConceptManipulator.callback;
-
-ConceptManipulator.setAddConceptCallback = function(callback){
-	this.callback = callback;
-}
-
-/**
- * sends a new concept to the backend for addition. Uses the search term entered by the user (in the same form).
- */
-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 = {
-			"pref-label": searchTerm,
-			lang: $(":input[name='lang']").val(),
-			comment: $(":textarea[name='comment']").val()
-		}
-		
-		$.ajax(options);
-	}
-	return false;
-}
-
-$(document).ready(function(){
-	$("#go-button").click(function(){
-		ConceptFinder.search();
-	});
-	$("#add-user-defined-concept").click(function(){
-		ConceptManipulator.addConcept();
-		$("#user-defined-concept-area").hide();
-	});
-	$("#system-found-concepts-area").hide();
-	$("#user-defined-concept-area").hide();
-});

http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/concept-provider-manipulation.js
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/concept-provider-manipulation.js b/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/concept-provider-manipulation.js
deleted file mode 100644
index fcab2c1..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/concept-provider-manipulation.js
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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();
-});