Author: ogrisel
Date: Mon Mar 26 21:55:53 2012
New Revision: 1305624

URL: http://svn.apache.org/viewvc?rev=1305624&view=rev
Log:
STANBOL-197: Work in progress on REST API for training classifier models

Added:
    incubator/stanbol/trunk/enhancer/topic-web/   (with props)
    incubator/stanbol/trunk/enhancer/topic-web/pom.xml
    incubator/stanbol/trunk/enhancer/topic-web/src/
    incubator/stanbol/trunk/enhancer/topic-web/src/main/
    incubator/stanbol/trunk/enhancer/topic-web/src/main/java/
    incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/
    incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/
    incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/TopicClassifierFragment.java
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource.java
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource.java
    incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/
    incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/
    incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource/index.ftl
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource/
    
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource/index.ftl
Modified:
    incubator/stanbol/trunk/enhancer/pom.xml
    incubator/stanbol/trunk/parent/pom.xml
    incubator/stanbol/trunk/pom.xml

Modified: incubator/stanbol/trunk/enhancer/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/pom.xml?rev=1305624&r1=1305623&r2=1305624&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/pom.xml (original)
+++ incubator/stanbol/trunk/enhancer/pom.xml Mon Mar 26 21:55:53 2012
@@ -55,6 +55,7 @@
     <module>chain/graph</module>
     <module>chain/list</module>
     <module>chain/weighted</module>
+    <module>topic-web</module>
     <module>defaults</module>
     <module>bundlelist</module>
   </modules>

Propchange: incubator/stanbol/trunk/enhancer/topic-web/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 26 21:55:53 2012
@@ -0,0 +1,5 @@
+.project
+.classpath
+.settings
+bin
+target

Added: incubator/stanbol/trunk/enhancer/topic-web/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/topic-web/pom.xml?rev=1305624&view=auto
==============================================================================
--- incubator/stanbol/trunk/enhancer/topic-web/pom.xml (added)
+++ incubator/stanbol/trunk/enhancer/topic-web/pom.xml Mon Mar 26 21:55:53 2012
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.stanbol</groupId>
+    <artifactId>org.apache.stanbol.enhancer.parent</artifactId>
+    <version>0.9.0-incubating-SNAPSHOT</version>
+    <relativePath>../parent</relativePath>
+  </parent>
+
+  <groupId>org.apache.stanbol</groupId>
+  <artifactId>org.apache.stanbol.enhancer.web.topic</artifactId>
+  <packaging>bundle</packaging>
+
+  <name>Apache Stanbol Enhancer Enhancement Engine : Topic Classification - 
Web API</name>
+  <description>
+    REST API to manage training datasets and models for the topic
+    classification enhancer engine.
+  </description>
+
+  <inceptionYear>2010</inceptionYear>
+
+  <scm>
+    <connection>
+      
scm:svn:http://svn.apache.org/repos/asf/incubator/stanbol/trunk/enhancer/topic-web/
+    </connection>
+    <developerConnection>
+      
scm:svn:https://svn.apache.org/repos/asf/incubator/stanbol/trunk/enhancer/topic-web/
+    </developerConnection>
+    <url>http://incubator.apache.org/stanbol/</url>
+  </scm>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>depends-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Package>
+              
org.apache.stanbol.enhancer.web.topic.*;version=${project.version}
+            </Export-Package>
+            <Embed-Dependency>
+                mail
+            </Embed-Dependency>
+            <Import-Package>
+              javax.ws.rs.*; version="[0,2)",
+              *
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-scr-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.commons.web.base</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.enhancer.servicesapi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.enhancer.engine.topic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.scr.annotations</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+
+    <!-- Servlet API for handling ServletContext -->
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+    </dependency>
+
+    <!-- Jersey -->
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-core</artifactId>
+    </dependency>
+
+    <!-- Freemarker -->
+    <dependency>
+      <groupId>org.freemarker</groupId>
+      <artifactId>freemarker</artifactId>
+    </dependency>
+    <!-- indirect dependency for freemarker -->
+    <dependency>
+      <groupId>org.codehaus.jettison</groupId>
+      <artifactId>jettison</artifactId>
+    </dependency>   
+
+  </dependencies>
+</project>

Added: 
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/TopicClassifierFragment.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/TopicClassifierFragment.java?rev=1305624&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/TopicClassifierFragment.java
 (added)
+++ 
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/fragment/TopicClassifierFragment.java
 Mon Mar 26 21:55:53 2012
@@ -0,0 +1,107 @@
+/*
+ * 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.stanbol.enhancer.web.topic.fragment;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.commons.web.base.LinkResource;
+import org.apache.stanbol.commons.web.base.NavigationLink;
+import org.apache.stanbol.commons.web.base.ScriptResource;
+import org.apache.stanbol.commons.web.base.WebFragment;
+import 
org.apache.stanbol.enhancer.web.topic.resource.TopicClassifierRootResource;
+import org.apache.stanbol.enhancer.web.topic.resource.TopicModelResource;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+
+import freemarker.cache.ClassTemplateLoader;
+import freemarker.cache.TemplateLoader;
+
+@Component(immediate = true, metatype = true)
+@Service
+public class TopicClassifierFragment implements WebFragment {
+
+    public static final String NAME = "topic";
+
+    public static final String STATIC_RESOURCE_PATH = 
"/org/apache/stanbol/enhancer/web/topic/static";
+
+    public static final String TEMPLATE_PATH = 
"/org/apache/stanbol/enhancer/web/topic/templates";
+
+    protected BundleContext bundleContext;
+
+    @Override
+    public String getName() {
+        return NAME;
+    }
+
+    @Override
+    public String getStaticResourceClassPath() {
+        return STATIC_RESOURCE_PATH;
+    }
+
+    @Override
+    public Set<Class<?>> getJaxrsResourceClasses() {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        classes.add(TopicClassifierRootResource.class);
+        classes.add(TopicModelResource.class);
+        return classes;
+    }
+
+    @Override
+    public Set<Object> getJaxrsResourceSingletons() {
+        return Collections.emptySet();
+    }
+
+    @Override
+    public TemplateLoader getTemplateLoader() {
+        return new ClassTemplateLoader(getClass(), TEMPLATE_PATH);
+    }
+
+    @Override
+    public List<LinkResource> getLinkResources() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public List<ScriptResource> getScriptResources() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    public List<NavigationLink> getNavigationLinks() {
+        List<NavigationLink> navList = new ArrayList<NavigationLink>();
+        navList.add(new NavigationLink("topic", "/topic", null, 10));
+        return navList;
+    }
+
+    @Activate
+    protected void activate(ComponentContext ctx) {
+        this.bundleContext = ctx.getBundleContext();
+    }
+
+    @Override
+    public BundleContext getBundleContext() {
+        return this.bundleContext;
+    }
+
+}

Added: 
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource.java?rev=1305624&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource.java
 (added)
+++ 
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource.java
 Mon Mar 26 21:55:53 2012
@@ -0,0 +1,80 @@
+/*
+ * 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.stanbol.enhancer.web.topic.resource;
+
+import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
+import static org.apache.stanbol.commons.web.base.CorsHelper.enableCORS;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.OPTIONS;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+import org.apache.stanbol.commons.web.base.ContextHelper;
+import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
+import org.apache.stanbol.enhancer.topic.TopicClassifier;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.sun.jersey.api.view.Viewable;
+
+@Path("/topic")
+public class TopicClassifierRootResource extends BaseStanbolResource {
+
+    @SuppressWarnings("unused")
+    private static Logger log = 
LoggerFactory.getLogger(TopicClassifierRootResource.class);
+
+    @OPTIONS
+    public Response handleCorsPreflight(@Context HttpHeaders headers) {
+        ResponseBuilder res = Response.ok();
+        enableCORS(servletContext, res, headers);
+        return res.build();
+    }
+
+    @GET
+    @Produces(TEXT_HTML)
+    public Response get(@Context HttpHeaders headers) {
+        ResponseBuilder rb = Response.ok(new Viewable("index", this));
+        rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+        addCORSOrigin(servletContext, rb, headers);
+        return rb.build();
+    }
+
+    public List<TopicClassifier> getClassifiers() throws 
InvalidSyntaxException {
+        List<TopicClassifier> classifiers = new ArrayList<TopicClassifier>();
+        BundleContext bundleContext = 
ContextHelper.getBundleContext(servletContext);
+        ServiceReference[] references = 
bundleContext.getServiceReferences(TopicClassifier.class.getName(),
+            null);
+        if (references != null) {
+            for (ServiceReference ref : references) {
+                classifiers.add((((TopicClassifier) 
bundleContext.getService(ref))));
+            }
+        }
+        return classifiers;
+    }
+}

Added: 
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource.java?rev=1305624&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource.java
 (added)
+++ 
incubator/stanbol/trunk/enhancer/topic-web/src/main/java/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource.java
 Mon Mar 26 21:55:53 2012
@@ -0,0 +1,80 @@
+/*
+ * 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.stanbol.enhancer.web.topic.resource;
+
+import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response.ResponseBuilder;
+
+import org.apache.stanbol.commons.web.base.ContextHelper;
+import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
+import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine;
+import org.apache.stanbol.enhancer.topic.TopicClassifier;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+import com.sun.jersey.api.view.Viewable;
+
+/**
+ * RESTful interface for classification models: register concept hierarchies, 
introspect model state and
+ * trigger training if a training set is provided.
+ * 
+ */
+@Path("/topic/model/{classifier}")
+public final class TopicModelResource extends BaseStanbolResource {
+
+    final TopicClassifier classifier;
+
+    public TopicModelResource(@PathParam(value = "classifier") String 
classifierName,
+                              @Context ServletContext servletContext,
+                              @Context UriInfo uriInfo) throws 
InvalidSyntaxException {
+        this.servletContext = servletContext;
+        this.uriInfo = uriInfo;
+        BundleContext bundleContext = 
ContextHelper.getBundleContext(servletContext);
+        ServiceReference[] references = 
bundleContext.getServiceReferences(TopicClassifier.class.getName(),
+            String.format("(%s=%s)", EnhancementEngine.PROPERTY_NAME, 
classifierName));
+        if (references == null || references.length == 0) {
+            throw new WebApplicationException(Response.Status.NOT_FOUND);
+        }
+        classifier = (TopicClassifier) bundleContext.getService(references[0]);
+    }
+
+    @GET
+    @Produces(TEXT_HTML)
+    public Response get(@Context HttpHeaders headers) {
+        ResponseBuilder rb = Response.ok(new Viewable("index", this));
+        rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
+        addCORSOrigin(servletContext, rb, headers);
+        return rb.build();
+    }
+
+    public TopicClassifier getClassifier() {
+        return classifier;
+    }
+}

Added: 
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource/index.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource/index.ftl?rev=1305624&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource/index.ftl
 (added)
+++ 
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicClassifierRootResource/index.ftl
 Mon Mar 26 21:55:53 2012
@@ -0,0 +1,55 @@
+<#--
+  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 "/imports/common.ftl" as common>
+<#escape x as x?html>
+<@common.page title="Topic Classification" hasrestapi=false> 
+
+<div class="panel" id="webview">
+<p>Registered models and training datasets used by the Topic Classification
+Enhancement Engine.</p>
+
+<table>
+  <tr>
+    <th>Topic Model</th><th>Enhancement Chains</th><th>Training Set</th>
+  </tr>
+  <#list it.classifiers as classifier>
+    <tr>
+    <td>
+      <#assign name = classifier.name>
+      <a href="${it.publicBaseUri}topic/model/${name}">${name}</a>
+      (${classifier.class.simpleName})
+    </td>
+    <td>
+       <ul>
+         <#list classifier.chainNames as chainName>
+           <li><a 
href="${it.publicBaseUri}enhancer/chain/${chainName}">${chainName}</a></li>
+         </#list>
+       </ul>
+    </td>
+    <td>
+      <#if classifier.trainingSet?exists>
+        <#assign trainingSet = classifier.trainingSet>
+        <a 
href="${it.publicBaseUri}topic/trainingset/${trainingSet.name}">${trainingSet.name}</a>
+        (${trainingSet.class.simpleName})
+      </#if>
+    </td>
+    </tr>
+  </#list>
+</table>
+</div>
+</@common.page>
+</#escape>
\ No newline at end of file

Added: 
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource/index.ftl
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource/index.ftl?rev=1305624&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource/index.ftl
 (added)
+++ 
incubator/stanbol/trunk/enhancer/topic-web/src/main/resources/org/apache/stanbol/enhancer/web/topic/templates/org/apache/stanbol/enhancer/web/topic/resource/TopicModelResource/index.ftl
 Mon Mar 26 21:55:53 2012
@@ -0,0 +1,36 @@
+<#--
+  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 "/imports/common.ftl" as common>
+<#escape x as x?html>
+<@common.page title="Model state for classifier ${it.classifier.name}" 
hasrestapi=false> 
+
+<div class="panel" id="webview">
+
+<h3>Registered concepts</h3>
+<#if it.classifier.rootConcepts?exists && it.classifier.rootConcepts?size != 0>
+<ul>
+  <#list it.classifier.rootConcepts as rootConcept>
+    <li>${rootConcept}</li>
+  </#list>
+</ul>
+<#else>
+<em>There are no registered concepts in this model.</em>
+</#if>
+
+</div>
+</@common.page>
+</#escape>
\ No newline at end of file

Modified: incubator/stanbol/trunk/parent/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/parent/pom.xml?rev=1305624&r1=1305623&r2=1305624&view=diff
==============================================================================
--- incubator/stanbol/trunk/parent/pom.xml (original)
+++ incubator/stanbol/trunk/parent/pom.xml Mon Mar 26 21:55:53 2012
@@ -572,6 +572,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.stanbol</groupId>
+        <artifactId>org.apache.stanbol.enhancer.engine.topic</artifactId>
+        <version>0.9.0-incubating-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.stanbol</groupId>
         <artifactId>org.apache.stanbol.enhancer.jersey</artifactId>
         <version>0.9.0-incubating-SNAPSHOT</version>
       </dependency>

Modified: incubator/stanbol/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/pom.xml?rev=1305624&r1=1305623&r2=1305624&view=diff
==============================================================================
--- incubator/stanbol/trunk/pom.xml (original)
+++ incubator/stanbol/trunk/pom.xml Mon Mar 26 21:55:53 2012
@@ -74,8 +74,7 @@
     <module>contenthub</module>
     <module>entityhub</module>
     <module>factstore</module>
-       
-       <module>ontologymanager</module>
+    <module>ontologymanager</module>
     <module>rules</module>
     <module>reasoners</module>
   </modules>
@@ -98,6 +97,7 @@
         <module>demos/webvie</module>
 
         <module>enhancer/engines</module>
+        <module>enhancer/topic-web</module>
 
         <module>launchers/bundlelists/osgiframework</module>
         <module>launchers/bundlelists/stanbolcommons</module>
@@ -140,7 +140,7 @@
         <plugins>
           <plugin>
             <groupId>org.apache.rat</groupId>
-            <artifactId>apache-rat-plugin</artifactId>          
+            <artifactId>apache-rat-plugin</artifactId>
             <configuration>
               <excludeSubProjects>false</excludeSubProjects>
               <excludes>
@@ -211,9 +211,9 @@
               <execution>
                 <goals>
                   <goal>aggregate-add-third-party</goal>
-                </goals>               
+                </goals>
               </execution>
-            </executions>        
+            </executions>
           </plugin>
         </plugins>
       </build>
@@ -234,7 +234,7 @@
                   <goal>aggregate-add-third-party</goal>
                 </goals>
               </execution>
-            </executions>        
+            </executions>
           </plugin>
         </plugins>
       </build>
@@ -242,10 +242,10 @@
       <modules>
         
<module>releasing/framework/stanbol-framework-source-release-assembly-descriptor</module>
         
<module>releasing/stack/stanbol-stack-source-release-assembly-descriptor</module>
-      </modules>      
-    </profile>    
-    
-    <!-- One day the KReS profile will disappear -->    
+      </modules>
+    </profile>
+
+    <!-- One day the KReS profile will disappear -->
     <profile>
       <id>kres</id>
       <activation>


Reply via email to