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:43 UTC
[47/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/java/org/apache/clerezza/platform/concepts/core/ConceptManipulator.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptManipulator.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptManipulator.java
deleted file mode 100644
index 18b1e6c..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptManipulator.java
+++ /dev/null
@@ -1,124 +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.
- */
-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 {
-
- public static String FREE_CONCEPT_SCHEME = "concept-scheme/free-concepts";
-
- @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("pref-label") 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();
- }
-
- UriRef concept = getConceptUriRef(platformConfig, prefLabel);
- contentGraph.add(new TripleImpl(concept, RDF.type,
- SKOS.Concept));
- String baseUri = platformConfig.getDefaultBaseUri().getUnicodeString();
- contentGraph.add(new TripleImpl(concept, SKOS.inScheme,
- new UriRef(baseUri + FREE_CONCEPT_SCHEME)));
- 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();
- }
-
- static UriRef getConceptUriRef(PlatformConfig platformConfig, String prefLabel) {
- String baseUri = platformConfig.getDefaultBaseUri().getUnicodeString();
- return new UriRef(baseUri + "concept/" +
- UriRefUtil.stripNonUriRefChars(prefLabel));
- }
-}
-
-
-
-
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProvider.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProvider.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProvider.java
deleted file mode 100644
index cedd350..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProvider.java
+++ /dev/null
@@ -1,40 +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.
- */
-package org.apache.clerezza.platform.concepts.core;
-
-import org.apache.clerezza.rdf.core.Graph;
-
-/**
- * An implementation of this interface provides a function to retrieve
- * concepts based on a search term.
- *
- * @author hasan
- */
-public interface ConceptProvider {
- /**
- * Returns a graph containing all concepts whose SKOS:prefLabels
- * or SKOS:altLabels contain the search term.
- *
- * @param searchTerm a filter condition that specifies the term that must
- * be contained within SKOS:prefLabels or SKOS:altLabels of a concept.
- * @return a Graph containing all concepts that meet the filter condition.
- *
- */
- public Graph retrieveConcepts(String searchTerm);
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProviderManager.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProviderManager.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProviderManager.java
deleted file mode 100644
index a7b39ec..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProviderManager.java
+++ /dev/null
@@ -1,39 +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.
- */
-package org.apache.clerezza.platform.concepts.core;
-
-import java.util.List;
-
-/**
- * An implementation of this class manages {@link ConceptProvider}s.
- *
- * @author hasan
- */
-public interface ConceptProviderManager {
-
- /**
- * Returns a list of {@link ConceptProvider}s. The list order determines
- * the priority of a {@link ConceptProvider}. The meaning of the priority
- * is left to the implementation and application.
- *
- * @return
- * a list of managed {@link ConceptProvider}s.
- */
- public List<ConceptProvider> getConceptProviders();
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProviderManagerAppPermission.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProviderManagerAppPermission.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProviderManagerAppPermission.java
deleted file mode 100644
index c346a12..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptProviderManagerAppPermission.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2010 reto.
- *
- * Licensed 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.
- * under the License.
- */
-
-package org.apache.clerezza.platform.concepts.core;
-
-import java.security.Permission;
-import org.apache.clerezza.permissiondescriptions.PermissionInfo;
-
-/**
- * Permssion to use an application to Manage Concept-Providers. Note that the
- * user additionally need the respecitive rights on the underlying graphs.
- *
- * @author reto
- */
-@PermissionInfo(value="Concept Provider Manager Access Permission", description="Grants access " +
- "to the Concept Provider Manager page")
-public class ConceptProviderManagerAppPermission extends Permission {
-
- public ConceptProviderManagerAppPermission() {
- super("Graph Management permission");
- }
-
- /**
- *
- * @param target ignored
- * @param action ignored
- */
- public ConceptProviderManagerAppPermission(String target, String actions) {
- super("Graph Management permission");
- }
-
- @Override
- public boolean implies(Permission permission) {
- return equals(permission);
- }
-
- @Override
- public boolean equals(Object obj) {
- return getClass().equals(obj.getClass());
- }
-
- @Override
- public int hashCode() {
- return 77985;
- }
-
- @Override
- public String getActions() {
- return "";
- }
-
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptsFinder.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptsFinder.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptsFinder.java
deleted file mode 100644
index f3ac14e..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ConceptsFinder.java
+++ /dev/null
@@ -1,266 +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.
- */
-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.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.apache.clerezza.platform.concepts.ontologies.QUERYRESULT;
-import org.apache.clerezza.platform.config.PlatformConfig;
-import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
-import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Literal;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
-import org.apache.clerezza.rdf.ontologies.OWL;
-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.GraphNode;
-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;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * This JAX-RS resource can be used to search concepts accessible through
- * registered {@link ConceptProvider}s. If no {@link LocalConceptProvider} is
- * registered for {@link ConceptManipulator.FREE_CONCEPT_SCHEME}, then one is
- * created to find free concepts in the content graph.
- * Concept providers are prioritized.
- * The URI, SKOS:prefLabel and RDFS:comment of a concept from a provider of a
- * higher priority will be used instead of those concepts having an OWL:sameAs
- * relation with this concept, but from a provider of lower priority.
- * Implicitly created {@link LocalConceptProvider} for free concepts has the
- * lowest priority.
- *
- * The URI path of this service is /concepts/find.
- *
- * @author hasan
- */
-@Component
-@Service(Object.class)
-@Property(name = "javax.ws.rs", boolValue = true)
-@Path("/concepts/find")
-public class ConceptsFinder {
-
- @Reference
- private RenderletManager renderletManager;
-
- @Reference
- protected ConceptProviderManager conceptProviderManager;
-
- @Reference
- private TcManager tcManager;
-
- @Reference
- private ContentGraphProvider cgProvider;
-
- @Reference
- private PlatformConfig platformConfig;
-
- private LocalConceptProvider freeConceptProvider = null;
-
- private UriRef freeConceptScheme = null;
-
- protected void activate(ComponentContext context) throws URISyntaxException {
- URL template = getClass().getResource("skos-collection-json.ssp");
- renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
- new UriRef(template.toURI().toString()),
- SKOS.Collection, null,
- MediaType.APPLICATION_JSON_TYPE, true);
-
- freeConceptScheme =
- new UriRef(platformConfig.getDefaultBaseUri().getUnicodeString()
- + ConceptManipulator.FREE_CONCEPT_SCHEME);
- freeConceptProvider = new LocalConceptProvider(tcManager, cgProvider,
- freeConceptScheme);
- }
-
- /**
- * Searches concepts for a specified search term. The actual search task
- * is delegated to each {@link ConceptProvider} instance. The results from
- * each {@link ConceptProvider} are merged into a single result graph.
- * However, concepts from providers of lower priority are only considered if
- * they are not staying in an OWL:sameAs relation with concepts from
- * providers of higher priority.
- *
- * @param searchTerm
- * The search term in form of a String.
- * @return
- * A GraphNode containing the search results.
- */
- @GET
- @Produces("application/rdf+json")
- public GraphNode findConcepts(@QueryParam(value="searchTerm")
- String searchTerm) {
-
- boolean freeConceptProviderFound = false;
-
- List<ConceptProvider> conceptProviderList = conceptProviderManager
- .getConceptProviders();
-
- MGraph resultMGraph = new SimpleMGraph();
- GraphNode resultNode = new GraphNode(new BNode(), resultMGraph);
- boolean first = true;
- for (ConceptProvider cp : conceptProviderList) {
- if (!freeConceptProviderFound) {
- if (cp instanceof LocalConceptProvider) {
- if (((LocalConceptProvider) cp).getSelectedScheme().equals(
- freeConceptScheme)) {
- freeConceptProviderFound = true;
- }
- }
- }
- retrieveConcepts(cp, first, resultNode, searchTerm);
- if (first) {
- first = false;
- }
- }
- if (!freeConceptProviderFound && freeConceptProvider != null) {
- retrieveConcepts(freeConceptProvider, first, resultNode, searchTerm);
- }
- addCreationOfNewFreeConceptSuggested(resultNode, searchTerm);
- resultNode.addProperty(RDF.type, QUERYRESULT.QueryResult);
- return resultNode;
- }
-
- /**
- * Adds a boolean value that answers whether the UI shall suggest to create
- * a new free concept. A new free concept may not be added if the has the
- * same base uri and search term. Therefore the consumer shall be suggested
- * not to propose creation.
- *
- * @param resultNode
- * the result node to add the property to
- * @param searchTerm
- * the search term the data was searched for
- */
- private void addCreationOfNewFreeConceptSuggested(GraphNode resultNode,
- String searchTerm) {
- UriRef conceptUriRef = ConceptManipulator.getConceptUriRef(
- platformConfig, searchTerm);
- resultNode.addProperty(QUERYRESULT.creationOfNewFreeConceptSuggested,
- LiteralFactory.getInstance().createTypedLiteral(
- !cgProvider.getContentGraph().contains(
- new TripleImpl(conceptUriRef, RDF.type,
- SKOS.Concept))));
- }
-
- /**
- * Retrieve concepts for the given search term.
- *
- * @param conceptProvider
- * the provider delivers concepts
- * @param first
- * is this the first execution
- * @param resultNode
- * the node to attach the concepts to
- * @param searchTerm
- * the search term that the concepts have to match against
- */
- private void retrieveConcepts(ConceptProvider conceptProvider,
- boolean first, GraphNode resultNode, String searchTerm) {
- MGraph resultMGraph = (MGraph) resultNode.getGraph();
- Graph graph = conceptProvider.retrieveConcepts(searchTerm);
- Iterator<Triple> concepts = graph.filter(null, RDF.type, SKOS.Concept);
- if (first) {
- while (concepts.hasNext()) {
- resultNode.addProperty(QUERYRESULT.concept, concepts.next()
- .getSubject());
- }
- resultMGraph.addAll(graph);
- } else {
- while (concepts.hasNext()) {
- NonLiteral concept = concepts.next().getSubject();
- GraphNode conceptGraphNode = new GraphNode(concept, graph);
- Iterator<Resource> sameAsConcepts = conceptGraphNode
- .getObjects(OWL.sameAs);
- if (!(hasSameAs(resultMGraph, concept) || hasAnyConcept(
- resultMGraph, sameAsConcepts))) {
- resultNode.addProperty(QUERYRESULT.concept, concept);
- addConceptToResultMGraph(resultMGraph, conceptGraphNode);
- }
-
- }
- }
- }
-
- private boolean hasSameAs(MGraph graph, NonLiteral sameAsConcept) {
- Iterator<Triple> concepts = graph.filter(null, RDF.type, SKOS.Concept);
- while (concepts.hasNext()) {
- NonLiteral concept = concepts.next().getSubject();
- if (graph.filter(concept, OWL.sameAs, sameAsConcept).hasNext()) {
- return true;
- }
- }
- return false;
- }
-
- private boolean hasAnyConcept(MGraph graph, Iterator<Resource> concepts) {
- while (concepts.hasNext()) {
- NonLiteral concept = (NonLiteral) concepts.next();
- if (graph.filter(concept, RDF.type, SKOS.Concept).hasNext()) {
- return true;
- }
- }
- return false;
- }
-
- private void addConceptToResultMGraph(MGraph resultMGraph,
- GraphNode graphNode) {
- NonLiteral concept = (NonLiteral) graphNode.getNode();
- resultMGraph.add(new TripleImpl(concept, RDF.type, SKOS.Concept));
-
- Iterator<Literal> prefLabelStatements = graphNode.getLiterals(SKOS.prefLabel);
- while (prefLabelStatements.hasNext()) {
- resultMGraph.add(new TripleImpl(concept, SKOS.prefLabel,
- prefLabelStatements.next()));
- }
- Iterator<Literal> commentStatements = graphNode.getLiterals(RDFS.comment);
- while (commentStatements.hasNext()) {
- resultMGraph.add(new TripleImpl(concept, RDFS.comment,
- commentStatements.next()));
- }
- Iterator<UriRef> sameAsStatements = graphNode.getUriRefObjects(OWL.sameAs);
- while (sameAsStatements.hasNext()) {
- resultMGraph.add(new TripleImpl(concept, OWL.sameAs,
- sameAsStatements.next()));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/GenericResourcePage.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/GenericResourcePage.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/GenericResourcePage.java
deleted file mode 100644
index e96069e..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/GenericResourcePage.java
+++ /dev/null
@@ -1,111 +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.
- */
-package org.apache.clerezza.platform.concepts.core;
-
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-import javax.ws.rs.core.Response.Status;
-
-import org.apache.clerezza.platform.concepts.ontologies.CONCEPTS;
-import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
-import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.clerezza.rdf.utils.UnionMGraph;
-import org.apache.clerezza.utils.UriException;
-import org.apache.clerezza.web.fileserver.FileServer;
-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;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * This JAX-RS resource can be used to show selected concepts of a resource.
- * The URI path of this service is /concepts/generic-resource.
- *
- * @author tio
- */
-@Component
-@Service(Object.class)
-@Property(name = "javax.ws.rs", boolValue = true)
-@Path("/concepts/generic-resource")
-public class GenericResourcePage extends FileServer {
-
- @Reference
- protected ContentGraphProvider cgProvider;
- @Reference
- private RenderletManager renderletManager;
-
- private RemoteConceptsDescriptionManager remoteConceptsDescriptionManager = null;
-
- protected void activate(ComponentContext context)
- throws URISyntaxException {
-
- configure(context.getBundleContext());
-
- URL template = getClass().getResource("generic-resource-page.ssp");
- renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
- new UriRef(template.toURI().toString()),
- CONCEPTS.GenericResourcePage, "naked",
- MediaType.APPLICATION_XHTML_XML_TYPE, true);
-
- remoteConceptsDescriptionManager = new RemoteConceptsDescriptionManager();
- }
-
- /**
- * Retrieves a resource and its associated concepts to be rendered with a template
- * registered for CONCEPTS.GenericResourcePage.
- *
- * @param uri specifies the uri of a resource
- *
- * @return GraphNode
- */
- @GET
- public GraphNode GenericResourcePage(@QueryParam("uri") UriRef uri,
- @Context UriInfo uriInfo) {
-
- GraphNode node = new GraphNode(new BNode(), new UnionMGraph(new SimpleMGraph(),
- cgProvider.getContentGraph(),
- remoteConceptsDescriptionManager.getRemoteConceptsDescriptionMGraph()));
- node.addProperty(RDF.type, PLATFORM.HeadedPage);
- node.addProperty(RDF.type, CONCEPTS.GenericResourcePage);
- if (uri != null) {
- node.addProperty(CONCEPTS.resource, uri);
- } else {
- throw new WebApplicationException(Response.status(Status.BAD_REQUEST)
- .entity("No resource uri defined.").build());
- }
- return node;
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/LocalConceptProvider.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/LocalConceptProvider.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/LocalConceptProvider.java
deleted file mode 100644
index 4b96110..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/LocalConceptProvider.java
+++ /dev/null
@@ -1,90 +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.
- */
-package org.apache.clerezza.platform.concepts.core;
-
-import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.sparql.ParseException;
-import org.apache.clerezza.rdf.core.sparql.QueryParser;
-import org.apache.clerezza.rdf.core.sparql.query.ConstructQuery;
-
-/**
- * This {@link ConceptProvider} operates on concepts available in the localhost.
- *
- * @author tio, hasan
- */
-public class LocalConceptProvider implements ConceptProvider {
-
- private TcManager tcManager = null;
- private ContentGraphProvider contentGraphProvider = null;
- private UriRef selectedScheme = null;
-
- /**
- * Constructs a {@link LocalConceptProvider} with the specified parameters.
- *
- * @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.
- */
- public LocalConceptProvider(TcManager tcManager,
- ContentGraphProvider contentGraphProvider, UriRef selectedScheme) {
- this.tcManager = tcManager;
- this.contentGraphProvider = contentGraphProvider;
- this.selectedScheme = selectedScheme;
- }
-
- public UriRef getSelectedScheme() {
- return this.selectedScheme;
- }
-
- @Override
- public Graph retrieveConcepts(String searchTerm) {
- QueryParser queryParser = QueryParser.getInstance();
-
- String query = "PREFIX owl: <http://www.w3.org/2002/07/owl#> " +
- "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " +
- "PREFIX skos: <http://www.w3.org/2008/05/skos#> " +
- "CONSTRUCT {?concept a skos:Concept; skos:prefLabel ?prefLabel; " +
- "rdfs:comment ?comment; owl:sameAs ?sameConcept .} " +
- "WHERE {?concept skos:inScheme " + selectedScheme.toString() +
- "; skos:prefLabel ?prefLabel . " +
- "OPTIONAL { ?concept skos:altLabel ?altLabel .} " +
- "OPTIONAL { ?concept rdfs:comment ?comment .} " +
- "OPTIONAL { ?concept owl:sameAs ?sameConcept .} " +
- "FILTER (REGEX(STR(?prefLabel), '" +
- searchTerm + "', 'i') || REGEX(STR(?altLabel), '" +
- searchTerm + "', 'i'))}";
-
- ConstructQuery constructQuery;
- try {
- constructQuery = (ConstructQuery) queryParser.parse(query);
- } catch (ParseException ex) {
- throw new RuntimeException(ex);
- }
-
- MGraph defaultGraph = contentGraphProvider.getContentGraph();
- return tcManager.executeSparqlQuery(constructQuery, defaultGraph);
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/RemoteConceptProvider.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/RemoteConceptProvider.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/RemoteConceptProvider.java
deleted file mode 100644
index f933a53..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/RemoteConceptProvider.java
+++ /dev/null
@@ -1,134 +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.
- */
-package org.apache.clerezza.platform.concepts.core;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.ProtocolException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.Calendar;
-import java.util.Date;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.serializedform.Parser;
-import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
-
-/**
- * This implementation of {@link ConceptProvider} provides a functionality
- * to query a SPARQL End Point for a given search term. The query is to be
- * generated from a template by replacing the place holder for the search term
- * with the specified search term.
- *
- * @author tio, hasan
- */
-public class RemoteConceptProvider implements ConceptProvider {
-
- private UriRef sparqlEndPoint = null;
- private UriRef defaultGraph = null;
- private String queryTemplate = null;
- private ConceptCache conceptCache = null;
- private RemoteConceptsDescriptionManager remoteConceptsDescriptionManager = null;
-
- /**
- * Constructs a {@link RemoteConceptProvider} with the specified parameters.
- *
- * @param sparqlEndPoint
- * the SPARQL End Point to connect to
- * @param defaultGraph
- * the Graph to query for concepts
- * @param queryTemplate
- * the template for query containing place holders for the search term.
- */
- public RemoteConceptProvider(
- UriRef sparqlEndPoint, UriRef defaultGraph, String queryTemplate) {
- this.sparqlEndPoint = sparqlEndPoint;
- this.defaultGraph = defaultGraph;
- this.queryTemplate = queryTemplate;
- this.conceptCache = new ConceptCache(sparqlEndPoint, defaultGraph);
- this.remoteConceptsDescriptionManager = new RemoteConceptsDescriptionManager();
- }
-
- @Override
- public Graph retrieveConcepts(String searchTerm) {
-
- Calendar calendar = Calendar.getInstance();
- calendar.add(Calendar.DAY_OF_MONTH, -30);
- Date acceptableOldestCachingDate = calendar.getTime();
- MGraph cachedConcepts = conceptCache.retrieve(searchTerm.toLowerCase(),
- acceptableOldestCachingDate);
- if (cachedConcepts != null) {
- return cachedConcepts.getGraph();
- } else {
- final int connectionTimeout = 4000;
- String query = queryTemplate.replace("${searchTerm}", searchTerm);
- try {
- String param = "query=" + URLEncoder.encode(query, "UTF-8");
- if (defaultGraph != null) {
- param += "&default-graph-uri=" + defaultGraph.getUnicodeString();
- }
- final URL url = new URL(sparqlEndPoint.getUnicodeString());
- final HttpURLConnection con =
- (HttpURLConnection) url.openConnection();
- con.setRequestProperty("Accept", "application/rdf+xml");
- con.setRequestMethod("POST");
- con.setDoOutput(true);
- con.setDoInput(true);
- con.setUseCaches(false);
- con.setConnectTimeout(connectionTimeout);
-
- final OutputStream os = con.getOutputStream();
- os.write(param.getBytes());
- os.close();
-
- if (con.getResponseCode() < 400) {
- final InputStream is = con.getInputStream();
- Graph parsedGraph = Parser.getInstance().parse(is,
- SupportedFormat.RDF_XML);
- is.close();
- conceptCache.cache(searchTerm.toLowerCase(), parsedGraph);
- remoteConceptsDescriptionManager.storeConceptsDescription(parsedGraph);
- return parsedGraph;
- } else {
- final InputStream es = con.getErrorStream();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- for (int ch = es.read(); ch != -1; ch = es.read()) {
- baos.write(ch);
- }
- es.close();
- throw new RuntimeException(baos.toString());
- }
- } catch (ProtocolException ex) {
- throw new RuntimeException(ex);
- } catch (MalformedURLException ex) {
- throw new RuntimeException(ex);
- } catch (UnsupportedEncodingException ex) {
- throw new RuntimeException(ex);
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/RemoteConceptsDescriptionManager.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/RemoteConceptsDescriptionManager.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/RemoteConceptsDescriptionManager.java
deleted file mode 100644
index 7932829..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/RemoteConceptsDescriptionManager.java
+++ /dev/null
@@ -1,102 +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.
- */
-package org.apache.clerezza.platform.concepts.core;
-
-import java.util.Iterator;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Literal;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.access.TcManager;
-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.GraphNode;
-
-/**
- * This class stores description of concepts resulted from searches
- * performed by {@link RemoteConceptProvider}s.
- *
- * @author hasan
- */
-public class RemoteConceptsDescriptionManager {
-
- private UriRef REMOTE_CONCEPTS_DESCRIPTION_MGRAPH =
- new UriRef("urn:x-localinstance:/remote.concepts.description");
-
- /**
- * Stores SKOS:prefLabel and RDFS.comment of concepts available in the
- * specified Graph.
- *
- * @param graph
- * the Graph which contains concepts and their descriptions.
- */
- void storeConceptsDescription(Graph graph) {
- MGraph remoteConceptsDescriptionMGraph =
- getRemoteConceptsDescriptionMGraph();
-
- Iterator<Triple> concepts = graph.filter(null, RDF.type, SKOS.Concept);
- while (concepts.hasNext()) {
- UriRef concept = (UriRef) concepts.next().getSubject();
- copyConceptDescription(new GraphNode(concept, graph),
- new GraphNode(concept, remoteConceptsDescriptionMGraph));
- }
- }
-
- /**
- * This method creates an {@link MGraph} to store concepts' descriptions
- * if this graph does not already exist.
- *
- * @return
- * an {@link MGraph}
- */
- public MGraph getRemoteConceptsDescriptionMGraph() {
- MGraph remoteConceptsDescriptionMGraph = null;
- TcManager tcManager = TcManager.getInstance();
- try {
- remoteConceptsDescriptionMGraph =
- tcManager.getMGraph(REMOTE_CONCEPTS_DESCRIPTION_MGRAPH);
- } catch (NoSuchEntityException nsee) {
- remoteConceptsDescriptionMGraph =
- tcManager.createMGraph(REMOTE_CONCEPTS_DESCRIPTION_MGRAPH);
- }
- return remoteConceptsDescriptionMGraph;
- }
-
- private void copyConceptDescription(GraphNode sourceGraphNode,
- GraphNode destinationGraphNode) {
-
- destinationGraphNode.deleteNodeContext();
-
- Iterator<Literal> prefLabelStatements =
- sourceGraphNode.getLiterals(SKOS.prefLabel);
- if (prefLabelStatements.hasNext()) {
- destinationGraphNode.addProperty(SKOS.prefLabel,
- prefLabelStatements.next());
- }
- Iterator<Literal> commentStatements =
- sourceGraphNode.getLiterals(RDFS.comment);
- while (commentStatements.hasNext()) {
- destinationGraphNode.addProperty(RDFS.comment,
- commentStatements.next());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ResourceTagger.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ResourceTagger.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ResourceTagger.java
deleted file mode 100644
index 3bff348..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/ResourceTagger.java
+++ /dev/null
@@ -1,131 +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.
- */
-package org.apache.clerezza.platform.concepts.core;
-
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.clerezza.jaxrs.utils.RedirectUtil;
-import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesService;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.ontologies.DCTERMS;
-import org.apache.clerezza.rdf.ontologies.RDFS;
-import org.apache.clerezza.rdf.utils.GraphNode;
-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;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * This JAX-RS resource can be used for adding concepts to a resource.
- *
- * The URI path of this service is /concepts/tagger.
- *
- * @author tio
- */
-@Component
-@Service(Object.class)
-@Property(name = "javax.ws.rs", boolValue = true)
-@Path("/concepts/tagger/")
-public class ResourceTagger {
-
- @Reference
- protected ContentGraphProvider cgProvider;
- @Reference
- private ScalaServerPagesService scalaServerPagesService;
-
- protected void activate(ComponentContext context)
- throws URISyntaxException {
-
- BundleContext bundleContext = context.getBundleContext();
- URL template = getClass().getResource("concept-existing-subjects.ssp");
-
- scalaServerPagesService.registerScalaServerPage(
- template,
- RDFS.Resource, "concept-existing-subjects-naked",
- MediaType.APPLICATION_XHTML_XML_TYPE, bundleContext);
-
- template = getClass().getResource("concept-tagging.ssp");
- scalaServerPagesService.registerScalaServerPage(
- template,
- RDFS.Resource, "concept-tagging-naked",
- MediaType.APPLICATION_XHTML_XML_TYPE, bundleContext);
-
- template = getClass().getResource("concept-find-create.ssp");
- scalaServerPagesService.registerScalaServerPage(
- template,
- RDFS.Resource, "concept-find-create-naked",
- MediaType.APPLICATION_XHTML_XML_TYPE, bundleContext);
-
- template = getClass().getResource("selected-concepts.ssp");
- scalaServerPagesService.registerScalaServerPage(
- template,
- RDFS.Resource, "selectedconcepts-naked",
- MediaType.APPLICATION_XHTML_XML_TYPE, bundleContext);
- }
-
- /**
- * Adds concepts to a resource. If parameters uri and
- * concepts are not defined a response with code BAD_REQUEST is returned. If
- * the relation is succefully added a redirect to /concepts/generic-resource with
- * the UriRef of the resource as parameter.
- *
- * @param uri specifies the uri of a resource
- * @param concepts specifies a list of concept uris.
- *
- * @return
- * A Response
- */
- @POST
- @Path("set")
- public Response updateConcepts(@FormParam("uri") UriRef uri,
- @FormParam("concepts") List<String> concepts,
- @Context UriInfo uriInfo) {
-
-
- if (uri != null) {
- GraphNode node = new GraphNode(uri, cgProvider.getContentGraph());
- node.deleteProperties(DCTERMS.subject);
- if(concepts != null) {
- for (String subject : concepts) {
- node.addProperty(DCTERMS.subject, new UriRef(subject));
- }
- }
- } else {
- throw new WebApplicationException(Response.status(
- Status.BAD_REQUEST).entity("No resource uri defined.").build());
- }
- return RedirectUtil.createSeeOtherResponse("/concepts/generic-resource?uri=" +
- uri.getUnicodeString(), uriInfo);
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/SimpleConceptProviderManager.java
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/SimpleConceptProviderManager.java b/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/SimpleConceptProviderManager.java
deleted file mode 100644
index 98ee7cc..0000000
--- a/platform.concepts/platform.concepts.core/src/main/java/org/apache/clerezza/platform/concepts/core/SimpleConceptProviderManager.java
+++ /dev/null
@@ -1,319 +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.
- */
-package org.apache.clerezza.platform.concepts.core;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.AccessControlException;
-import java.security.AccessController;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-import org.apache.clerezza.jaxrs.utils.TrailingSlash;
-import org.apache.clerezza.platform.concepts.ontologies.CONCEPTS;
-import org.apache.clerezza.platform.globalmenu.GlobalMenuItem;
-import org.apache.clerezza.platform.globalmenu.GlobalMenuItemsProvider;
-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;
-import org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider;
-import org.apache.clerezza.platform.typerendering.RenderletManager;
-import org.apache.clerezza.platform.typerendering.scalaserverpages.ScalaServerPagesRenderlet;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.access.security.TcPermission;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
-import org.apache.clerezza.rdf.ontologies.PLATFORM;
-import org.apache.clerezza.rdf.ontologies.RDF;
-import org.apache.clerezza.rdf.utils.GraphNode;
-import org.apache.clerezza.rdf.utils.RdfList;
-import org.apache.clerezza.rdf.utils.UnionMGraph;
-import org.apache.felix.scr.annotations.Services;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * This service manages concept providers. Concept providers are prioritized.
- *
- * The URI path of this service is /concepts/provider-manager.
- *
- * @author hasan, tio
- */
-@Component
-@Services({
- @Service(Object.class),
- @Service(ConceptProviderManager.class),
- @Service(GlobalMenuItemsProvider.class)
-})
-@Property(name = "javax.ws.rs", boolValue = true)
-@Path("/concepts/provider-manager")
-public class SimpleConceptProviderManager implements ConceptProviderManager,
- GlobalMenuItemsProvider {
-
- @Reference
- private TcManager tcManager;
-
- @Reference
- protected ContentGraphProvider cgProvider;
-
- @Reference
- private RenderletManager renderletManager;
-
- private List<ConceptProvider> conceptProviderList =
- new ArrayList<ConceptProvider>();
-
- /**
- * The activate method is called when SCR activates the component
- * configuration.
- *
- * @param context
- * @throws IOException
- * @throws URISyntaxException
- */
- protected void activate(ComponentContext context)
- throws IOException,
- URISyntaxException {
-
- URL template = getClass().getResource("manage-concept-providers-page.ssp");
- renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
- new UriRef(template.toURI().toString()),
- CONCEPTS.ManageConceptProvidersPage, "naked",
- MediaType.APPLICATION_XHTML_XML_TYPE, true);
-
- instantiateConceptProviders();
- }
-
- protected void deactivate(ComponentContext context) {
- conceptProviderList.clear();
- }
-
- private void instantiateConceptProviders() {
- conceptProviderList.clear();
- MGraph contentGraph = cgProvider.getContentGraph();
-
- NonLiteral cplNode = getConceptProviderListNode(contentGraph);
- RdfList cpl = new RdfList(cplNode, contentGraph);
- for (int i = 0; i < cpl.size(); i++) {
- NonLiteral conceptProvider = (NonLiteral) cpl.get(i);
- Iterator<Triple> conceptProviderTypes = contentGraph.filter(
- conceptProvider, RDF.type, null);
- if (conceptProviderTypes.hasNext()) {
- UriRef conceptProviderType = (UriRef) conceptProviderTypes.next().getObject();
- if (conceptProviderType.equals(CONCEPTS.LocalConceptProvider)) {
- instantiateLocalConceptProvider(contentGraph, conceptProvider);
- } else {
- instantiateRemoteConceptProvider(contentGraph, conceptProvider);
- }
- }
- }
- }
-
- private NonLiteral getConceptProviderListNode(MGraph contentGraph) {
- Iterator<Triple> triples = contentGraph.filter(null, RDF.type,
- CONCEPTS.ConceptProviderList);
- if (triples.hasNext()) {
- return triples.next().getSubject();
- }
- NonLiteral cplNode = new BNode();
- new RdfList(cplNode, contentGraph);
- contentGraph.add(new TripleImpl(cplNode, RDF.type,
- CONCEPTS.ConceptProviderList));
- return cplNode;
- }
-
- private void instantiateLocalConceptProvider(MGraph contentGraph,
- NonLiteral conceptProvider) {
- Iterator<Triple> selectedSchemes = contentGraph.filter(
- conceptProvider, CONCEPTS.selectedScheme, null);
- if (selectedSchemes.hasNext()) {
- UriRef selectedScheme = (UriRef) selectedSchemes.next().getObject();
- conceptProviderList.add(new LocalConceptProvider(tcManager,
- cgProvider, selectedScheme));
- }
- }
-
- private void instantiateRemoteConceptProvider(MGraph contentGraph,
- NonLiteral conceptProvider) {
- Iterator<Triple> endPoints = contentGraph.filter(
- conceptProvider, CONCEPTS.sparqlEndPoint, null);
- if (endPoints.hasNext()) {
- UriRef sparqlEndPoint = (UriRef) endPoints.next().getObject();
- Iterator<Triple> defaultGraphs = contentGraph.filter(
- conceptProvider, CONCEPTS.defaultGraph, null);
- UriRef defaultGraph = null;
- if (defaultGraphs.hasNext()) {
- defaultGraph = (UriRef) defaultGraphs.next().getObject();
- }
- Iterator<Triple> queryTemplates = contentGraph.filter(
- conceptProvider, CONCEPTS.queryTemplate, null);
- if (queryTemplates.hasNext()) {
- TypedLiteral queryTemplate =
- (TypedLiteral) queryTemplates.next().getObject();
- conceptProviderList.add(
- new RemoteConceptProvider(sparqlEndPoint,
- defaultGraph, queryTemplate.getLexicalForm()));
- }
- }
- }
-
- /**
- * Returns a GraphNode containing a list of {@link ConceptProvider}s stored
- * in the content graph to be managed. The order in the list represents
- * the priority of the providers.
- * This resource is accessible through a GET request on the URI sub-path
- * "edit-concept-provider-list".
- *
- */
- @GET
- @Path("edit-concept-provider-list")
- public GraphNode getProviderList(@Context UriInfo uriInfo) {
- AccessController.checkPermission(
- new ConceptProviderManagerAppPermission());
- TrailingSlash.enforceNotPresent(uriInfo);
- MGraph contentGraph = cgProvider.getContentGraph();
- MGraph resultGraph = new SimpleMGraph();
-
- NonLiteral cplNode = getConceptProviderListNode(contentGraph);
- GraphNode resultNode = new GraphNode(cplNode, resultGraph);
-
- resultNode.addProperty(RDF.type, CONCEPTS.ManageConceptProvidersPage);
- resultNode.addProperty(RDF.type, PLATFORM.HeadedPage);
- return new GraphNode(resultNode.getNode(),
- new UnionMGraph(resultGraph, contentGraph));
- }
-
- /**
- * Allows the list of {@link ConceptProvider}s stored in the content graph
- * to be updated with the list POSTed via the URI sub-path
- * "update-concept-provider-list".
- * The order in the list represents the priority of the providers.
- *
- * @param types
- * specify the type of each ConceptProvider: either a
- * LocalConceptProvider or a RemoteConceptProvider.
- * @param sparqlEndPoints
- * the SPARQL EndPoint to connect to in case of a RemoteConceptProvider.
- * @param defaultGraphs
- * the Graph to be queried in case of a RemoteConceptProvider.
- * @param queryTemplates
- * the template for the query to be used in case of a RemoteConceptProvider.
- * @param conceptSchemes
- * the concept scheme within which concepts are to be searched,
- * in case of a LocalConceptProvider.
- * @return
- * - a 200 (OK) response if everything is fine.
- * - a 400 (BAD REQUEST) response if types parameter is undefined.
- */
- @POST
- @Path("update-concept-provider-list")
- public Response updateConceptProviders(
- @FormParam("types") List<String> types,
- @FormParam("sparqlEndPoints") List<String> sparqlEndPoints,
- @FormParam("defaultGraphs") List<String> defaultGraphs,
- @FormParam("queryTemplates") List<String> queryTemplates,
- @FormParam("conceptSchemes") List<String> conceptSchemes) {
-
- if (types == null) {
- //types is null when all provider have been removed, processing empty list
- types = new ArrayList<String>();
- }
- MGraph contentGraph = cgProvider.getContentGraph();
- NonLiteral cplNode = getConceptProviderListNode(contentGraph);
- GraphNode cplGraphNode = new GraphNode(cplNode, contentGraph);
- cplGraphNode.deleteNodeContext();
-
- cplNode = getConceptProviderListNode(contentGraph);
- RdfList cpl = new RdfList(cplNode, contentGraph);
-
- int length = types.size();
- for (int i=0; i<length; i++) {
- UriRef conceptProviderType = new UriRef(types.get(i));
- BNode conceptProvider = new BNode();
- contentGraph.add(new TripleImpl(conceptProvider, RDF.type,
- conceptProviderType));
- if (conceptProviderType.equals(CONCEPTS.LocalConceptProvider)) {
- contentGraph.add(new TripleImpl(conceptProvider,
- CONCEPTS.selectedScheme,
- new UriRef(conceptSchemes.get(i))));
- } else {
- contentGraph.add(new TripleImpl(conceptProvider,
- CONCEPTS.sparqlEndPoint,
- new UriRef(sparqlEndPoints.get(i))));
- String defaultGraph = defaultGraphs.get(i);
- if (!defaultGraph.trim().isEmpty()) {
- contentGraph.add(new TripleImpl(conceptProvider,
- CONCEPTS.defaultGraph,
- new UriRef(defaultGraph)));
- }
- contentGraph.add(new TripleImpl(conceptProvider,
- CONCEPTS.queryTemplate,
- LiteralFactory.getInstance().createTypedLiteral(
- queryTemplates.get(i))));
- }
- cpl.add(i, conceptProvider);
- }
- instantiateConceptProviders();
- return Response.status(Status.OK).build();
- }
-
- @Override
- public List<ConceptProvider> getConceptProviders() {
- return conceptProviderList;
- }
-
- @Override
- public Set<GlobalMenuItem> getMenuItems() {
- Set<GlobalMenuItem> items = new HashSet<GlobalMenuItem>();
- try {
- AccessController.checkPermission(
- new TcPermission("urn:x-localinstance:/content.graph",
- TcPermission.READWRITE));
- } catch (AccessControlException e) {
- return items;
- }
- try {
- AccessController.checkPermission(
- new ConceptProviderManagerAppPermission());
- } catch (AccessControlException e) {
- return items;
- }
- items.add(new GlobalMenuItem("/concepts/provider-manager/edit-concept-provider-list",
- "CPM", "Concept Providers", 5, "Administration"));
- return items;
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-find-create.js
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-find-create.js b/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-find-create.js
deleted file mode 100644
index 67c4ee4..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-find-create.js
+++ /dev/null
@@ -1,21 +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.
- *
-*/
-
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-provider-manipulation.js
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-provider-manipulation.js b/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-provider-manipulation.js
deleted file mode 100644
index 67c4ee4..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/concept-provider-manipulation.js
+++ /dev/null
@@ -1,21 +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.
- *
-*/
-
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/selected-concepts.js
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/selected-concepts.js b/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/selected-concepts.js
deleted file mode 100644
index 67c4ee4..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/scripts/selected-concepts.js
+++ /dev/null
@@ -1,21 +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.
- *
-*/
-
http://git-wip-us.apache.org/repos/asf/clerezza/blob/af0d99b2/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/form.css
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/form.css b/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/form.css
deleted file mode 100644
index 67c4ee4..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/META-INF/static-web/concepts/style/form.css
+++ /dev/null
@@ -1,21 +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.
- *
-*/
-
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/concept-existing-subjects.ssp
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-existing-subjects.ssp b/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-existing-subjects.ssp
deleted file mode 100644
index 823cb97..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-existing-subjects.ssp
+++ /dev/null
@@ -1,29 +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)
-def cpt(s: Any) = new UriRef("http://clerezza.org/2010/01/concepts#"+s);
-
-<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-naked")}
-</form>
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/concept-find-create.ssp
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-find-create.ssp b/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-find-create.ssp
deleted file mode 100644
index c0436d8..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-find-create.ssp
+++ /dev/null
@@ -1,61 +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.
- *
-*/
-
-resultDocModifier.addScriptReference("/jquery/jquery-1.3.2.min.js");
-resultDocModifier.addScriptReference("/scripts/ajax-options.js");
-//resultDocModifier.addScriptReference("/scripts/modification-status.js");
-resultDocModifier.addScriptReference("/scripts/status-message.js");
-
-resultDocModifier.addScriptReference("/concepts/generic-resource/scripts/concept-find-create.js");
-resultDocModifier.addScriptReference("/concepts/generic-resource/scripts/jquery.rdfquery.core-1.0.js");
-
-resultDocModifier.addScriptReference("/scripts/alert-message.js");
-resultDocModifier.addScriptReference("/yui/2/yahoo-dom-event/yahoo-dom-event.js");
-resultDocModifier.addScriptReference("/yui/2/element/element-min.js");
-resultDocModifier.addScriptReference("/yui/2/container/container-min.js");
-resultDocModifier.addStyleSheet("/yui/2/container/assets/container-core.css");
-
-
-<div>Add Concepts</div>
-<form onsubmit="return ConceptFinder.search()" id="search-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-found-concepts-area">
- <div id="label-for-search-results">
- Found Concepts:
- </div>
- <br/>
- <div id="system-found-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>
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/concept-tagging.ssp
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-tagging.ssp b/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-tagging.ssp
deleted file mode 100644
index a81d5a2..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/concept-tagging.ssp
+++ /dev/null
@@ -1,23 +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.
- *
-*/
-
-<div class="concept-tagging">{render(res,"concept-existing-subjects-naked")}
-{render(res,"concept-find-create-naked")}</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/generic-resource-page.ssp
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/generic-resource-page.ssp b/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/generic-resource-page.ssp
deleted file mode 100644
index e27759b..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/generic-resource-page.ssp
+++ /dev/null
@@ -1,43 +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)
-def cpt(s: Any) = new UriRef("http://clerezza.org/2010/01/concepts#"+s);
-
-resultDocModifier.setTitle("Generic Resource Page");
-resultDocModifier.addNodes2Elem("tx-module", <h1>Generic Resource Page</h1>);
-resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Resource</a></li>);
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="#">Save</a></li>);
-
-<div id="tx-content">
- <script type="text/javascript">
- $(document).ready(function() {{
- $("#addButton").click(function() {{
- $("#selected-concepts-form").submit();
- }});
- }});
- </script>
- <h4>About: {res/cpt("resource")*}</h4>
- <div><object width="80%" data={res/cpt("resource")*}></object></div>
- <br/>
- {render(res,"concept-tagging-naked")}
-</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/manage-concept-providers-page.ssp
----------------------------------------------------------------------
diff --git a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/manage-concept-providers-page.ssp b/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/manage-concept-providers-page.ssp
deleted file mode 100644
index e0ef754..0000000
--- a/platform.concepts/platform.concepts.core/src/main/resources/org/apache/clerezza/platform/concepts/core/manage-concept-providers-page.ssp
+++ /dev/null
@@ -1,128 +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 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)
-
-def createProvider(rdfType: String, selectedScheme: String, sparqlEndPoint: String, defaultGraph: String, query: String) =
- <tr>
- <td>
- <input type="checkbox" value={rdfType}/>
- </td>
- <td>
- <div>Provider:
- </div>
- {createSelection(!selectedScheme.equals(""))}
- <br/>
- <div>Concept Scheme:</div>
- <input type="text" value={selectedScheme} name="conceptSchemes"/>
- <div>SPARQL Endpoint:</div>
- <input type="text" value={sparqlEndPoint} name="sparqlEndPoints"/>
- <div>Default Graph:</div>
- <input type="text" value={defaultGraph} name="defaultGraphs"/>
- <div>Query Template:</div>
- <textarea rows="8" name="queryTemplates">{query}</textarea>
- <br/>
- <br/>
- </td>
- </tr>
-
-
-def createSelection(isLocal: Boolean) = <select name="types">
- {if(isLocal) {
- <option value={cpt("LocalConceptProvider").getUnicodeString()} selected="selected">LocalConceptProvider</option>
- <option value={cpt("RemoteConceptProvider").getUnicodeString()} >RemoteConceptProvider</option>
- } else {
- <option value={cpt("LocalConceptProvider").getUnicodeString()}>LocalConceptProvider</option>
- <option value={cpt("RemoteConceptProvider").getUnicodeString()} selected="selected">RemoteConceptProvider</option>
- }}
- </select>
-
-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("/yui/2/yahoo-dom-event/yahoo-dom-event.js");
-/*resultDocModifier.addScriptReference("/yui/2/container/assets/container-core.css");*/
-resultDocModifier.addScriptReference("/yui/2/container/container-min.js");
-resultDocModifier.addScriptReference("/scripts/alert-message.js");
-resultDocModifier.addScriptReference("/scripts/ajax-options.js");
-resultDocModifier.addScriptReference("/concepts/generic-resource/scripts/concept-provider-manipulation.js");
-resultDocModifier.setTitle("Resource Tagging");
-resultDocModifier.addNodes2Elem("tx-module", <h1>Resource Tagging</h1>);
-
-resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="">Concept Providers Manager</a></li>);
-
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-remove" href="#">Remove</a></li>);
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="#">Save</a></li>);
-
-<div id="tx-content">
- <div class="tx-tree">
- <form action="" id="providers" method="post">
- <fieldset>
- <table>
- <thead>
- <tr>
- <th><a href="#"></a></th>
- <th style="width: 95%"><a href="#"></a>Concept Providers</th>
- </tr>
- </thead>
- <tbody>
- { for (provider <- (res!!)) yield {
- if((provider/rdf("type")*).indexOf("LocalConceptProvider") != -1) {
- createProvider((provider/rdf("type")*), provider/cpt("selectedScheme")*, "", "", "")
- } else {
- createProvider((provider/rdf("type")*), "", provider/cpt("sparqlEndPoint")*, provider/cpt("defaultGraph")*, provider/cpt("queryTemplate")*)
- }
- }
- }
- <tr id="last">
- <td></td>
- <td>
- <div>Add Concept Provider:</div>
- <select id="type">
- <option value={cpt("LocalConceptProvider").getUnicodeString()}>LocalConceptProvider</option>
- <option value={cpt("RemoteConceptProvider").getUnicodeString()}>RemoteConceptProvider</option>
- </select>
- <div>Concept Scheme:</div>
- <input type="text" name="conceptScheme" id="conceptScheme"/>
- <div>SPARQL Endpoint</div>
- <input type="text" name="sparqlEndPoint" id="sparqlEndPoint" />
- <div>Default Graph:</div>
- <input type="text" name="defaultGraph" id="defaultGraph"/>
- <div>Query Template:</div>
- <textarea rows="8" id="query"/>
- <br/>
- <br/>
- <div>
- <a href="#" class="tx-icon tx-icon-ok" id="addProvider">Add</a>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </fieldset>
- </form>
- </div>
-</div>