Added: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/selected-concepts.js URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/selected-concepts.js?rev=941267&view=auto ============================================================================== --- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/selected-concepts.js (added) +++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/scripts/selected-concepts.js Wed May 5 12:40:28 2010 @@ -0,0 +1,58 @@ +/* + * 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/>"); + ConceptFinder.createConceptWidgets(prefLabel, uri).appendTo(div); + SelectedConcepts.createDeleteButton(prefLabel, uri).appendTo(div); + $("<br />").appendTo(div); + $("<br />").appendTo(div); + $("#selected-concepts").append(div); +} + +/** + * Creates a button that allows to delete a concept. + */ +SelectedConcepts.createDeleteButton = function(prefLabel, uri) { + var deleteLink = $("<a/>").attr("href", "#"); + deleteLink.addClass("tx-icon tx-icon-delete").text("Delete"); + deleteLink.click(function() { + deleteLink.parent().remove(); + ConceptFinder.createSystemFoundConcept(prefLabel, uri) + }); + return deleteLink; +} + + +$(document).ready(function () { + $(".tx-icon-delete").click(function() { + $(this).parent().remove(); + }); +});
Added: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/style/form.css URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/style/form.css?rev=941267&view=auto ============================================================================== --- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/style/form.css (added) +++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/staticweb/style/form.css Wed May 5 12:40:28 2010 @@ -0,0 +1,3 @@ +input, select, textarea { + width: 32em; +} Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/test/java/org/apache/clerezza/platform/concepts/core/ConceptsFinderTest.java URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/test/java/org/apache/clerezza/platform/concepts/core/ConceptsFinderTest.java?rev=941267&r1=941266&r2=941267&view=diff ============================================================================== --- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/test/java/org/apache/clerezza/platform/concepts/core/ConceptsFinderTest.java (original) +++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.core/src/test/java/org/apache/clerezza/platform/concepts/core/ConceptsFinderTest.java Wed May 5 12:40:28 2010 @@ -20,6 +20,8 @@ package org.apache.clerezza.platform.con import java.util.Arrays; import java.util.List; +import org.apache.clerezza.platform.config.PlatformConfig; +import org.apache.clerezza.platform.concepts.ontologies.QUERYRESULT; import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider; import org.apache.clerezza.rdf.core.Graph; import org.apache.clerezza.rdf.core.MGraph; @@ -98,6 +100,23 @@ public class ConceptsFinderTest { @Before public void setUp() { + final PlatformConfig platformConfig = new PlatformConfig() { + + @Override + public UriRef getDefaultBaseUri() { + return new UriRef("http://testing.localhost/"); + } + + }; + final ContentGraphProvider cgProvider = new ContentGraphProvider() { + + @Override + public MGraph getContentGraph() { + return new SimpleMGraph(); + } + + }; + testedConceptProviderManager = new TestedConceptProviderManager(); testedConceptProviderManager.cgProvider = new ContentGraphProvider() { @Override @@ -105,23 +124,29 @@ public class ConceptsFinderTest { return mGraph; } }; - testedConceptsFinder = new TestedConceptsFinder(); + testedConceptsFinder = new TestedConceptsFinder() { + { + bindPlatformConfig(platformConfig); + bindCgProvider(cgProvider); + } + }; testedConceptsFinder.conceptProviderManager = testedConceptProviderManager; + } @Test public void testFindConcepts() { testedConceptProviderManager.fillConceptProviderList(); GraphNode proposals = testedConceptsFinder.findConcepts("any"); - Assert.assertTrue(proposals.countObjects(SKOS.member)==5); - Assert.assertTrue(proposals.hasProperty(SKOS.member, concept1a)); - Assert.assertTrue(proposals.hasProperty(SKOS.member, concept1b)); - Assert.assertTrue(proposals.hasProperty(SKOS.member, concept1c)); - Assert.assertTrue(proposals.hasProperty(SKOS.member, concept1d)); - Assert.assertTrue(proposals.hasProperty(SKOS.member, concept2a)); - Assert.assertFalse(proposals.hasProperty(SKOS.member, concept2b)); - Assert.assertFalse(proposals.hasProperty(SKOS.member, concept2c)); - Assert.assertFalse(proposals.hasProperty(SKOS.member, concept2d)); + Assert.assertEquals(5, proposals.countObjects(QUERYRESULT.concept)); + Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept1a)); + Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept1b)); + Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept1c)); + Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept1d)); + Assert.assertTrue(proposals.hasProperty(QUERYRESULT.concept, concept2a)); + Assert.assertFalse(proposals.hasProperty(QUERYRESULT.concept, concept2b)); + Assert.assertFalse(proposals.hasProperty(QUERYRESULT.concept, concept2c)); + Assert.assertFalse(proposals.hasProperty(QUERYRESULT.concept, concept2d)); } -} +} \ No newline at end of file Added: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.ontologies/src/main/resources/org/apache/clerezza/platform/concepts/ontologies/queryresult.rdf URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.ontologies/src/main/resources/org/apache/clerezza/platform/concepts/ontologies/queryresult.rdf?rev=941267&view=auto ============================================================================== --- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.ontologies/src/main/resources/org/apache/clerezza/platform/concepts/ontologies/queryresult.rdf (added) +++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.concepts/org.apache.clerezza.platform.concepts.ontologies/src/main/resources/org/apache/clerezza/platform/concepts/ontologies/queryresult.rdf Wed May 5 12:40:28 2010 @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<rdf:RDF + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:skos="http://www.w3.org/2008/05/skos#" + xmlns="http://clerezza.org/2010/04/queryresult#" + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xml:base="http://clerezza.org/2010/04/queryresult"> + <owl:Ontology rdf:about="#"> + <owl:versionInfo>Revision: 0.1</owl:versionInfo> + <dc:title xml:lang="en"> + Ontology for describing the result of a Query for Concepts + </dc:title> + </owl:Ontology> + <rdfs:Class rdf:ID="QueryResult"> + <rdfs:label xml:lang="en">Query Result</rdfs:label> + <skos:definition xml:lang="en"> + The result of a query for concepts. + </skos:definition> + <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/> + </rdfs:Class> + <rdf:Property rdf:ID="concept"> + <rdfs:label xml:lang="en">concept</rdfs:label> + <skos:definition xml:lang="en">Points to a concept matching the query yielding to the subject.</skos:definition> + <rdfs:domain rdf:resource="#QueryResult"/> + <rdfs:range rdf:resource="http://www.w3.org/2008/05/skos#Concept"/> + <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/> + </rdf:Property> + <rdf:Property rdf:ID="creationOfNewFreeConceptSuggested"> + <rdfs:label xml:lang="en">creationOfNewFreeConceptSuggested</rdfs:label> + <skos:definition xml:lang="en">Points to a boolean value that indicates whether + consumers of the subject are suggested to create new concepts with a query as + preferred label.</skos:definition> + <rdfs:domain rdf:resource="#QueryResult"/> + <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#boolean"/> + <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/> + </rdf:Property> +</rdf:RDF> +
