You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stanbol.apache.org by Fabian Christ <ch...@googlemail.com> on 2011/07/08 10:02:53 UTC
Re: svn commit: r1143692 [1/10] - in /incubator/stanbol/trunk/commons/web/webvie:
./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/stanbol/ src/main/java/org/apache/stanbol/enhancer/ src/main/java
Hi Szaby,
thank you for this contribution but could you please write a few lines
to the list what this is about?
And please open JIRA issues for such things where you describe the
task that you are working on - this makes it easier for others to
follow what happens. Then mention the STANBOL-XXX issue identifier in
the commit message and the commit is automatically related to the
issue in JIRA.
https://issues.apache.org/jira/browse/STANBOL
Best,
- Fabian
2011/7/7 <sz...@apache.org>:
> Author: szabyg
> Date: Thu Jul 7 07:38:24 2011
> New Revision: 1143692
>
> URL: http://svn.apache.org/viewvc?rev=1143692&view=rev
> Log:
> First version of the webvie user interface, based on hallo.coffee editor and the annotate.coffee widget.
> See also https://github.com/szabyg/stanbol-webvie
>
> Added:
> incubator/stanbol/trunk/commons/web/webvie/
> incubator/stanbol/trunk/commons/web/webvie/.svnignore
> incubator/stanbol/trunk/commons/web/webvie/README.md
> incubator/stanbol/trunk/commons/web/webvie/pom.xml
> incubator/stanbol/trunk/commons/web/webvie/src/
> incubator/stanbol/trunk/commons/web/webvie/src/main/
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery-ui-1.8.7.custom.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery.ui.menu.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_75_ffffff_40x100.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_65_ffffff_1x400.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_dadada_1x400.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_95_fef1ec_1x400.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_222222_256x240.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_2e83ff_256x240.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_454545_256x240.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_888888_256x240.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_cd0a0a_256x240.png (with props)
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery-ui-1.8.13.custom.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.accordion.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.all.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.autocomplete.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.base.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.button.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.core.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.datepicker.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.dialog.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.progressbar.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.resizable.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.selectable.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.slider.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.tabs.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.theme.css
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone-min.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/format.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/hallo.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-1.5.1.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-ui.1.9m5.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.debug.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.min.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/underscore-min.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-collectionmanager.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-containermanager.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/dbpedia.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/opencalais.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/rdfa.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/semantictweet.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/stanbol.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/zemanta.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/organization.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/person.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/place.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/task.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/thing.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/vie2-latest.debug.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/test.js
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/enhancervieDescription.ftl
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/index.ftl
> incubator/stanbol/trunk/commons/web/webvie/src/test/
> incubator/stanbol/trunk/commons/web/webvie/src/test/java/
> incubator/stanbol/trunk/commons/web/webvie/src/test/resources/
>
> Added: incubator/stanbol/trunk/commons/web/webvie/.svnignore
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/.svnignore?rev=1143692&view=auto
> ==============================================================================
> --- incubator/stanbol/trunk/commons/web/webvie/.svnignore (added)
> +++ incubator/stanbol/trunk/commons/web/webvie/.svnignore Thu Jul 7 07:38:24 2011
> @@ -0,0 +1,2 @@
> +*.sh
> +sc
>
> Added: incubator/stanbol/trunk/commons/web/webvie/README.md
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/README.md?rev=1143692&view=auto
> ==============================================================================
> --- incubator/stanbol/trunk/commons/web/webvie/README.md (added)
> +++ incubator/stanbol/trunk/commons/web/webvie/README.md Thu Jul 7 07:38:24 2011
> @@ -0,0 +1,62 @@
> +VIE based Stanbol Enhancer UI
> +=============================
> +
> +Adapter to add a VIE based interface for the Stanbol Enhancer
> +
> +Deploy
> +------
> +
> +After building stanbol in a different folder you can build and deploy this bundle by using the following command:
> +
> + mvn install -DskipTests -PinstallBundle -Dsling.url=http://localhost:8080/system/console
> +
> +Development Guide
> +=================
> +
> +The widget development is done in CoffeeScript. Use the following command to
> +automatically compile the script in the background
> +
> + coffee -c -w -o lib annotate.coffee
> +
> +This will as well show you compile errors right after each save.
> +
> +To simplify work with the deep directory structure I created a directory for
> +shortcuts to the most important directories called 'sc':
> +
> + ls -ln sc/
> + lrwxrwxrwx 1 1000 1000 52 2011-06-01 11:44 java -> ../src/main/java/org/apache/stanbol/enhancer/webvie/
> + lrwxrwxrwx 1 1000 1000 63 2011-06-01 11:43 static -> ../src/main/resources/org/apache/stanbol/enhancer/webvie/static
> + lrwxrwxrwx 1 1000 1000 135 2011-06-01 11:44 template -> ../src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
> +
> +Annotate widget API
> +===================
> +Options:
> +--------
> +
> +Methods:
> +--------
> +**enable**:
> + Analyze text and highlight TextAnnotations. Make TextAnnotations
> + interactive.
> +
> +**disable**:
> + Remove TextAnnotation highlighting.
> +
> +Events
> +------
> +**select**:
> + Triggered on annotating a suggested TextEnhancement
> +
> +**decline**:
> + Triggered on declining a suggested TextEnhancement
> +
> +**remove**:
> + Triggered when an annotation is removed
> +
> + function (event, ui)
> +
> + The ui object has the following attributes:
> + `textEnhancement`,
> + `entityEnhancement`
> + `linkedEntity`
> +
>
> Added: incubator/stanbol/trunk/commons/web/webvie/pom.xml
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/pom.xml?rev=1143692&view=auto
> ==============================================================================
> --- incubator/stanbol/trunk/commons/web/webvie/pom.xml (added)
> +++ incubator/stanbol/trunk/commons/web/webvie/pom.xml Thu Jul 7 07:38:24 2011
> @@ -0,0 +1,135 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<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>stanbol-parent</artifactId>
> + <version>0.9-SNAPSHOT</version>
> + <relativePath>../../parent/pom.xml</relativePath>
> + </parent>
> + <artifactId>org.apache.stanbol.enhancer.webvie</artifactId>
> + <packaging>bundle</packaging>
> +
> + <name>Editable Entity based Enhancer UI</name>
> + <description>VIE based user interface for Stanbol
> + </description>
> +
> + <build>
> + <!-- make it an OSGi bundle -->
> + <plugins>
> + <plugin>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>maven-scr-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.webvie.*
> + </Export-Package>
> + <Import-Package>*</Import-Package>
> + </instructions>
> + </configuration>
> + </plugin>
> + </plugins>
> + </build>
> +
> + <dependencies>
> +
> + <!-- dependencies on other IKS modules -->
> + <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.standalone</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.stanbol</groupId>
> + <artifactId>org.apache.stanbol.commons.web.base</artifactId>
> + </dependency>
> +
> + <!-- needed for the ContentItem resource -->
> + <dependency>
> + <groupId>org.apache.stanbol</groupId>
> + <artifactId>org.apache.stanbol.enhancer.jersey</artifactId>
> + </dependency>
> + <!-- Clerezza dependencies -->
> + <dependency>
> + <groupId>org.apache.clerezza</groupId>
> + <artifactId>org.apache.clerezza.rdf.core</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>
> + <dependency>
> + <groupId>javax.servlet</groupId>
> + <artifactId>servlet-api</artifactId>
> + </dependency>
> +
> + <dependency>
> + <groupId>org.freemarker</groupId>
> + <artifactId>freemarker</artifactId>
> + </dependency>
> + <!-- indirect dependency for freemarker -->
> + <dependency>
> + <groupId>org.codehaus.jettison</groupId>
> + <artifactId>jettison</artifactId>
> + </dependency>
> +
> + <!-- generic tax -->
> + <dependency>
> + <groupId>org.slf4j</groupId>
> + <artifactId>slf4j-api</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>commons-io</groupId>
> + <artifactId>commons-io</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>commons-lang</groupId>
> + <artifactId>commons-lang</artifactId>
> + </dependency>
> +
> + <!-- OSGi tax -->
> + <dependency>
> + <groupId>org.osgi</groupId>
> + <artifactId>org.osgi.core</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>org.osgi</groupId>
> + <artifactId>org.osgi.compendium</artifactId>
> + </dependency>
> + <dependency>
> + <groupId>org.apache.felix</groupId>
> + <artifactId>org.apache.felix.scr.annotations</artifactId>
> + </dependency>
> +
> + <!-- for tests -->
> + <dependency>
> + <groupId>junit</groupId>
> + <artifactId>junit</artifactId>
> + <scope>test</scope>
> + </dependency>
> + <dependency>
> + <groupId>org.slf4j</groupId>
> + <artifactId>slf4j-simple</artifactId>
> + <scope>test</scope>
> + </dependency>
> +
> + </dependencies>
> +
> +</project>
>
> Added: incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java?rev=1143692&view=auto
> ==============================================================================
> --- incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java (added)
> +++ incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java Thu Jul 7 07:38:24 2011
> @@ -0,0 +1,132 @@
> +package org.apache.stanbol.enhancer.webvie.fragment;
> +
> +import java.util.ArrayList;
> +import java.util.Collections;
> +import java.util.HashSet;
> +import java.util.List;
> +import java.util.Set;
> +
> +import org.apache.clerezza.rdf.core.access.TcManager;
> +import org.apache.clerezza.rdf.core.serializedform.Serializer;
> +import org.apache.felix.scr.annotations.Activate;
> +import org.apache.felix.scr.annotations.Component;
> +import org.apache.felix.scr.annotations.Reference;
> +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.servicesapi.EnhancementJobManager;
> +import org.apache.stanbol.enhancer.servicesapi.Store;
> +import org.apache.stanbol.enhancer.webvie.resource.EnhancerVieRootResource;
> +import org.osgi.framework.BundleContext;
> +import org.osgi.service.component.ComponentContext;
> +
> +import freemarker.cache.ClassTemplateLoader;
> +import freemarker.cache.TemplateLoader;
> +
> +/**
> + * Statically define the list of available resources and providers to be contributed to the the Stanbol JAX-RS
> + * Endpoint.
> + */
> +@Component(immediate = true, metatype = true)
> +@Service
> +public class EnhancerVieWebFragment implements WebFragment {
> +
> + private static final String NAME = "enhancervie";
> +
> + private static final String STATIC_RESOURCE_PATH = "/org/apache/stanbol/enhancer/webvie/static";
> +
> + private static final String TEMPLATE_PATH = "/org/apache/stanbol/enhancer/webvie/templates";
> +
> + private BundleContext bundleContext;
> +
> + @Reference
> + TcManager tcManager;
> +
> + @Reference
> + Store store;
> +
> + @Reference
> + EnhancementJobManager jobManager;
> +
> + @Reference
> + Serializer serializer;
> +
> + @Override
> + public String getName() {
> + return NAME;
> + }
> +
> + @Activate
> + protected void activate(ComponentContext ctx) {
> + this.bundleContext = ctx.getBundleContext();
> + }
> +
> + @Override
> + public Set<Class<?>> getJaxrsResourceClasses() {
> + Set<Class<?>> classes = new HashSet<Class<?>>();
> + classes.add(EnhancerVieRootResource.class);
> + return classes;
> + }
> +
> + @Override
> + public Set<Object> getJaxrsResourceSingletons() {
> + return Collections.emptySet();
> + }
> +
> + @Override
> + public String getStaticResourceClassPath() {
> + return STATIC_RESOURCE_PATH;
> + }
> +
> + @Override
> + public TemplateLoader getTemplateLoader() {
> + return new ClassTemplateLoader(getClass(), TEMPLATE_PATH);
> + }
> +
> + @Override
> + public List<LinkResource> getLinkResources() {
> + List<LinkResource> resources = new ArrayList<LinkResource>();
> +// resources.add(new LinkResource("stylesheet", "lib/Aristo/jquery-ui-1.8.7.custom.css", this, 10));
> + resources.add(new LinkResource("stylesheet", "lib/Smoothness/jquery.ui.all.css", this, 10)); // version 1.8.13
> +// resources.add(new LinkResource("stylesheet", "lib/Aristo/jquery.ui.menu.css", this, 10));
> + return resources;
> + }
> +
> + @Override
> + public List<ScriptResource> getScriptResources() {
> + List<ScriptResource> resources = new ArrayList<ScriptResource>();
> + resources.add(new ScriptResource("text/javascript", "lib/jquery-1.5.1.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/jquery-ui.1.9m5.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/underscore-min.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/backbone.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/vie.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/vie-containermanager.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/vie-collectionmanager.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/hallo/hallo.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/hallo/format.js", this, 10));
> +
> + resources.add(new ScriptResource("text/javascript", "lib/jquery.rdfquery.debug.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/vie2/vie2-latest.debug.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/vie2/connector/stanbol.js", this, 10));
> + resources.add(new ScriptResource("text/javascript", "lib/vie2/mapping/person.js", this, 10));
> +
> + resources.add(new ScriptResource("text/javascript", "lib/annotate.js", this, 10));
> +
> + return resources;
> + }
> +
> + @Override
> + public List<NavigationLink> getNavigationLinks() {
> + List<NavigationLink> links = new ArrayList<NavigationLink>();
> + links.add(new NavigationLink("enhancervie", "/enhancer VIE", "/imports/enhancervieDescription.ftl", 20));
> + return links;
> + }
> +
> + @Override
> + public BundleContext getBundleContext() {
> + return bundleContext;
> + }
> +
> +}
>
> Added: incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java?rev=1143692&view=auto
> ==============================================================================
> --- incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java (added)
> +++ incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java Thu Jul 7 07:38:24 2011
> @@ -0,0 +1,27 @@
> +package org.apache.stanbol.enhancer.webvie.resource;
> +
> +import static javax.ws.rs.core.MediaType.TEXT_HTML;
> +
> +import javax.ws.rs.GET;
> +import javax.ws.rs.Path;
> +import javax.ws.rs.Produces;
> +
> +import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
> +
> +import com.sun.jersey.api.view.Viewable;
> +
> +/**
> + * Adapter to add a VIE based interface for the Stanbol Enhancer
> + * @author Szaby Gruenwald
> + */
> +@Path("/enhancervie")
> +public class EnhancerVieRootResource extends BaseStanbolResource {
> +
> +
> + @GET
> + @Produces(TEXT_HTML + ";qs=2")
> + public Viewable getView() {
> + return new Viewable("index", this);
> + }
> +
> +}
>
> Added: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee?rev=1143692&view=auto
> ==============================================================================
> --- incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee (added)
> +++ incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee Thu Jul 7 07:38:24 2011
> @@ -0,0 +1,677 @@
> +# Annotate - a text enhancement interaction jQuery UI widget
> +# (c) 2011 Szaby Gruenwald, IKS Consortium
> +# Annotate may be freely distributed under the MIT license
> +
> +((jQuery) ->
> + # The annotate.js widget
> + #
> +
> + # define namespaces
> + ns =
> + rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
> + enhancer: 'http://fise.iks-project.eu/ontology/'
> + dc: 'http://purl.org/dc/terms/'
> + rdfs: 'http://www.w3.org/2000/01/rdf-schema#'
> +
> + ANTT = ANTT or {}
> + Stanbol = Stanbol or {}
> +
> + # filter for TextAnnotations
> + Stanbol.getTextAnnotations = (enhRdf) ->
> + res = _(enhRdf).map((obj, key) ->
> + obj.id = key
> + obj
> + )
> + .filter (e) ->
> + e["#{ns.rdf}type"]
> + .map((x) -> x.value)
> + .indexOf("#{ns.enhancer}TextAnnotation") != -1
> + res = _(res).sortBy (e) ->
> + conf = Number e["#{ns.enhancer}confidence"][0].value if e["#{ns.enhancer}confidence"]
> + -1 * conf
> +
> + _(res).map (s)->
> + new Stanbol.TextEnhancement s, enhRdf
> +
> + # filter the entityManager for TextAnnotations
> + Stanbol.getEntityAnnotations = (enhRdf) ->
> + _(enhRdf)
> + .map((obj, key) ->
> + obj.id = key
> + obj
> + )
> + .filter (e) ->
> + e["#{ns.rdf}type"]
> + .map((x) -> x.value)
> + .indexOf("#{ns.enhancer}EntityAnnotation") != -1
> +
> + # Get the label in the user's language or the first one from a VIE entity
> + ANTT.getRightLabel = (entity) ->
> + labelMap = {}
> + for label in _(entity["#{ns.rdfs}label"]).flatten()
> + cleanLabel = label.value
> + if cleanLabel.lastIndexOf "@" is cleanLabel.length - 3
> + cleanLabel = cleanLabel.substring 0, cleanLabel.length - 3
> + labelMap[label["xml:lang"]|| "_"] = cleanLabel
> + userLang = window.navigator.language.split("-")[0]
> + # Return the first best label
> + labelMap[userLang] or labelMap["_"] or labelMap["en"]
> +
> + # Generic API for a TextEnhancement
> + # A TextEnhancement object has the methods for getting generic
> + # text-enhancement-specific properties.
> + # TODO Place it into a global Stanbol object.
> + Stanbol.TextEnhancement = (enhancement, enhRdf) ->
> + @_enhancement = enhancement
> + @_enhRdf = enhRdf
> + @id = @_enhancement.id
> + Stanbol.TextEnhancement.prototype =
> + # the text the annotation is for
> + getSelectedText: ->
> + @_vals("#{ns.enhancer}selected-text")[0]
> + # confidence value
> + getConfidence: ->
> + @_vals("#{ns.enhancer}confidence")[0]
> + # get Entities suggested for the text enhancement (if any)
> + getEntityEnhancements: ->
> + rawList = _(Stanbol.getEntityAnnotations @_enhRdf ).filter (ann) =>
> + relations = _(ann["#{ns.dc}relation"])
> + .map (e) -> e.value
> + if (relations.indexOf @_enhancement.id) isnt -1 then true
> + else false
> + _(rawList).map (ee) =>
> + new Stanbol.EntityEnhancement ee, @
> + # The type of the entity suggested (e.g. person, location, organization)
> + getType: ->
> + @_vals("#{ns.dc}type")[0]
> + # Optional, not used
> + getContext: ->
> + @_vals("#{ns.enhancer}selection-context")[0]
> + # start position in the original text
> + getStart: ->
> + Number @_vals("#{ns.enhancer}start")[0]
> + # end position in the original text
> + getEnd: ->
> + Number @_vals("#{ns.enhancer}end")[0]
> + # Optional
> + getOrigText: ->
> + ciUri = @_vals("#{ns.enhancer}extracted-from")[0]
> + @_enhRdf[ciUri]["http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent"][0].value
> + _vals: (key) ->
> + _(@_enhancement[key])
> + .map (x) -> x.value
> +
> + # Generic API for an EntityEnhancement. This is the implementation for Stanbol
> + Stanbol.EntityEnhancement = (ee, textEnh) ->
> + @_textEnhancement = textEnh
> + $.extend @, ee
> + Stanbol.EntityEnhancement.prototype =
> + getLabel: ->
> + @_vals("#{ns.enhancer}entity-label")[0]
> + getUri: ->
> + @_vals("#{ns.enhancer}entity-reference")[0]
> + getTextEnhancement: ->
> + @_textEnhancement
> + getTypes: ->
> + @_vals("#{ns.enhancer}entity-type")
> + getConfidence: ->
> + Number @_vals("#{ns.enhancer}confidence")[0]
> + _vals: (key) ->
> + _(@[key]).map (x) -> x.value
> +
> + # get or create a dom element containing only the occurrence of the found entity
> + ANTT.getOrCreateDomElement = (element, text, options = {}) ->
> + # Find occurrence indexes of s in str
> + occurrences = (str, s) ->
> + res = []
> + last = 0
> + while str.indexOf(s, last + 1) isnt -1
> + next = str.indexOf s, last+1
> + res.push next
> + last = next
> +
> + # Find the nearest number among the
> + nearest = (arr, nr) ->
> + _(arr).sortedIndex nr
> +
> + # Nearest position
> + nearestPosition = (str, s, ind) ->
> + arr = occurrences(str,s)
> + i1 = nearest arr, ind
> + if arr.length is 1
> + arr[0]
> + else if i1 is arr.length
> + arr[i1-1]
> + else
> + i0 = i1-1
> + d0 = ind - arr[i0]
> + d1 = arr[i1] - ind
> + if d1 > d0 then arr[i0]
> + else arr[i1]
> +
> + domEl = element
> + textContentOf = (element) -> $(element).text().replace(/\n/g, " ")
> + # find the text node
> + if textContentOf(element).indexOf(text) is -1
> + throw "'#{text}' doesn't appear in the text block."
> + return $()
> + start = options.start +
> + textContentOf(element).indexOf textContentOf(element).trim()
> + # Correct small position errors
> + start = nearestPosition textContentOf(element), text, start
> + pos = 0
> + while textContentOf(domEl).indexOf(text) isnt -1 and domEl.nodeName isnt '#text'
> + domEl = _(domEl.childNodes).detect (el) ->
> + p = textContentOf(el).lastIndexOf text
> + if p >= start - pos
> + true
> + else
> + pos += textContentOf(el).length
> + false
> +
> + if options.createMode is "existing" and textContentOf($(domEl).parent()) is text
> + return $(domEl).parent()[0]
> + else
> + pos = start - pos
> + len = text.length
> + textToCut = textContentOf(domEl).substring(pos, pos+len)
> + if textToCut is text
> + domEl.splitText pos + len
> + newElement = document.createElement options.createElement or 'span'
> + newElement.innerHTML = text
> + $(domEl).parent()[0].replaceChild newElement, domEl.splitText pos
> + $ newElement
> + else
> + console.warn "dom element creation problem: #{textToCut} isnt #{text}"
> +
> + # Give back the last part of a uri for fallback label creation
> + ANTT.uriSuffix = (uri) ->
> + res = uri.substring uri.lastIndexOf("#") + 1
> + res.substring res.lastIndexOf("/") + 1
> +
> + # jquery events cloning method
> + ANTT.cloneCopyEvent = (src, dest) ->
> + if dest.nodeType isnt 1 or not jQuery.hasData src
> + return
> +
> + internalKey = $.expando
> + oldData = $.data src
> + curData = $.data dest, oldData
> +
> + # Switch to use the internal data object, if it exists, for the next
> + # stage of data copying
> + if oldData = oldData[internalKey]
> + events = oldData.events
> + curData = curData[ internalKey ] = jQuery.extend({}, oldData);
> +
> + if events
> + delete curData.handle
> + curData.events = {}
> +
> + `for ( var type in events ) {
> + for ( var i = 0, l = events[ type ].length; i < l; i++ ) {
> + jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
> + }
> + }`
> + null
> +
> + ######################################################
> + # Annotate widget
> + # makes a content dom element interactively annotatable
> + ######################################################
> + jQuery.widget 'IKS.annotate',
> + __widgetName: "IKS.annotate"
> + options:
> + autoAnalyze: false
> + debug: false
> + # namespaces necessary for the widget configuration
> + ns:
> + dbpedia: "http://dbpedia.org/ontology/"
> + skos: "http://www.w3.org/2004/02/skos/core#"
> + # Give a label to your expected enhancement types
> + getTypes: ->
> + [
> + uri: "#{@ns.dbpedia}Place"
> + label: 'Place'
> + ,
> + uri: "#{@ns.dbpedia}Person"
> + label: 'Person'
> + ,
> + uri: "#{@ns.dbpedia}Organisation"
> + label: 'Organisation'
> + ,
> + uri: "#{@ns.skos}Concept"
> + label: 'Concept'
> + ]
> + # Give a label to the sources the entities come from
> + getSources: ->
> + [
> + uri: "http://dbpedia.org/resource/"
> + label: "dbpedia"
> + ,
> + uri: "http://sws.geonames.org/"
> + label: "geonames"
> + ]
> + _create: ->
> + widget = @
> + # logger can be turned on and off. It will show the real caller line in the log
> + @_logger = if @options.debug then console else
> + info: ->
> + warn: ->
> + error: ->
> + # widget.entityCache.get(uri, cb) will get and cache the entity from an entityhub
> + @entityCache = window.entityCache =
> + _entities: {}
> + # calling the get with a scope and callback will call cb(entity) with the scope as soon it's available.'
> + get: (uri, scope, cb) ->
> + # If entity is stored in the cache already just call cb
> + if @_entities[uri] and @_entities[uri].status is "done"
> + cb.apply scope, [@_entities[uri].entity]
> + # If the entity is new to the cache
> + else if not @_entities[uri]
> + # create cache entry
> + @_entities[uri] =
> + status: "pending"
> + uri: uri
> + cache = @
> + # make a request to the entity hub
> + widget.options.connector.queryEntityHub uri, (entity) ->
> + if not entity.status
> + if entity.id isnt uri
> + widget._logger.warn "wrong callback", uri, entity.id
> + cache._entities[uri].entity = entity
> + cache._entities[uri].status = "done"
> + $(cache._entities[uri]).trigger "done", entity
> + else
> + widget._logger.warn "error getting entity", uri, entity
> + if @_entities[uri] and @_entities[uri].status is "pending"
> + $( @_entities[uri] )
> + .bind "done", (event, entity) ->
> + cb.apply scope, [entity]
> + if @options.autoAnalyze
> + @enable()
> +
> + # analyze the widget element and show text enhancements
> + enable: (cb) ->
> + analyzedNode = @element
> + # the analyzedDocUri makes the connection between a document state and
> + # the annotations to it. We have to clean up the annotations to any
> + # old document state
> +
> + @options.connector.analyze @element,
> + success: (rdf) =>
> + # Get enhancements
> + rdfJson = rdf.databank.dump()
> +
> + textAnnotations = Stanbol.getTextAnnotations(rdfJson)
> + # Remove all textAnnotations without a selected text property
> + textAnnotations = _(textAnnotations)
> + .filter (textEnh) ->
> + if textEnh.getSelectedText and textEnh.getSelectedText()
> + true
> + else
> + false
> + _(textAnnotations)
> + .each (s) =>
> + @_logger.info s._enhancement,
> + 'confidence', s.getConfidence(),
> + 'selectedText', s.getSelectedText(),
> + 'type', s.getType(),
> + 'EntityEnhancements', s.getEntityEnhancements()
> + # Process the text enhancements
> + @processTextEnhancement s, analyzedNode
> + # trigger 'done' event with success = true
> + @_trigger "done", true
> + if typeof cb is "function"
> + cb(true)
> + # Remove all not accepted text enhancement widgets
> + disable: ->
> + $( ':IKS-annotationSelector', @element ).each () ->
> + $(@).annotationSelector 'disable'
> +
> + # processTextEnhancement deals with one TextEnhancement in an ancestor element of its occurrence
> + processTextEnhancement: (textEnh, parentEl) ->
> + if not textEnh.getSelectedText()
> + console.warn "textEnh", textEnh, "doesn't have selected-text!"
> + return
> + el = $ ANTT.getOrCreateDomElement parentEl[0], textEnh.getSelectedText(),
> + createElement: 'span'
> + createMode: 'existing'
> + context: textEnh.getContext()
> + start: textEnh.getStart()
> + end: textEnh.getEnd()
> + sType = textEnh.getType()
> + widget = @
> + el.addClass('entity')
> + .addClass ANTT.uriSuffix(sType).toLowerCase()
> + if textEnh.getEntityEnhancements().length
> + el.addClass "withSuggestions"
> + for eEnh in textEnh.getEntityEnhancements()
> + eEnhUri = eEnh.getUri()
> + @entityCache.get eEnhUri, eEnh, (entity) ->
> + if this.getUri() isnt entity.id
> + widget._logger.warn "wrong callback", entity.id, this.getUri()
> +# widget._logger.info "entity for", textEnh.getSelectedText(), this.getUri(), entity
> + # Create widget to select from the suggested entities
> + options =
> + cache: @entityCache
> + $.extend options, @options
> + el.annotationSelector( options )
> + .annotationSelector 'addTextEnhancement', textEnh
> +
> + ######################################################
> + # AnnotationSelector widget
> + # the annotationSelector makes an annotated word interactive
> + ######################################################
> + ANTT.annotationSelector =
> + jQuery.widget 'IKS.annotationSelector',
> + # just for debugging and understanding
> + __widgetName: "IKS.annotationSelector"
> + options:
> + ns:
> + dbpedia: "http://dbpedia.org/ontology/"
> + skos: "http://www.w3.org/2004/02/skos/core#"
> + getTypes: ->
> + [
> + uri: "#{@ns.dbpedia}Place"
> + label: 'Place'
> + ,
> + uri: "#{@ns.dbpedia}Person"
> + label: 'Person'
> + ,
> + uri: "#{@ns.dbpedia}Organisation"
> + label: 'Organisation'
> + ,
> + uri: "#{@ns.skos}Concept"
> + label: 'Concept'
> + ]
> + getSources: ->
> + [
> + uri: "http://dbpedia.org/resource/"
> + label: "dbpedia"
> + ,
> + uri: "http://sws.geonames.org/"
> + label: "geonames"
> + ]
> +
> + _create: ->
> + @element.click =>
> + if not @dialog
> + @_createDialog()
> + setTimeout((=> @dialog.open()), 220)
> + # Collect all EntityEnhancements for all the TextEnhancements
> + # on the selected node.
> + eEnhancements = []
> + for textEnh in @textEnhancements
> + for enhancement in textEnh.getEntityEnhancements()
> + eEnhancements.push enhancement
> + # filter enhancements with the same uri
> + # this is necessary because of a bug in stanbol that creates
> + # duplicate enhancements.
> + # https://issues.apache.org/jira/browse/STANBOL-228
> + _tempUris = []
> + eEnhancements = _(eEnhancements).filter (eEnh) ->
> + uri = eEnh.getUri()
> + if _tempUris.indexOf(uri) is -1
> + _tempUris.push uri
> + true
> + else
> + false
> + @entityEnhancements = eEnhancements
> +
> + @_createSearchbox()
> + if @entityEnhancements.length > 0
> + @_createMenu() if @menu is undefined
> + else @searchEntryField.find('.search').focus 100
> + @_logger = if @options.debug then console else
> + info: ->
> + warn: ->
> + error: ->
> + _destroy: ->
> + if @menu
> + @menu.destroy()
> + @menu.element.remove()
> + delete @menu
> + if @dialog
> + @dialog.destroy()
> + @dialog.element.remove()
> + @dialog.uiDialogTitlebar.remove()
> + delete @dialog
> +
> + # Produce type label list out of a uri list.
> + # Filtered by the @options.types list
> + _typeLabels: (types) ->
> + knownMapping = @options.getTypes()
> + allKnownPrefixes = _(knownMapping).map (x) -> x.uri
> + knownPrefixes = _.intersect allKnownPrefixes, types
> + _(knownPrefixes).map (key) =>
> + foundPrefix = _(knownMapping).detect (x) -> x.uri is key
> + foundPrefix.label
> +
> + # make a label for the entity source based on options.getSources()
> + _sourceLabel: (src) ->
> + sources = @options.getSources()
> + sourceObj = _(sources).detect (s) -> src.indexOf(s.uri) isnt -1
> + if sourceObj
> + sourceObj.label
> + else
> + src.split("/")[2]
> +
> + # create dialog widget
> + _createDialog: ->
> + label = @element.text()
> + dialogEl = $("<div><span class='entity-link'></span></div>")
> + .attr( "tabIndex", -1)
> + .addClass()
> + .keydown( (event) =>
> + if not event.isDefaultPrevented() and event.keyCode and event.keyCode is $.ui.keyCode.ESCAPE
> + @close event
> + event.preventDefault()
> + )
> + .bind('dialogblur', (event) =>
> + @_logger.info 'dialog dialogblur'
> + @close(event)
> + )
> + .bind('blur', (event) =>
> + @_logger.info 'dialog blur'
> + @close(event)
> + )
> + .appendTo( $("body")[0] )
> + widget = @
> + dialogEl.dialog
> + width: 400
> + title: label
> + close: (event, ui) =>
> + @close(event)
> + autoOpen: false
> + open: (e, ui) ->
> + $.data(this, 'dialog').uiDialog.position {
> + of: widget.element
> + my: "left top"
> + at: "left bottom"
> + collision: "none"}
> + @dialog = dialogEl.data 'dialog'
> + @dialog.uiDialogTitlebar.hide()
> + @_logger.info "dialog widget:", @dialog
> + @dialog.element.focus(100)
> + window.d = @dialog
> + @_insertLink()
> + @_updateTitle()
> + @_setButtons()
> +
> + # If annotation is already made insert a link to the entity
> + _insertLink: ->
> + if @isAnnotated() and @dialog
> + $("Annotated: <a href='#{@linkedEntity.uri}' target='_blank'>
> + #{@linkedEntity.label} @ #{@_sourceLabel(@linkedEntity.uri)}</a><br/>")
> + .appendTo $( '.entity-link', @dialog.element )
> + # create/update the dialog button row
> + _setButtons: ->
> + @dialog.element.dialog 'option', 'buttons',
> + rem:
> + text: if @isAnnotated() then 'Remove' else 'Decline'
> + click: (event) =>
> + @remove event
> + Cancel: =>
> + @close()
> +
> + # remove textEnhancement/annotation, replace the separate html
> + # element with the plain text and close the dialog
> + remove: (event) ->
> + el = @element.parent()
> + if not @isAnnotated() and @textEnhancements
> + @_trigger 'decline', event,
> + textEnhancements: @textEnhancements
> + else
> + @_trigger 'remove', event,
> + textEnhancement: @_acceptedTextEnhancement
> + entityEnhancement: @_acceptedEntityEnhancement
> + linkedEntity: @linkedEntity
> + @destroy()
> + if @element.qname().name isnt '#text'
> + @element.replaceWith document.createTextNode @element.text()
> +
> + # Remove the widget if not annotated.
> + disable: ->
> + if not @isAnnotated() and @element.qname().name isnt '#text'
> + @element.replaceWith document.createTextNode @element.text()
> +
> + # tells if this is an annotated dom element (not a highlighted textEnhancement only)
> + isAnnotated: ->
> + if @element.attr 'about' then true else false
> +
> + # Place the annotation on the DOM element (about and typeof attributes)
> + annotate: (entityEnhancement, styleClass) ->
> + entityUri = entityEnhancement.getUri()
> + entityType = entityEnhancement.getTextEnhancement().getType()
> + entityHtml = @element.html()
> + # We ignore the old style classes
> + # entityClass = @element.attr 'class'
> + sType = entityEnhancement.getTextEnhancement().getType()
> + entityClass = 'entity ' + ANTT.uriSuffix(sType).toLowerCase()
> + newElement = $ "<a href='#{entityUri}'
> + about='#{entityUri}'
> + typeof='#{entityType}'
> + class='#{entityClass}'>#{entityHtml}</a>"
> + ANTT.cloneCopyEvent @element[0], newElement[0]
> + @linkedEntity =
> + uri: entityUri
> + type: entityType
> + label: entityEnhancement.getLabel()
> + @element.replaceWith newElement
> + @element = newElement.addClass styleClass
> + @_logger.info "created annotation in", @element
> + @_updateTitle()
> + @_insertLink()
> + @_acceptedTextEnhancement = entityEnhancement.getTextEnhancement()
> + @_acceptedEntityEnhancement = entityEnhancement
> + @_trigger 'select', null,
> + linkedEntity: @linkedEntity
> + textEnhancement: entityEnhancement.getTextEnhancement()
> + entityEnhancement: entityEnhancement
> + # closing the widget
> + close: ->
> + @destroy()
> + _updateTitle: ->
> + if @dialog
> + if @isAnnotated()
> + title = "#{@linkedEntity.label} <small>@ #{@_sourceLabel(@linkedEntity.uri)}</small>"
> + else
> + title = @element.text()
> + @dialog._setOption 'title', title
> +
> + # create menu and add to the dialog
> + _createMenu: ->
> + ul = $('<ul></ul>')
> + .appendTo( @dialog.element )
> + @_renderMenu ul, @entityEnhancements
> + @menu = ul
> + .menu({
> + select: (event, ui) =>
> + @_logger.info "selected menu item", ui.item
> + @annotate ui.item.data('enhancement'), 'acknowledged'
> + @close(event)
> + blur: (event, ui) =>
> + @_logger.info 'menu.blur()', ui.item
> + focus: (event, ui) =>
> + @_logger.info 'menu.focus()', ui.item
> + # show preview
> + @_entityPreview ui.item
> + })
> + .bind('blur', (event, ui) ->
> + @_logger.info 'menu blur', ui
> + )
> + .bind('menublur', (event, ui) ->
> + @_logger.info 'menu menublur', ui.item
> + )
> + .focus(150)
> + .data 'menu'
> +
> + # Rendering menu for the EntityEnhancements suggested for the selected text
> + _renderMenu: (ul, entityEnhancements) ->
> + entityEnhancements = _(entityEnhancements).sortBy (ee) -> -1 * ee.getConfidence()
> + @_renderItem ul, enhancement for enhancement in entityEnhancements
> + @_logger.info 'rendered menu for the elements', entityEnhancements
> + _renderItem: (ul, eEnhancement) ->
> + label = eEnhancement.getLabel().replace /^\"|\"$/g, ""
> + type = @_typeLabels eEnhancement.getTypes()
> + source = @_sourceLabel eEnhancement.getUri()
> + active = if @linkedEntity and eEnhancement.getUri() is @linkedEntity.uri
> + " class='ui-state-active'"
> + else ""
> + $("<li#{active}><a href='#'>#{label} <small>(#{type} from #{source})</small></a></li>")
> + .data('enhancement', eEnhancement)
> + .appendTo ul
> +
> + # Render search box with autocompletion for finding the right entity
> + _createSearchbox: ->
> + # Show an input box for autocompleted search
> + @searchEntryField = $('<span style="background: fff;"><label for="search">Search:</label> <input id="search" class="search"></span>')
> + .appendTo @dialog.element
> + sugg = @textEnhancements[0]
> + widget = @
> + $( '.search', @searchEntryField )
> + .autocomplete
> + # Define source method. TODO make independent from stanbol.
> + source: (req, resp) ->
> + widget._logger.info "req:", req
> + widget.options.connector.findEntity "#{req.term}#{'*' if req.term.length > 3}", (entityList) ->
> + widget._logger.info "resp:", _(entityList).map (ent) ->
> + ent.id
> + res = for i, entity of entityList
> + {
> + key: entity.id
> + label: "#{ANTT.getRightLabel entity} @ #{widget._sourceLabel entity.id}"
> + _label: ANTT.getRightLabel entity
> + getLabel: -> @_label
> + getUri: -> @key
> + # To rethink: The type of the annotation (person, place, org)
> + # should come from the search result, not from the first textEnhancement
> + _tEnh: sugg
> + getTextEnhancement: -> @_tEnh
> + }
> + resp res
> + # An entity selected, annotate
> + select: (e, ui) =>
> + @annotate ui.item, "acknowledged"
> + @_logger.info "autocomplete.select", e.target, ui
> + focus: (e, ui) =>
> + @_logger.info "autocomplete.focus", e.target, ui
> + @_entityPreview ui.item
> + .focus(200)
> + .blur (e, ui) =>
> + @_dialogCloseTimeout = setTimeout ( => @close()), 200
> + @_logger.info "show searchbox"
> + # Show preview of a hovered item
> + _entityPreview: _.throttle(( (item) ->
> + @_logger.info "Show preview for", item
> + ), 1500)
> +
> + # add a textEnhancement that gets shown when the dialog is rendered
> + addTextEnhancement: (textEnh) ->
> + @options.textEnhancements = @options.textEnhancements or []
> + @options.textEnhancements.push textEnh
> + @textEnhancements = @options.textEnhancements
> +
> + window.ANTT = ANTT
> +) jQuery
>
> Added: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png?rev=1143692&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png?rev=1143692&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif?rev=1143692&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png?rev=1143692&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png?rev=1143692&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
> Added: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
> URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png?rev=1143692&view=auto
> ==============================================================================
> Binary file - no diff available.
>
> Propchange: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
> ------------------------------------------------------------------------------
> svn:mime-type = application/octet-stream
>
>
>
--
Fabian
Re: svn commit: r1143692 [1/10] - in /incubator/stanbol/trunk/commons/web/webvie:
./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/stanbol/ src/main/java/org/apache/stanbol/enhancer/ src/main/java
Posted by Rupert Westenthaler <ru...@gmail.com>.
On Sat, Jul 9, 2011 at 12:32 PM, florent andré
<fl...@4sengines.com> wrote:
>>
>> - Shows the enhancements directly in the text and in the dom.
>
> Can you please point out where you doing this ?
>
> I identify this [1], but as the commit is hudge I'm not really sure.
>
As far as I know this is the core file. However you might also want to
have a look onto the templete [2] and the WebFragment [3].
best
Rupert
>
> Thanks
>
> [1]
> commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
[2] http://svn.apache.org/repos/asf/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/index.ftl
[3] http://svn.apache.org/repos/asf/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
--
| Rupert Westenthaler rupert.westenthaler@gmail.com
| Bodenlehenstraße 11 ++43-699-11108907
| A-5500 Bischofshofen
Re: svn commit: r1143692 [1/10] - in /incubator/stanbol/trunk/commons/web/webvie:
./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/stanbol/ src/main/java/org/apache/stanbol/enhancer/
src/main/java
Posted by florent andré <fl...@4sengines.com>.
Hi,
On 07/08/2011 03:32 PM, Szabolcs Grünwald wrote:
> Right, I apologize..
>
> So let me describe shortly what I was working on and committed here.
>
> Similar to the web ui at<stanboluri>/engines, this bundle gives you an
> access to the enhancer engines with the following differences:
>
...
> - Shows the enhancements directly in the text and in the dom.
Can you please point out where you doing this ?
I identify this [1], but as the commit is hudge I'm not really sure.
Thanks
[1]
commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
++
> - It demonstrates that the text can be changed directly on the page for
> later storage
>
> For reaching this I implemented a jquery ui widget (annotate.coffee). This
> widget is meant to be independent from stanbol so after some further
> refactoring it will be possible to connect it to other enhancer-entityhub
> backends simply by implementing connectors and two classes, one for
> EntityEnancements, one for TextEnhancements.
>
> Dependencies of the annotate widget are
>
> - jquery 1.6+
> - jquery ui 1.9m5+ (using jquery-ui.menu.js which is not yet part of 1.8)
> - vie2.connectors.stanbol (I plan to refactor this to make the connector
> independent of vie2)
>
> I created following JIRA issue for this:
> https://issues.apache.org/jira/browse/STANBOL-256
>
> Peace,
> Szaby
>
> On 8 July 2011 10:02, Fabian Christ<ch...@googlemail.com> wrote:
>
>> Hi Szaby,
>>
>> thank you for this contribution but could you please write a few lines
>> to the list what this is about?
>>
>> And please open JIRA issues for such things where you describe the
>> task that you are working on - this makes it easier for others to
>> follow what happens. Then mention the STANBOL-XXX issue identifier in
>> the commit message and the commit is automatically related to the
>> issue in JIRA.
>>
>> https://issues.apache.org/jira/browse/STANBOL
>>
>> Best,
>> - Fabian
>>
>> 2011/7/7<sz...@apache.org>:
>>> Author: szabyg
>>> Date: Thu Jul 7 07:38:24 2011
>>> New Revision: 1143692
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1143692&view=rev
>>> Log:
>>> First version of the webvie user interface, based on hallo.coffee editor
>> and the annotate.coffee widget.
>>> See also https://github.com/szabyg/stanbol-webvie
>>>
>>> Added:
>>> incubator/stanbol/trunk/commons/web/webvie/
>>> incubator/stanbol/trunk/commons/web/webvie/.svnignore
>>> incubator/stanbol/trunk/commons/web/webvie/README.md
>>> incubator/stanbol/trunk/commons/web/webvie/pom.xml
>>> incubator/stanbol/trunk/commons/web/webvie/src/
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery-ui-1.8.7.custom.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery.ui.menu.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_75_ffffff_40x100.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_65_ffffff_1x400.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_dadada_1x400.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_222222_256x240.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_2e83ff_256x240.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_454545_256x240.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_888888_256x240.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_cd0a0a_256x240.png
>> (with props)
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery-ui-1.8.13.custom.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.accordion.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.all.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.autocomplete.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.base.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.button.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.core.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.datepicker.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.dialog.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.progressbar.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.resizable.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.selectable.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.slider.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.tabs.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.theme.css
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone-min.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/format.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/hallo.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-1.5.1.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-ui.1.9m5.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.debug.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.min.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/underscore-min.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-collectionmanager.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-containermanager.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/dbpedia.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/opencalais.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/rdfa.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/semantictweet.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/stanbol.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/zemanta.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/organization.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/person.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/place.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/task.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/thing.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/vie2-latest.debug.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/test.js
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/enhancervieDescription.ftl
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
>>>
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/index.ftl
>>> incubator/stanbol/trunk/commons/web/webvie/src/test/
>>> incubator/stanbol/trunk/commons/web/webvie/src/test/java/
>>> incubator/stanbol/trunk/commons/web/webvie/src/test/resources/
>>>
>>> Added: incubator/stanbol/trunk/commons/web/webvie/.svnignore
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/.svnignore?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> --- incubator/stanbol/trunk/commons/web/webvie/.svnignore (added)
>>> +++ incubator/stanbol/trunk/commons/web/webvie/.svnignore Thu Jul 7
>> 07:38:24 2011
>>> @@ -0,0 +1,2 @@
>>> +*.sh
>>> +sc
>>>
>>> Added: incubator/stanbol/trunk/commons/web/webvie/README.md
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/README.md?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> --- incubator/stanbol/trunk/commons/web/webvie/README.md (added)
>>> +++ incubator/stanbol/trunk/commons/web/webvie/README.md Thu Jul 7
>> 07:38:24 2011
>>> @@ -0,0 +1,62 @@
>>> +VIE based Stanbol Enhancer UI
>>> +=============================
>>> +
>>> +Adapter to add a VIE based interface for the Stanbol Enhancer
>>> +
>>> +Deploy
>>> +------
>>> +
>>> +After building stanbol in a different folder you can build and deploy
>> this bundle by using the following command:
>>> +
>>> + mvn install -DskipTests -PinstallBundle -Dsling.url=
>> http://localhost:8080/system/console
>>> +
>>> +Development Guide
>>> +=================
>>> +
>>> +The widget development is done in CoffeeScript. Use the following
>> command to
>>> +automatically compile the script in the background
>>> +
>>> + coffee -c -w -o lib annotate.coffee
>>> +
>>> +This will as well show you compile errors right after each save.
>>> +
>>> +To simplify work with the deep directory structure I created a directory
>> for
>>> +shortcuts to the most important directories called 'sc':
>>> +
>>> + ls -ln sc/
>>> + lrwxrwxrwx 1 1000 1000 52 2011-06-01 11:44 java ->
>> ../src/main/java/org/apache/stanbol/enhancer/webvie/
>>> + lrwxrwxrwx 1 1000 1000 63 2011-06-01 11:43 static ->
>> ../src/main/resources/org/apache/stanbol/enhancer/webvie/static
>>> + lrwxrwxrwx 1 1000 1000 135 2011-06-01 11:44 template ->
>> ../src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
>>> +
>>> +Annotate widget API
>>> +===================
>>> +Options:
>>> +--------
>>> +
>>> +Methods:
>>> +--------
>>> +**enable**:
>>> + Analyze text and highlight TextAnnotations. Make TextAnnotations
>>> + interactive.
>>> +
>>> +**disable**:
>>> + Remove TextAnnotation highlighting.
>>> +
>>> +Events
>>> +------
>>> +**select**:
>>> + Triggered on annotating a suggested TextEnhancement
>>> +
>>> +**decline**:
>>> + Triggered on declining a suggested TextEnhancement
>>> +
>>> +**remove**:
>>> + Triggered when an annotation is removed
>>> +
>>> + function (event, ui)
>>> +
>>> + The ui object has the following attributes:
>>> + `textEnhancement`,
>>> + `entityEnhancement`
>>> + `linkedEntity`
>>> +
>>>
>>> Added: incubator/stanbol/trunk/commons/web/webvie/pom.xml
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/pom.xml?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> --- incubator/stanbol/trunk/commons/web/webvie/pom.xml (added)
>>> +++ incubator/stanbol/trunk/commons/web/webvie/pom.xml Thu Jul 7
>> 07:38:24 2011
>>> @@ -0,0 +1,135 @@
>>> +<?xml version="1.0" encoding="UTF-8"?>
>>> +<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>stanbol-parent</artifactId>
>>> +<version>0.9-SNAPSHOT</version>
>>> +<relativePath>../../parent/pom.xml</relativePath>
>>> +</parent>
>>> +<artifactId>org.apache.stanbol.enhancer.webvie</artifactId>
>>> +<packaging>bundle</packaging>
>>> +
>>> +<name>Editable Entity based Enhancer UI</name>
>>> +<description>VIE based user interface for Stanbol
>>> +</description>
>>> +
>>> +<build>
>>> +<!-- make it an OSGi bundle -->
>>> +<plugins>
>>> +<plugin>
>>> +<groupId>org.apache.felix</groupId>
>>> +<artifactId>maven-scr-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.webvie.*
>>> +</Export-Package>
>>> +<Import-Package>*</Import-Package>
>>> +</instructions>
>>> +</configuration>
>>> +</plugin>
>>> +</plugins>
>>> +</build>
>>> +
>>> +<dependencies>
>>> +
>>> +<!-- dependencies on other IKS modules -->
>>> +<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.standalone</artifactId>
>>> +</dependency>
>>> +<dependency>
>>> +<groupId>org.apache.stanbol</groupId>
>>> +<artifactId>org.apache.stanbol.commons.web.base</artifactId>
>>> +</dependency>
>>> +
>>> +<!-- needed for the ContentItem resource -->
>>> +<dependency>
>>> +<groupId>org.apache.stanbol</groupId>
>>> +<artifactId>org.apache.stanbol.enhancer.jersey</artifactId>
>>> +</dependency>
>>> +<!-- Clerezza dependencies -->
>>> +<dependency>
>>> +<groupId>org.apache.clerezza</groupId>
>>> +<artifactId>org.apache.clerezza.rdf.core</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>
>>> +<dependency>
>>> +<groupId>javax.servlet</groupId>
>>> +<artifactId>servlet-api</artifactId>
>>> +</dependency>
>>> +
>>> +<dependency>
>>> +<groupId>org.freemarker</groupId>
>>> +<artifactId>freemarker</artifactId>
>>> +</dependency>
>>> +<!-- indirect dependency for freemarker -->
>>> +<dependency>
>>> +<groupId>org.codehaus.jettison</groupId>
>>> +<artifactId>jettison</artifactId>
>>> +</dependency>
>>> +
>>> +<!-- generic tax -->
>>> +<dependency>
>>> +<groupId>org.slf4j</groupId>
>>> +<artifactId>slf4j-api</artifactId>
>>> +</dependency>
>>> +<dependency>
>>> +<groupId>commons-io</groupId>
>>> +<artifactId>commons-io</artifactId>
>>> +</dependency>
>>> +<dependency>
>>> +<groupId>commons-lang</groupId>
>>> +<artifactId>commons-lang</artifactId>
>>> +</dependency>
>>> +
>>> +<!-- OSGi tax -->
>>> +<dependency>
>>> +<groupId>org.osgi</groupId>
>>> +<artifactId>org.osgi.core</artifactId>
>>> +</dependency>
>>> +<dependency>
>>> +<groupId>org.osgi</groupId>
>>> +<artifactId>org.osgi.compendium</artifactId>
>>> +</dependency>
>>> +<dependency>
>>> +<groupId>org.apache.felix</groupId>
>>> +<artifactId>org.apache.felix.scr.annotations</artifactId>
>>> +</dependency>
>>> +
>>> +<!-- for tests -->
>>> +<dependency>
>>> +<groupId>junit</groupId>
>>> +<artifactId>junit</artifactId>
>>> +<scope>test</scope>
>>> +</dependency>
>>> +<dependency>
>>> +<groupId>org.slf4j</groupId>
>>> +<artifactId>slf4j-simple</artifactId>
>>> +<scope>test</scope>
>>> +</dependency>
>>> +
>>> +</dependencies>
>>> +
>>> +</project>
>>>
>>> Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> ---
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>> (added)
>>> +++
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>> Thu Jul 7 07:38:24 2011
>>> @@ -0,0 +1,132 @@
>>> +package org.apache.stanbol.enhancer.webvie.fragment;
>>> +
>>> +import java.util.ArrayList;
>>> +import java.util.Collections;
>>> +import java.util.HashSet;
>>> +import java.util.List;
>>> +import java.util.Set;
>>> +
>>> +import org.apache.clerezza.rdf.core.access.TcManager;
>>> +import org.apache.clerezza.rdf.core.serializedform.Serializer;
>>> +import org.apache.felix.scr.annotations.Activate;
>>> +import org.apache.felix.scr.annotations.Component;
>>> +import org.apache.felix.scr.annotations.Reference;
>>> +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.servicesapi.EnhancementJobManager;
>>> +import org.apache.stanbol.enhancer.servicesapi.Store;
>>> +import
>> org.apache.stanbol.enhancer.webvie.resource.EnhancerVieRootResource;
>>> +import org.osgi.framework.BundleContext;
>>> +import org.osgi.service.component.ComponentContext;
>>> +
>>> +import freemarker.cache.ClassTemplateLoader;
>>> +import freemarker.cache.TemplateLoader;
>>> +
>>> +/**
>>> + * Statically define the list of available resources and providers to be
>> contributed to the the Stanbol JAX-RS
>>> + * Endpoint.
>>> + */
>>> +@Component(immediate = true, metatype = true)
>>> +@Service
>>> +public class EnhancerVieWebFragment implements WebFragment {
>>> +
>>> + private static final String NAME = "enhancervie";
>>> +
>>> + private static final String STATIC_RESOURCE_PATH =
>> "/org/apache/stanbol/enhancer/webvie/static";
>>> +
>>> + private static final String TEMPLATE_PATH =
>> "/org/apache/stanbol/enhancer/webvie/templates";
>>> +
>>> + private BundleContext bundleContext;
>>> +
>>> + @Reference
>>> + TcManager tcManager;
>>> +
>>> + @Reference
>>> + Store store;
>>> +
>>> + @Reference
>>> + EnhancementJobManager jobManager;
>>> +
>>> + @Reference
>>> + Serializer serializer;
>>> +
>>> + @Override
>>> + public String getName() {
>>> + return NAME;
>>> + }
>>> +
>>> + @Activate
>>> + protected void activate(ComponentContext ctx) {
>>> + this.bundleContext = ctx.getBundleContext();
>>> + }
>>> +
>>> + @Override
>>> + public Set<Class<?>> getJaxrsResourceClasses() {
>>> + Set<Class<?>> classes = new HashSet<Class<?>>();
>>> + classes.add(EnhancerVieRootResource.class);
>>> + return classes;
>>> + }
>>> +
>>> + @Override
>>> + public Set<Object> getJaxrsResourceSingletons() {
>>> + return Collections.emptySet();
>>> + }
>>> +
>>> + @Override
>>> + public String getStaticResourceClassPath() {
>>> + return STATIC_RESOURCE_PATH;
>>> + }
>>> +
>>> + @Override
>>> + public TemplateLoader getTemplateLoader() {
>>> + return new ClassTemplateLoader(getClass(), TEMPLATE_PATH);
>>> + }
>>> +
>>> + @Override
>>> + public List<LinkResource> getLinkResources() {
>>> + List<LinkResource> resources = new ArrayList<LinkResource>();
>>> +// resources.add(new LinkResource("stylesheet",
>> "lib/Aristo/jquery-ui-1.8.7.custom.css", this, 10));
>>> + resources.add(new LinkResource("stylesheet",
>> "lib/Smoothness/jquery.ui.all.css", this, 10)); // version 1.8.13
>>> +// resources.add(new LinkResource("stylesheet",
>> "lib/Aristo/jquery.ui.menu.css", this, 10));
>>> + return resources;
>>> + }
>>> +
>>> + @Override
>>> + public List<ScriptResource> getScriptResources() {
>>> + List<ScriptResource> resources = new
>> ArrayList<ScriptResource>();
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/jquery-1.5.1.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/jquery-ui.1.9m5.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/underscore-min.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/backbone.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/vie.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/vie-containermanager.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/vie-collectionmanager.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/hallo/hallo.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/hallo/format.js", this, 10));
>>> +
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/jquery.rdfquery.debug.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/vie2/vie2-latest.debug.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/vie2/connector/stanbol.js", this, 10));
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/vie2/mapping/person.js", this, 10));
>>> +
>>> + resources.add(new ScriptResource("text/javascript",
>> "lib/annotate.js", this, 10));
>>> +
>>> + return resources;
>>> + }
>>> +
>>> + @Override
>>> + public List<NavigationLink> getNavigationLinks() {
>>> + List<NavigationLink> links = new ArrayList<NavigationLink>();
>>> + links.add(new NavigationLink("enhancervie", "/enhancer VIE",
>> "/imports/enhancervieDescription.ftl", 20));
>>> + return links;
>>> + }
>>> +
>>> + @Override
>>> + public BundleContext getBundleContext() {
>>> + return bundleContext;
>>> + }
>>> +
>>> +}
>>>
>>> Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> ---
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>> (added)
>>> +++
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>> Thu Jul 7 07:38:24 2011
>>> @@ -0,0 +1,27 @@
>>> +package org.apache.stanbol.enhancer.webvie.resource;
>>> +
>>> +import static javax.ws.rs.core.MediaType.TEXT_HTML;
>>> +
>>> +import javax.ws.rs.GET;
>>> +import javax.ws.rs.Path;
>>> +import javax.ws.rs.Produces;
>>> +
>>> +import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
>>> +
>>> +import com.sun.jersey.api.view.Viewable;
>>> +
>>> +/**
>>> + * Adapter to add a VIE based interface for the Stanbol Enhancer
>>> + * @author Szaby Gruenwald
>>> + */
>>> +@Path("/enhancervie")
>>> +public class EnhancerVieRootResource extends BaseStanbolResource {
>>> +
>>> +
>>> + @GET
>>> + @Produces(TEXT_HTML + ";qs=2")
>>> + public Viewable getView() {
>>> + return new Viewable("index", this);
>>> + }
>>> +
>>> +}
>>>
>>> Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> ---
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>> (added)
>>> +++
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>> Thu Jul 7 07:38:24 2011
>>> @@ -0,0 +1,677 @@
>>> +# Annotate - a text enhancement interaction jQuery UI widget
>>> +# (c) 2011 Szaby Gruenwald, IKS Consortium
>>> +# Annotate may be freely distributed under the MIT license
>>> +
>>> +((jQuery) ->
>>> + # The annotate.js widget
>>> + #
>>> +
>>> + # define namespaces
>>> + ns =
>>> + rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
>>> + enhancer: 'http://fise.iks-project.eu/ontology/'
>>> + dc: 'http://purl.org/dc/terms/'
>>> + rdfs: 'http://www.w3.org/2000/01/rdf-schema#'
>>> +
>>> + ANTT = ANTT or {}
>>> + Stanbol = Stanbol or {}
>>> +
>>> + # filter for TextAnnotations
>>> + Stanbol.getTextAnnotations = (enhRdf) ->
>>> + res = _(enhRdf).map((obj, key) ->
>>> + obj.id = key
>>> + obj
>>> + )
>>> + .filter (e) ->
>>> + e["#{ns.rdf}type"]
>>> + .map((x) -> x.value)
>>> + .indexOf("#{ns.enhancer}TextAnnotation") != -1
>>> + res = _(res).sortBy (e) ->
>>> + conf = Number e["#{ns.enhancer}confidence"][0].value if
>> e["#{ns.enhancer}confidence"]
>>> + -1 * conf
>>> +
>>> + _(res).map (s)->
>>> + new Stanbol.TextEnhancement s, enhRdf
>>> +
>>> + # filter the entityManager for TextAnnotations
>>> + Stanbol.getEntityAnnotations = (enhRdf) ->
>>> + _(enhRdf)
>>> + .map((obj, key) ->
>>> + obj.id = key
>>> + obj
>>> + )
>>> + .filter (e) ->
>>> + e["#{ns.rdf}type"]
>>> + .map((x) -> x.value)
>>> + .indexOf("#{ns.enhancer}EntityAnnotation") != -1
>>> +
>>> + # Get the label in the user's language or the first one from a VIE
>> entity
>>> + ANTT.getRightLabel = (entity) ->
>>> + labelMap = {}
>>> + for label in _(entity["#{ns.rdfs}label"]).flatten()
>>> + cleanLabel = label.value
>>> + if cleanLabel.lastIndexOf "@" is cleanLabel.length - 3
>>> + cleanLabel = cleanLabel.substring 0, cleanLabel.length -
>> 3
>>> + labelMap[label["xml:lang"]|| "_"] = cleanLabel
>>> + userLang = window.navigator.language.split("-")[0]
>>> + # Return the first best label
>>> + labelMap[userLang] or labelMap["_"] or labelMap["en"]
>>> +
>>> + # Generic API for a TextEnhancement
>>> + # A TextEnhancement object has the methods for getting generic
>>> + # text-enhancement-specific properties.
>>> + # TODO Place it into a global Stanbol object.
>>> + Stanbol.TextEnhancement = (enhancement, enhRdf) ->
>>> + @_enhancement = enhancement
>>> + @_enhRdf = enhRdf
>>> + @id = @_enhancement.id
>>> + Stanbol.TextEnhancement.prototype =
>>> + # the text the annotation is for
>>> + getSelectedText: ->
>>> + @_vals("#{ns.enhancer}selected-text")[0]
>>> + # confidence value
>>> + getConfidence: ->
>>> + @_vals("#{ns.enhancer}confidence")[0]
>>> + # get Entities suggested for the text enhancement (if any)
>>> + getEntityEnhancements: ->
>>> + rawList = _(Stanbol.getEntityAnnotations @_enhRdf ).filter
>> (ann) =>
>>> + relations = _(ann["#{ns.dc}relation"])
>>> + .map (e) -> e.value
>>> + if (relations.indexOf @_enhancement.id) isnt -1 then
>> true
>>> + else false
>>> + _(rawList).map (ee) =>
>>> + new Stanbol.EntityEnhancement ee, @
>>> + # The type of the entity suggested (e.g. person, location,
>> organization)
>>> + getType: ->
>>> + @_vals("#{ns.dc}type")[0]
>>> + # Optional, not used
>>> + getContext: ->
>>> + @_vals("#{ns.enhancer}selection-context")[0]
>>> + # start position in the original text
>>> + getStart: ->
>>> + Number @_vals("#{ns.enhancer}start")[0]
>>> + # end position in the original text
>>> + getEnd: ->
>>> + Number @_vals("#{ns.enhancer}end")[0]
>>> + # Optional
>>> + getOrigText: ->
>>> + ciUri = @_vals("#{ns.enhancer}extracted-from")[0]
>>> + @_enhRdf[ciUri]["
>> http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent
>> "][0].value
>>> + _vals: (key) ->
>>> + _(@_enhancement[key])
>>> + .map (x) -> x.value
>>> +
>>> + # Generic API for an EntityEnhancement. This is the implementation
>> for Stanbol
>>> + Stanbol.EntityEnhancement = (ee, textEnh) ->
>>> + @_textEnhancement = textEnh
>>> + $.extend @, ee
>>> + Stanbol.EntityEnhancement.prototype =
>>> + getLabel: ->
>>> + @_vals("#{ns.enhancer}entity-label")[0]
>>> + getUri: ->
>>> + @_vals("#{ns.enhancer}entity-reference")[0]
>>> + getTextEnhancement: ->
>>> + @_textEnhancement
>>> + getTypes: ->
>>> + @_vals("#{ns.enhancer}entity-type")
>>> + getConfidence: ->
>>> + Number @_vals("#{ns.enhancer}confidence")[0]
>>> + _vals: (key) ->
>>> + _(@[key]).map (x) -> x.value
>>> +
>>> + # get or create a dom element containing only the occurrence of the
>> found entity
>>> + ANTT.getOrCreateDomElement = (element, text, options = {}) ->
>>> + # Find occurrence indexes of s in str
>>> + occurrences = (str, s) ->
>>> + res = []
>>> + last = 0
>>> + while str.indexOf(s, last + 1) isnt -1
>>> + next = str.indexOf s, last+1
>>> + res.push next
>>> + last = next
>>> +
>>> + # Find the nearest number among the
>>> + nearest = (arr, nr) ->
>>> + _(arr).sortedIndex nr
>>> +
>>> + # Nearest position
>>> + nearestPosition = (str, s, ind) ->
>>> + arr = occurrences(str,s)
>>> + i1 = nearest arr, ind
>>> + if arr.length is 1
>>> + arr[0]
>>> + else if i1 is arr.length
>>> + arr[i1-1]
>>> + else
>>> + i0 = i1-1
>>> + d0 = ind - arr[i0]
>>> + d1 = arr[i1] - ind
>>> + if d1> d0 then arr[i0]
>>> + else arr[i1]
>>> +
>>> + domEl = element
>>> + textContentOf = (element) -> $(element).text().replace(/\n/g, "
>> ")
>>> + # find the text node
>>> + if textContentOf(element).indexOf(text) is -1
>>> + throw "'#{text}' doesn't appear in the text block."
>>> + return $()
>>> + start = options.start +
>>> + textContentOf(element).indexOf textContentOf(element).trim()
>>> + # Correct small position errors
>>> + start = nearestPosition textContentOf(element), text, start
>>> + pos = 0
>>> + while textContentOf(domEl).indexOf(text) isnt -1 and
>> domEl.nodeName isnt '#text'
>>> + domEl = _(domEl.childNodes).detect (el) ->
>>> + p = textContentOf(el).lastIndexOf text
>>> + if p>= start - pos
>>> + true
>>> + else
>>> + pos += textContentOf(el).length
>>> + false
>>> +
>>> + if options.createMode is "existing" and
>> textContentOf($(domEl).parent()) is text
>>> + return $(domEl).parent()[0]
>>> + else
>>> + pos = start - pos
>>> + len = text.length
>>> + textToCut = textContentOf(domEl).substring(pos, pos+len)
>>> + if textToCut is text
>>> + domEl.splitText pos + len
>>> + newElement = document.createElement
>> options.createElement or 'span'
>>> + newElement.innerHTML = text
>>> + $(domEl).parent()[0].replaceChild newElement,
>> domEl.splitText pos
>>> + $ newElement
>>> + else
>>> + console.warn "dom element creation problem: #{textToCut}
>> isnt #{text}"
>>> +
>>> + # Give back the last part of a uri for fallback label creation
>>> + ANTT.uriSuffix = (uri) ->
>>> + res = uri.substring uri.lastIndexOf("#") + 1
>>> + res.substring res.lastIndexOf("/") + 1
>>> +
>>> + # jquery events cloning method
>>> + ANTT.cloneCopyEvent = (src, dest) ->
>>> + if dest.nodeType isnt 1 or not jQuery.hasData src
>>> + return
>>> +
>>> + internalKey = $.expando
>>> + oldData = $.data src
>>> + curData = $.data dest, oldData
>>> +
>>> + # Switch to use the internal data object, if it exists, for the
>> next
>>> + # stage of data copying
>>> + if oldData = oldData[internalKey]
>>> + events = oldData.events
>>> + curData = curData[ internalKey ] = jQuery.extend({},
>> oldData);
>>> +
>>> + if events
>>> + delete curData.handle
>>> + curData.events = {}
>>> +
>>> + `for ( var type in events ) {
>>> + for ( var i = 0, l = events[ type ].length; i< l;
>> i++ ) {
>>> + jQuery.event.add( dest, type + ( events[ type ][
>> i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][
>> i ], events[ type ][ i ].data );
>>> + }
>>> + }`
>>> + null
>>> +
>>> + ######################################################
>>> + # Annotate widget
>>> + # makes a content dom element interactively annotatable
>>> + ######################################################
>>> + jQuery.widget 'IKS.annotate',
>>> + __widgetName: "IKS.annotate"
>>> + options:
>>> + autoAnalyze: false
>>> + debug: false
>>> + # namespaces necessary for the widget configuration
>>> + ns:
>>> + dbpedia: "http://dbpedia.org/ontology/"
>>> + skos: "http://www.w3.org/2004/02/skos/core#"
>>> + # Give a label to your expected enhancement types
>>> + getTypes: ->
>>> + [
>>> + uri: "#{@ns.dbpedia}Place"
>>> + label: 'Place'
>>> + ,
>>> + uri: "#{@ns.dbpedia}Person"
>>> + label: 'Person'
>>> + ,
>>> + uri: "#{@ns.dbpedia}Organisation"
>>> + label: 'Organisation'
>>> + ,
>>> + uri: "#{@ns.skos}Concept"
>>> + label: 'Concept'
>>> + ]
>>> + # Give a label to the sources the entities come from
>>> + getSources: ->
>>> + [
>>> + uri: "http://dbpedia.org/resource/"
>>> + label: "dbpedia"
>>> + ,
>>> + uri: "http://sws.geonames.org/"
>>> + label: "geonames"
>>> + ]
>>> + _create: ->
>>> + widget = @
>>> + # logger can be turned on and off. It will show the real
>> caller line in the log
>>> + @_logger = if @options.debug then console else
>>> + info: ->
>>> + warn: ->
>>> + error: ->
>>> + # widget.entityCache.get(uri, cb) will get and cache the
>> entity from an entityhub
>>> + @entityCache = window.entityCache =
>>> + _entities: {}
>>> + # calling the get with a scope and callback will call
>> cb(entity) with the scope as soon it's available.'
>>> + get: (uri, scope, cb) ->
>>> + # If entity is stored in the cache already just call
>> cb
>>> + if @_entities[uri] and @_entities[uri].status is
>> "done"
>>> + cb.apply scope, [@_entities[uri].entity]
>>> + # If the entity is new to the cache
>>> + else if not @_entities[uri]
>>> + # create cache entry
>>> + @_entities[uri] =
>>> + status: "pending"
>>> + uri: uri
>>> + cache = @
>>> + # make a request to the entity hub
>>> + widget.options.connector.queryEntityHub uri,
>> (entity) ->
>>> + if not entity.status
>>> + if entity.id isnt uri
>>> + widget._logger.warn "wrong
>> callback", uri, entity.id
>>> + cache._entities[uri].entity = entity
>>> + cache._entities[uri].status = "done"
>>> + $(cache._entities[uri]).trigger "done",
>> entity
>>> + else
>>> + widget._logger.warn "error getting
>> entity", uri, entity
>>> + if @_entities[uri] and @_entities[uri].status is
>> "pending"
>>> + $( @_entities[uri] )
>>> + .bind "done", (event, entity) ->
>>> + cb.apply scope, [entity]
>>> + if @options.autoAnalyze
>>> + @enable()
>>> +
>>> + # analyze the widget element and show text enhancements
>>> + enable: (cb) ->
>>> + analyzedNode = @element
>>> + # the analyzedDocUri makes the connection between a document
>> state and
>>> + # the annotations to it. We have to clean up the annotations
>> to any
>>> + # old document state
>>> +
>>> + @options.connector.analyze @element,
>>> + success: (rdf) =>
>>> + # Get enhancements
>>> + rdfJson = rdf.databank.dump()
>>> +
>>> + textAnnotations =
>> Stanbol.getTextAnnotations(rdfJson)
>>> + # Remove all textAnnotations without a selected text
>> property
>>> + textAnnotations = _(textAnnotations)
>>> + .filter (textEnh) ->
>>> + if textEnh.getSelectedText and
>> textEnh.getSelectedText()
>>> + true
>>> + else
>>> + false
>>> + _(textAnnotations)
>>> + .each (s) =>
>>> + @_logger.info s._enhancement,
>>> + 'confidence', s.getConfidence(),
>>> + 'selectedText', s.getSelectedText(),
>>> + 'type', s.getType(),
>>> + 'EntityEnhancements',
>> s.getEntityEnhancements()
>>> + # Process the text enhancements
>>> + @processTextEnhancement s, analyzedNode
>>> + # trigger 'done' event with success = true
>>> + @_trigger "done", true
>>> + if typeof cb is "function"
>>> + cb(true)
>>> + # Remove all not accepted text enhancement widgets
>>> + disable: ->
>>> + $( ':IKS-annotationSelector', @element ).each () ->
>>> + $(@).annotationSelector 'disable'
>>> +
>>> + # processTextEnhancement deals with one TextEnhancement in an
>> ancestor element of its occurrence
>>> + processTextEnhancement: (textEnh, parentEl) ->
>>> + if not textEnh.getSelectedText()
>>> + console.warn "textEnh", textEnh, "doesn't have
>> selected-text!"
>>> + return
>>> + el = $ ANTT.getOrCreateDomElement parentEl[0],
>> textEnh.getSelectedText(),
>>> + createElement: 'span'
>>> + createMode: 'existing'
>>> + context: textEnh.getContext()
>>> + start: textEnh.getStart()
>>> + end: textEnh.getEnd()
>>> + sType = textEnh.getType()
>>> + widget = @
>>> + el.addClass('entity')
>>> + .addClass ANTT.uriSuffix(sType).toLowerCase()
>>> + if textEnh.getEntityEnhancements().length
>>> + el.addClass "withSuggestions"
>>> + for eEnh in textEnh.getEntityEnhancements()
>>> + eEnhUri = eEnh.getUri()
>>> + @entityCache.get eEnhUri, eEnh, (entity) ->
>>> + if this.getUri() isnt entity.id
>>> + widget._logger.warn "wrong callback", entity.id,
>> this.getUri()
>>> +# widget._logger.info "entity for",
>> textEnh.getSelectedText(), this.getUri(), entity
>>> + # Create widget to select from the suggested entities
>>> + options =
>>> + cache: @entityCache
>>> + $.extend options, @options
>>> + el.annotationSelector( options )
>>> + .annotationSelector 'addTextEnhancement', textEnh
>>> +
>>> + ######################################################
>>> + # AnnotationSelector widget
>>> + # the annotationSelector makes an annotated word interactive
>>> + ######################################################
>>> + ANTT.annotationSelector =
>>> + jQuery.widget 'IKS.annotationSelector',
>>> + # just for debugging and understanding
>>> + __widgetName: "IKS.annotationSelector"
>>> + options:
>>> + ns:
>>> + dbpedia: "http://dbpedia.org/ontology/"
>>> + skos: "http://www.w3.org/2004/02/skos/core#"
>>> + getTypes: ->
>>> + [
>>> + uri: "#{@ns.dbpedia}Place"
>>> + label: 'Place'
>>> + ,
>>> + uri: "#{@ns.dbpedia}Person"
>>> + label: 'Person'
>>> + ,
>>> + uri: "#{@ns.dbpedia}Organisation"
>>> + label: 'Organisation'
>>> + ,
>>> + uri: "#{@ns.skos}Concept"
>>> + label: 'Concept'
>>> + ]
>>> + getSources: ->
>>> + [
>>> + uri: "http://dbpedia.org/resource/"
>>> + label: "dbpedia"
>>> + ,
>>> + uri: "http://sws.geonames.org/"
>>> + label: "geonames"
>>> + ]
>>> +
>>> + _create: ->
>>> + @element.click =>
>>> + if not @dialog
>>> + @_createDialog()
>>> + setTimeout((=> @dialog.open()), 220)
>>> + # Collect all EntityEnhancements for all the
>> TextEnhancements
>>> + # on the selected node.
>>> + eEnhancements = []
>>> + for textEnh in @textEnhancements
>>> + for enhancement in
>> textEnh.getEntityEnhancements()
>>> + eEnhancements.push enhancement
>>> + # filter enhancements with the same uri
>>> + # this is necessary because of a bug in stanbol that
>> creates
>>> + # duplicate enhancements.
>>> + # https://issues.apache.org/jira/browse/STANBOL-228
>>> + _tempUris = []
>>> + eEnhancements = _(eEnhancements).filter (eEnh) ->
>>> + uri = eEnh.getUri()
>>> + if _tempUris.indexOf(uri) is -1
>>> + _tempUris.push uri
>>> + true
>>> + else
>>> + false
>>> + @entityEnhancements = eEnhancements
>>> +
>>> + @_createSearchbox()
>>> + if @entityEnhancements.length> 0
>>> + @_createMenu() if @menu is undefined
>>> + else @searchEntryField.find('.search').focus 100
>>> + @_logger = if @options.debug then console else
>>> + info: ->
>>> + warn: ->
>>> + error: ->
>>> + _destroy: ->
>>> + if @menu
>>> + @menu.destroy()
>>> + @menu.element.remove()
>>> + delete @menu
>>> + if @dialog
>>> + @dialog.destroy()
>>> + @dialog.element.remove()
>>> + @dialog.uiDialogTitlebar.remove()
>>> + delete @dialog
>>> +
>>> + # Produce type label list out of a uri list.
>>> + # Filtered by the @options.types list
>>> + _typeLabels: (types) ->
>>> + knownMapping = @options.getTypes()
>>> + allKnownPrefixes = _(knownMapping).map (x) -> x.uri
>>> + knownPrefixes = _.intersect allKnownPrefixes, types
>>> + _(knownPrefixes).map (key) =>
>>> + foundPrefix = _(knownMapping).detect (x) -> x.uri is key
>>> + foundPrefix.label
>>> +
>>> + # make a label for the entity source based on
>> options.getSources()
>>> + _sourceLabel: (src) ->
>>> + sources = @options.getSources()
>>> + sourceObj = _(sources).detect (s) -> src.indexOf(s.uri) isnt
>> -1
>>> + if sourceObj
>>> + sourceObj.label
>>> + else
>>> + src.split("/")[2]
>>> +
>>> + # create dialog widget
>>> + _createDialog: ->
>>> + label = @element.text()
>>> + dialogEl = $("<div><span class='entity-link'></span></div>")
>>> + .attr( "tabIndex", -1)
>>> + .addClass()
>>> + .keydown( (event) =>
>>> + if not event.isDefaultPrevented() and event.keyCode and
>> event.keyCode is $.ui.keyCode.ESCAPE
>>> + @close event
>>> + event.preventDefault()
>>> + )
>>> + .bind('dialogblur', (event) =>
>>> + @_logger.info 'dialog dialogblur'
>>> + @close(event)
>>> + )
>>> + .bind('blur', (event) =>
>>> + @_logger.info 'dialog blur'
>>> + @close(event)
>>> + )
>>> + .appendTo( $("body")[0] )
>>> + widget = @
>>> + dialogEl.dialog
>>> + width: 400
>>> + title: label
>>> + close: (event, ui) =>
>>> + @close(event)
>>> + autoOpen: false
>>> + open: (e, ui) ->
>>> + $.data(this, 'dialog').uiDialog.position {
>>> + of: widget.element
>>> + my: "left top"
>>> + at: "left bottom"
>>> + collision: "none"}
>>> + @dialog = dialogEl.data 'dialog'
>>> + @dialog.uiDialogTitlebar.hide()
>>> + @_logger.info "dialog widget:", @dialog
>>> + @dialog.element.focus(100)
>>> + window.d = @dialog
>>> + @_insertLink()
>>> + @_updateTitle()
>>> + @_setButtons()
>>> +
>>> + # If annotation is already made insert a link to the entity
>>> + _insertLink: ->
>>> + if @isAnnotated() and @dialog
>>> + $("Annotated:<a href='#{@linkedEntity.uri}'
>> target='_blank'>
>>> + #{@linkedEntity.label} @
>> #{@_sourceLabel(@linkedEntity.uri)}</a><br/>")
>>> + .appendTo $( '.entity-link', @dialog.element )
>>> + # create/update the dialog button row
>>> + _setButtons: ->
>>> + @dialog.element.dialog 'option', 'buttons',
>>> + rem:
>>> + text: if @isAnnotated() then 'Remove' else 'Decline'
>>> + click: (event) =>
>>> + @remove event
>>> + Cancel: =>
>>> + @close()
>>> +
>>> + # remove textEnhancement/annotation, replace the separate html
>>> + # element with the plain text and close the dialog
>>> + remove: (event) ->
>>> + el = @element.parent()
>>> + if not @isAnnotated() and @textEnhancements
>>> + @_trigger 'decline', event,
>>> + textEnhancements: @textEnhancements
>>> + else
>>> + @_trigger 'remove', event,
>>> + textEnhancement: @_acceptedTextEnhancement
>>> + entityEnhancement: @_acceptedEntityEnhancement
>>> + linkedEntity: @linkedEntity
>>> + @destroy()
>>> + if @element.qname().name isnt '#text'
>>> + @element.replaceWith document.createTextNode
>> @element.text()
>>> +
>>> + # Remove the widget if not annotated.
>>> + disable: ->
>>> + if not @isAnnotated() and @element.qname().name isnt '#text'
>>> + @element.replaceWith document.createTextNode
>> @element.text()
>>> +
>>> + # tells if this is an annotated dom element (not a highlighted
>> textEnhancement only)
>>> + isAnnotated: ->
>>> + if @element.attr 'about' then true else false
>>> +
>>> + # Place the annotation on the DOM element (about and typeof
>> attributes)
>>> + annotate: (entityEnhancement, styleClass) ->
>>> + entityUri = entityEnhancement.getUri()
>>> + entityType =
>> entityEnhancement.getTextEnhancement().getType()
>>> + entityHtml = @element.html()
>>> + # We ignore the old style classes
>>> + # entityClass = @element.attr 'class'
>>> + sType = entityEnhancement.getTextEnhancement().getType()
>>> + entityClass = 'entity ' +
>> ANTT.uriSuffix(sType).toLowerCase()
>>> + newElement = $ "<a href='#{entityUri}'
>>> + about='#{entityUri}'
>>> + typeof='#{entityType}'
>>> + class='#{entityClass}'>#{entityHtml}</a>"
>>> + ANTT.cloneCopyEvent @element[0], newElement[0]
>>> + @linkedEntity =
>>> + uri: entityUri
>>> + type: entityType
>>> + label: entityEnhancement.getLabel()
>>> + @element.replaceWith newElement
>>> + @element = newElement.addClass styleClass
>>> + @_logger.info "created annotation in", @element
>>> + @_updateTitle()
>>> + @_insertLink()
>>> + @_acceptedTextEnhancement =
>> entityEnhancement.getTextEnhancement()
>>> + @_acceptedEntityEnhancement = entityEnhancement
>>> + @_trigger 'select', null,
>>> + linkedEntity: @linkedEntity
>>> + textEnhancement: entityEnhancement.getTextEnhancement()
>>> + entityEnhancement: entityEnhancement
>>> + # closing the widget
>>> + close: ->
>>> + @destroy()
>>> + _updateTitle: ->
>>> + if @dialog
>>> + if @isAnnotated()
>>> + title = "#{@linkedEntity.label}<small>@
>> #{@_sourceLabel(@linkedEntity.uri)}</small>"
>>> + else
>>> + title = @element.text()
>>> + @dialog._setOption 'title', title
>>> +
>>> + # create menu and add to the dialog
>>> + _createMenu: ->
>>> + ul = $('<ul></ul>')
>>> + .appendTo( @dialog.element )
>>> + @_renderMenu ul, @entityEnhancements
>>> + @menu = ul
>>> + .menu({
>>> + select: (event, ui) =>
>>> + @_logger.info "selected menu item", ui.item
>>> + @annotate ui.item.data('enhancement'),
>> 'acknowledged'
>>> + @close(event)
>>> + blur: (event, ui) =>
>>> + @_logger.info 'menu.blur()', ui.item
>>> + focus: (event, ui) =>
>>> + @_logger.info 'menu.focus()', ui.item
>>> + # show preview
>>> + @_entityPreview ui.item
>>> + })
>>> + .bind('blur', (event, ui) ->
>>> + @_logger.info 'menu blur', ui
>>> + )
>>> + .bind('menublur', (event, ui) ->
>>> + @_logger.info 'menu menublur', ui.item
>>> + )
>>> + .focus(150)
>>> + .data 'menu'
>>> +
>>> + # Rendering menu for the EntityEnhancements suggested for the
>> selected text
>>> + _renderMenu: (ul, entityEnhancements) ->
>>> + entityEnhancements = _(entityEnhancements).sortBy (ee) -> -1
>> * ee.getConfidence()
>>> + @_renderItem ul, enhancement for enhancement in
>> entityEnhancements
>>> + @_logger.info 'rendered menu for the elements',
>> entityEnhancements
>>> + _renderItem: (ul, eEnhancement) ->
>>> + label = eEnhancement.getLabel().replace /^\"|\"$/g, ""
>>> + type = @_typeLabels eEnhancement.getTypes()
>>> + source = @_sourceLabel eEnhancement.getUri()
>>> + active = if @linkedEntity and eEnhancement.getUri() is
>> @linkedEntity.uri
>>> + " class='ui-state-active'"
>>> + else ""
>>> + $("<li#{active}><a href='#'>#{label}<small>(#{type} from
>> #{source})</small></a></li>")
>>> + .data('enhancement', eEnhancement)
>>> + .appendTo ul
>>> +
>>> + # Render search box with autocompletion for finding the right
>> entity
>>> + _createSearchbox: ->
>>> + # Show an input box for autocompleted search
>>> + @searchEntryField = $('<span style="background: fff;"><label
>> for="search">Search:</label> <input id="search" class="search"></span>')
>>> + .appendTo @dialog.element
>>> + sugg = @textEnhancements[0]
>>> + widget = @
>>> + $( '.search', @searchEntryField )
>>> + .autocomplete
>>> + # Define source method. TODO make independent from
>> stanbol.
>>> + source: (req, resp) ->
>>> + widget._logger.info "req:", req
>>> + widget.options.connector.findEntity
>> "#{req.term}#{'*' if req.term.length> 3}", (entityList) ->
>>> + widget._logger.info "resp:", _(entityList).map
>> (ent) ->
>>> + ent.id
>>> + res = for i, entity of entityList
>>> + {
>>> + key: entity.id
>>> + label: "#{ANTT.getRightLabel entity} @
>> #{widget._sourceLabel entity.id}"
>>> + _label: ANTT.getRightLabel entity
>>> + getLabel: -> @_label
>>> + getUri: -> @key
>>> + # To rethink: The type of the annotation
>> (person, place, org)
>>> + # should come from the search result, not
>> from the first textEnhancement
>>> + _tEnh: sugg
>>> + getTextEnhancement: -> @_tEnh
>>> + }
>>> + resp res
>>> + # An entity selected, annotate
>>> + select: (e, ui) =>
>>> + @annotate ui.item, "acknowledged"
>>> + @_logger.info "autocomplete.select", e.target, ui
>>> + focus: (e, ui) =>
>>> + @_logger.info "autocomplete.focus", e.target, ui
>>> + @_entityPreview ui.item
>>> + .focus(200)
>>> + .blur (e, ui) =>
>>> + @_dialogCloseTimeout = setTimeout ( => @close()), 200
>>> + @_logger.info "show searchbox"
>>> + # Show preview of a hovered item
>>> + _entityPreview: _.throttle(( (item) ->
>>> + @_logger.info "Show preview for", item
>>> + ), 1500)
>>> +
>>> + # add a textEnhancement that gets shown when the dialog is
>> rendered
>>> + addTextEnhancement: (textEnh) ->
>>> + @options.textEnhancements = @options.textEnhancements or []
>>> + @options.textEnhancements.push textEnh
>>> + @textEnhancements = @options.textEnhancements
>>> +
>>> + window.ANTT = ANTT
>>> +) jQuery
>>>
>>> Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> Binary file - no diff available.
>>>
>>> Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
>>>
>> ------------------------------------------------------------------------------
>>> svn:mime-type = application/octet-stream
>>>
>>> Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> Binary file - no diff available.
>>>
>>> Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
>>>
>> ------------------------------------------------------------------------------
>>> svn:mime-type = application/octet-stream
>>>
>>> Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> Binary file - no diff available.
>>>
>>> Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
>>>
>> ------------------------------------------------------------------------------
>>> svn:mime-type = application/octet-stream
>>>
>>> Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> Binary file - no diff available.
>>>
>>> Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
>>>
>> ------------------------------------------------------------------------------
>>> svn:mime-type = application/octet-stream
>>>
>>> Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> Binary file - no diff available.
>>>
>>> Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
>>>
>> ------------------------------------------------------------------------------
>>> svn:mime-type = application/octet-stream
>>>
>>> Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
>>> URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png?rev=1143692&view=auto
>>>
>> ==============================================================================
>>> Binary file - no diff available.
>>>
>>> Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
>>>
>> ------------------------------------------------------------------------------
>>> svn:mime-type = application/octet-stream
>>>
>>>
>>>
>>
>>
>>
>> --
>> Fabian
>>
>
Re: svn commit: r1143692 [1/10] - in /incubator/stanbol/trunk/commons/web/webvie:
./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/stanbol/ src/main/java/org/apache/stanbol/enhancer/ src/main/java
Posted by Fabian Christ <ch...@googlemail.com>.
Hi,
cool - thank you! Will check it out ;)
Best,
- Fabian
2011/7/8 Szabolcs Grünwald <sz...@web.de>:
> Forgot to mention the dependency on the hallo.coffee rich-text editor (
> https://github.com/bergie/hallo)
>
> 2011/7/8 Szabolcs Grünwald <sz...@web.de>
>
>> Right, I apologize..
>>
>> So let me describe shortly what I was working on and committed here.
>>
>> Similar to the web ui at <stanboluri>/engines, this bundle gives you an
>> access to the enhancer engines with the following differences:
>>
>> - it uses the restful endpoint to communicate
>> - Shows the enhancements directly in the text and in the dom.
>> - It demonstrates that the text can be changed directly on the page for
>> later storage
>>
>> For reaching this I implemented a jquery ui widget (annotate.coffee). This
>> widget is meant to be independent from stanbol so after some further
>> refactoring it will be possible to connect it to other enhancer-entityhub
>> backends simply by implementing connectors and two classes, one for
>> EntityEnancements, one for TextEnhancements.
>>
>> Dependencies of the annotate widget are
>>
>> - jquery 1.6+
>> - jquery ui 1.9m5+ (using jquery-ui.menu.js which is not yet part of
>> 1.8)
>> - vie2.connectors.stanbol (I plan to refactor this to make the
>> connector independent of vie2)
>>
>> I created following JIRA issue for this:
>> https://issues.apache.org/jira/browse/STANBOL-256
>>
>> Peace,
>> Szaby
>>
>> On 8 July 2011 10:02, Fabian Christ <ch...@googlemail.com> wrote:
>>
>>> Hi Szaby,
>>>
>>> thank you for this contribution but could you please write a few lines
>>> to the list what this is about?
>>>
>>> And please open JIRA issues for such things where you describe the
>>> task that you are working on - this makes it easier for others to
>>> follow what happens. Then mention the STANBOL-XXX issue identifier in
>>> the commit message and the commit is automatically related to the
>>> issue in JIRA.
>>>
>>> https://issues.apache.org/jira/browse/STANBOL
>>>
>>> Best,
>>> - Fabian
>>>
>>> 2011/7/7 <sz...@apache.org>:
>>> > Author: szabyg
>>> > Date: Thu Jul 7 07:38:24 2011
>>> > New Revision: 1143692
>>> >
>>> > URL: http://svn.apache.org/viewvc?rev=1143692&view=rev
>>> > Log:
>>> > First version of the webvie user interface, based on hallo.coffee editor
>>> and the annotate.coffee widget.
>>> > See also https://github.com/szabyg/stanbol-webvie
>>> >
>>> > Added:
>>> > incubator/stanbol/trunk/commons/web/webvie/
>>> > incubator/stanbol/trunk/commons/web/webvie/.svnignore
>>> > incubator/stanbol/trunk/commons/web/webvie/README.md
>>> > incubator/stanbol/trunk/commons/web/webvie/pom.xml
>>> > incubator/stanbol/trunk/commons/web/webvie/src/
>>> > incubator/stanbol/trunk/commons/web/webvie/src/main/
>>> > incubator/stanbol/trunk/commons/web/webvie/src/main/java/
>>> > incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/
>>> > incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>>> > incubator/stanbol/trunk/commons/web/webvie/src/main/resources/
>>> > incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery-ui-1.8.7.custom.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery.ui.menu.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_75_ffffff_40x100.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_65_ffffff_1x400.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_dadada_1x400.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_222222_256x240.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_2e83ff_256x240.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_454545_256x240.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_888888_256x240.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_cd0a0a_256x240.png
>>> (with props)
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery-ui-1.8.13.custom.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.accordion.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.all.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.autocomplete.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.base.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.button.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.core.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.datepicker.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.dialog.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.progressbar.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.resizable.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.selectable.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.slider.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.tabs.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.theme.css
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone-min.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/format.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/hallo.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-1.5.1.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-ui.1.9m5.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.debug.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.min.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/underscore-min.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-collectionmanager.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-containermanager.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/dbpedia.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/opencalais.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/rdfa.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/semantictweet.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/stanbol.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/zemanta.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/organization.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/person.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/place.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/task.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/thing.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/vie2-latest.debug.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/test.js
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/enhancervieDescription.ftl
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
>>> >
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/index.ftl
>>> > incubator/stanbol/trunk/commons/web/webvie/src/test/
>>> > incubator/stanbol/trunk/commons/web/webvie/src/test/java/
>>> > incubator/stanbol/trunk/commons/web/webvie/src/test/resources/
>>> >
>>> > Added: incubator/stanbol/trunk/commons/web/webvie/.svnignore
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/.svnignore?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > --- incubator/stanbol/trunk/commons/web/webvie/.svnignore (added)
>>> > +++ incubator/stanbol/trunk/commons/web/webvie/.svnignore Thu Jul 7
>>> 07:38:24 2011
>>> > @@ -0,0 +1,2 @@
>>> > +*.sh
>>> > +sc
>>> >
>>> > Added: incubator/stanbol/trunk/commons/web/webvie/README.md
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/README.md?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > --- incubator/stanbol/trunk/commons/web/webvie/README.md (added)
>>> > +++ incubator/stanbol/trunk/commons/web/webvie/README.md Thu Jul 7
>>> 07:38:24 2011
>>> > @@ -0,0 +1,62 @@
>>> > +VIE based Stanbol Enhancer UI
>>> > +=============================
>>> > +
>>> > +Adapter to add a VIE based interface for the Stanbol Enhancer
>>> > +
>>> > +Deploy
>>> > +------
>>> > +
>>> > +After building stanbol in a different folder you can build and deploy
>>> this bundle by using the following command:
>>> > +
>>> > + mvn install -DskipTests -PinstallBundle -Dsling.url=
>>> http://localhost:8080/system/console
>>> > +
>>> > +Development Guide
>>> > +=================
>>> > +
>>> > +The widget development is done in CoffeeScript. Use the following
>>> command to
>>> > +automatically compile the script in the background
>>> > +
>>> > + coffee -c -w -o lib annotate.coffee
>>> > +
>>> > +This will as well show you compile errors right after each save.
>>> > +
>>> > +To simplify work with the deep directory structure I created a
>>> directory for
>>> > +shortcuts to the most important directories called 'sc':
>>> > +
>>> > + ls -ln sc/
>>> > + lrwxrwxrwx 1 1000 1000 52 2011-06-01 11:44 java ->
>>> ../src/main/java/org/apache/stanbol/enhancer/webvie/
>>> > + lrwxrwxrwx 1 1000 1000 63 2011-06-01 11:43 static ->
>>> ../src/main/resources/org/apache/stanbol/enhancer/webvie/static
>>> > + lrwxrwxrwx 1 1000 1000 135 2011-06-01 11:44 template ->
>>> ../src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
>>> > +
>>> > +Annotate widget API
>>> > +===================
>>> > +Options:
>>> > +--------
>>> > +
>>> > +Methods:
>>> > +--------
>>> > +**enable**:
>>> > + Analyze text and highlight TextAnnotations. Make TextAnnotations
>>> > + interactive.
>>> > +
>>> > +**disable**:
>>> > + Remove TextAnnotation highlighting.
>>> > +
>>> > +Events
>>> > +------
>>> > +**select**:
>>> > + Triggered on annotating a suggested TextEnhancement
>>> > +
>>> > +**decline**:
>>> > + Triggered on declining a suggested TextEnhancement
>>> > +
>>> > +**remove**:
>>> > + Triggered when an annotation is removed
>>> > +
>>> > + function (event, ui)
>>> > +
>>> > + The ui object has the following attributes:
>>> > + `textEnhancement`,
>>> > + `entityEnhancement`
>>> > + `linkedEntity`
>>> > +
>>> >
>>> > Added: incubator/stanbol/trunk/commons/web/webvie/pom.xml
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/pom.xml?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > --- incubator/stanbol/trunk/commons/web/webvie/pom.xml (added)
>>> > +++ incubator/stanbol/trunk/commons/web/webvie/pom.xml Thu Jul 7
>>> 07:38:24 2011
>>> > @@ -0,0 +1,135 @@
>>> > +<?xml version="1.0" encoding="UTF-8"?>
>>> > +<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>stanbol-parent</artifactId>
>>> > + <version>0.9-SNAPSHOT</version>
>>> > + <relativePath>../../parent/pom.xml</relativePath>
>>> > + </parent>
>>> > + <artifactId>org.apache.stanbol.enhancer.webvie</artifactId>
>>> > + <packaging>bundle</packaging>
>>> > +
>>> > + <name>Editable Entity based Enhancer UI</name>
>>> > + <description>VIE based user interface for Stanbol
>>> > + </description>
>>> > +
>>> > + <build>
>>> > + <!-- make it an OSGi bundle -->
>>> > + <plugins>
>>> > + <plugin>
>>> > + <groupId>org.apache.felix</groupId>
>>> > + <artifactId>maven-scr-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.webvie.*
>>> > + </Export-Package>
>>> > + <Import-Package>*</Import-Package>
>>> > + </instructions>
>>> > + </configuration>
>>> > + </plugin>
>>> > + </plugins>
>>> > + </build>
>>> > +
>>> > + <dependencies>
>>> > +
>>> > + <!-- dependencies on other IKS modules -->
>>> > + <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.standalone</artifactId>
>>> > + </dependency>
>>> > + <dependency>
>>> > + <groupId>org.apache.stanbol</groupId>
>>> > + <artifactId>org.apache.stanbol.commons.web.base</artifactId>
>>> > + </dependency>
>>> > +
>>> > + <!-- needed for the ContentItem resource -->
>>> > + <dependency>
>>> > + <groupId>org.apache.stanbol</groupId>
>>> > + <artifactId>org.apache.stanbol.enhancer.jersey</artifactId>
>>> > + </dependency>
>>> > + <!-- Clerezza dependencies -->
>>> > + <dependency>
>>> > + <groupId>org.apache.clerezza</groupId>
>>> > + <artifactId>org.apache.clerezza.rdf.core</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>
>>> > + <dependency>
>>> > + <groupId>javax.servlet</groupId>
>>> > + <artifactId>servlet-api</artifactId>
>>> > + </dependency>
>>> > +
>>> > + <dependency>
>>> > + <groupId>org.freemarker</groupId>
>>> > + <artifactId>freemarker</artifactId>
>>> > + </dependency>
>>> > + <!-- indirect dependency for freemarker -->
>>> > + <dependency>
>>> > + <groupId>org.codehaus.jettison</groupId>
>>> > + <artifactId>jettison</artifactId>
>>> > + </dependency>
>>> > +
>>> > + <!-- generic tax -->
>>> > + <dependency>
>>> > + <groupId>org.slf4j</groupId>
>>> > + <artifactId>slf4j-api</artifactId>
>>> > + </dependency>
>>> > + <dependency>
>>> > + <groupId>commons-io</groupId>
>>> > + <artifactId>commons-io</artifactId>
>>> > + </dependency>
>>> > + <dependency>
>>> > + <groupId>commons-lang</groupId>
>>> > + <artifactId>commons-lang</artifactId>
>>> > + </dependency>
>>> > +
>>> > + <!-- OSGi tax -->
>>> > + <dependency>
>>> > + <groupId>org.osgi</groupId>
>>> > + <artifactId>org.osgi.core</artifactId>
>>> > + </dependency>
>>> > + <dependency>
>>> > + <groupId>org.osgi</groupId>
>>> > + <artifactId>org.osgi.compendium</artifactId>
>>> > + </dependency>
>>> > + <dependency>
>>> > + <groupId>org.apache.felix</groupId>
>>> > + <artifactId>org.apache.felix.scr.annotations</artifactId>
>>> > + </dependency>
>>> > +
>>> > + <!-- for tests -->
>>> > + <dependency>
>>> > + <groupId>junit</groupId>
>>> > + <artifactId>junit</artifactId>
>>> > + <scope>test</scope>
>>> > + </dependency>
>>> > + <dependency>
>>> > + <groupId>org.slf4j</groupId>
>>> > + <artifactId>slf4j-simple</artifactId>
>>> > + <scope>test</scope>
>>> > + </dependency>
>>> > +
>>> > + </dependencies>
>>> > +
>>> > +</project>
>>> >
>>> > Added:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > ---
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>>> (added)
>>> > +++
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>>> Thu Jul 7 07:38:24 2011
>>> > @@ -0,0 +1,132 @@
>>> > +package org.apache.stanbol.enhancer.webvie.fragment;
>>> > +
>>> > +import java.util.ArrayList;
>>> > +import java.util.Collections;
>>> > +import java.util.HashSet;
>>> > +import java.util.List;
>>> > +import java.util.Set;
>>> > +
>>> > +import org.apache.clerezza.rdf.core.access.TcManager;
>>> > +import org.apache.clerezza.rdf.core.serializedform.Serializer;
>>> > +import org.apache.felix.scr.annotations.Activate;
>>> > +import org.apache.felix.scr.annotations.Component;
>>> > +import org.apache.felix.scr.annotations.Reference;
>>> > +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.servicesapi.EnhancementJobManager;
>>> > +import org.apache.stanbol.enhancer.servicesapi.Store;
>>> > +import
>>> org.apache.stanbol.enhancer.webvie.resource.EnhancerVieRootResource;
>>> > +import org.osgi.framework.BundleContext;
>>> > +import org.osgi.service.component.ComponentContext;
>>> > +
>>> > +import freemarker.cache.ClassTemplateLoader;
>>> > +import freemarker.cache.TemplateLoader;
>>> > +
>>> > +/**
>>> > + * Statically define the list of available resources and providers to
>>> be contributed to the the Stanbol JAX-RS
>>> > + * Endpoint.
>>> > + */
>>> > +@Component(immediate = true, metatype = true)
>>> > +@Service
>>> > +public class EnhancerVieWebFragment implements WebFragment {
>>> > +
>>> > + private static final String NAME = "enhancervie";
>>> > +
>>> > + private static final String STATIC_RESOURCE_PATH =
>>> "/org/apache/stanbol/enhancer/webvie/static";
>>> > +
>>> > + private static final String TEMPLATE_PATH =
>>> "/org/apache/stanbol/enhancer/webvie/templates";
>>> > +
>>> > + private BundleContext bundleContext;
>>> > +
>>> > + @Reference
>>> > + TcManager tcManager;
>>> > +
>>> > + @Reference
>>> > + Store store;
>>> > +
>>> > + @Reference
>>> > + EnhancementJobManager jobManager;
>>> > +
>>> > + @Reference
>>> > + Serializer serializer;
>>> > +
>>> > + @Override
>>> > + public String getName() {
>>> > + return NAME;
>>> > + }
>>> > +
>>> > + @Activate
>>> > + protected void activate(ComponentContext ctx) {
>>> > + this.bundleContext = ctx.getBundleContext();
>>> > + }
>>> > +
>>> > + @Override
>>> > + public Set<Class<?>> getJaxrsResourceClasses() {
>>> > + Set<Class<?>> classes = new HashSet<Class<?>>();
>>> > + classes.add(EnhancerVieRootResource.class);
>>> > + return classes;
>>> > + }
>>> > +
>>> > + @Override
>>> > + public Set<Object> getJaxrsResourceSingletons() {
>>> > + return Collections.emptySet();
>>> > + }
>>> > +
>>> > + @Override
>>> > + public String getStaticResourceClassPath() {
>>> > + return STATIC_RESOURCE_PATH;
>>> > + }
>>> > +
>>> > + @Override
>>> > + public TemplateLoader getTemplateLoader() {
>>> > + return new ClassTemplateLoader(getClass(), TEMPLATE_PATH);
>>> > + }
>>> > +
>>> > + @Override
>>> > + public List<LinkResource> getLinkResources() {
>>> > + List<LinkResource> resources = new ArrayList<LinkResource>();
>>> > +// resources.add(new LinkResource("stylesheet",
>>> "lib/Aristo/jquery-ui-1.8.7.custom.css", this, 10));
>>> > + resources.add(new LinkResource("stylesheet",
>>> "lib/Smoothness/jquery.ui.all.css", this, 10)); // version 1.8.13
>>> > +// resources.add(new LinkResource("stylesheet",
>>> "lib/Aristo/jquery.ui.menu.css", this, 10));
>>> > + return resources;
>>> > + }
>>> > +
>>> > + @Override
>>> > + public List<ScriptResource> getScriptResources() {
>>> > + List<ScriptResource> resources = new
>>> ArrayList<ScriptResource>();
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/jquery-1.5.1.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/jquery-ui.1.9m5.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/underscore-min.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/backbone.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/vie.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/vie-containermanager.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/vie-collectionmanager.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/hallo/hallo.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/hallo/format.js", this, 10));
>>> > +
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/jquery.rdfquery.debug.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/vie2/vie2-latest.debug.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/vie2/connector/stanbol.js", this, 10));
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/vie2/mapping/person.js", this, 10));
>>> > +
>>> > + resources.add(new ScriptResource("text/javascript",
>>> "lib/annotate.js", this, 10));
>>> > +
>>> > + return resources;
>>> > + }
>>> > +
>>> > + @Override
>>> > + public List<NavigationLink> getNavigationLinks() {
>>> > + List<NavigationLink> links = new ArrayList<NavigationLink>();
>>> > + links.add(new NavigationLink("enhancervie", "/enhancer VIE",
>>> "/imports/enhancervieDescription.ftl", 20));
>>> > + return links;
>>> > + }
>>> > +
>>> > + @Override
>>> > + public BundleContext getBundleContext() {
>>> > + return bundleContext;
>>> > + }
>>> > +
>>> > +}
>>> >
>>> > Added:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > ---
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>>> (added)
>>> > +++
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>>> Thu Jul 7 07:38:24 2011
>>> > @@ -0,0 +1,27 @@
>>> > +package org.apache.stanbol.enhancer.webvie.resource;
>>> > +
>>> > +import static javax.ws.rs.core.MediaType.TEXT_HTML;
>>> > +
>>> > +import javax.ws.rs.GET;
>>> > +import javax.ws.rs.Path;
>>> > +import javax.ws.rs.Produces;
>>> > +
>>> > +import
>>> org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
>>> > +
>>> > +import com.sun.jersey.api.view.Viewable;
>>> > +
>>> > +/**
>>> > + * Adapter to add a VIE based interface for the Stanbol Enhancer
>>> > + * @author Szaby Gruenwald
>>> > + */
>>> > +@Path("/enhancervie")
>>> > +public class EnhancerVieRootResource extends BaseStanbolResource {
>>> > +
>>> > +
>>> > + @GET
>>> > + @Produces(TEXT_HTML + ";qs=2")
>>> > + public Viewable getView() {
>>> > + return new Viewable("index", this);
>>> > + }
>>> > +
>>> > +}
>>> >
>>> > Added:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > ---
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>>> (added)
>>> > +++
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>>> Thu Jul 7 07:38:24 2011
>>> > @@ -0,0 +1,677 @@
>>> > +# Annotate - a text enhancement interaction jQuery UI widget
>>> > +# (c) 2011 Szaby Gruenwald, IKS Consortium
>>> > +# Annotate may be freely distributed under the MIT license
>>> > +
>>> > +((jQuery) ->
>>> > + # The annotate.js widget
>>> > + #
>>> > +
>>> > + # define namespaces
>>> > + ns =
>>> > + rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
>>> > + enhancer: 'http://fise.iks-project.eu/ontology/'
>>> > + dc: 'http://purl.org/dc/terms/'
>>> > + rdfs: 'http://www.w3.org/2000/01/rdf-schema#'
>>> > +
>>> > + ANTT = ANTT or {}
>>> > + Stanbol = Stanbol or {}
>>> > +
>>> > + # filter for TextAnnotations
>>> > + Stanbol.getTextAnnotations = (enhRdf) ->
>>> > + res = _(enhRdf).map((obj, key) ->
>>> > + obj.id = key
>>> > + obj
>>> > + )
>>> > + .filter (e) ->
>>> > + e["#{ns.rdf}type"]
>>> > + .map((x) -> x.value)
>>> > + .indexOf("#{ns.enhancer}TextAnnotation") != -1
>>> > + res = _(res).sortBy (e) ->
>>> > + conf = Number e["#{ns.enhancer}confidence"][0].value if
>>> e["#{ns.enhancer}confidence"]
>>> > + -1 * conf
>>> > +
>>> > + _(res).map (s)->
>>> > + new Stanbol.TextEnhancement s, enhRdf
>>> > +
>>> > + # filter the entityManager for TextAnnotations
>>> > + Stanbol.getEntityAnnotations = (enhRdf) ->
>>> > + _(enhRdf)
>>> > + .map((obj, key) ->
>>> > + obj.id = key
>>> > + obj
>>> > + )
>>> > + .filter (e) ->
>>> > + e["#{ns.rdf}type"]
>>> > + .map((x) -> x.value)
>>> > + .indexOf("#{ns.enhancer}EntityAnnotation") != -1
>>> > +
>>> > + # Get the label in the user's language or the first one from a VIE
>>> entity
>>> > + ANTT.getRightLabel = (entity) ->
>>> > + labelMap = {}
>>> > + for label in _(entity["#{ns.rdfs}label"]).flatten()
>>> > + cleanLabel = label.value
>>> > + if cleanLabel.lastIndexOf "@" is cleanLabel.length - 3
>>> > + cleanLabel = cleanLabel.substring 0, cleanLabel.length
>>> - 3
>>> > + labelMap[label["xml:lang"]|| "_"] = cleanLabel
>>> > + userLang = window.navigator.language.split("-")[0]
>>> > + # Return the first best label
>>> > + labelMap[userLang] or labelMap["_"] or labelMap["en"]
>>> > +
>>> > + # Generic API for a TextEnhancement
>>> > + # A TextEnhancement object has the methods for getting generic
>>> > + # text-enhancement-specific properties.
>>> > + # TODO Place it into a global Stanbol object.
>>> > + Stanbol.TextEnhancement = (enhancement, enhRdf) ->
>>> > + @_enhancement = enhancement
>>> > + @_enhRdf = enhRdf
>>> > + @id = @_enhancement.id
>>> > + Stanbol.TextEnhancement.prototype =
>>> > + # the text the annotation is for
>>> > + getSelectedText: ->
>>> > + @_vals("#{ns.enhancer}selected-text")[0]
>>> > + # confidence value
>>> > + getConfidence: ->
>>> > + @_vals("#{ns.enhancer}confidence")[0]
>>> > + # get Entities suggested for the text enhancement (if any)
>>> > + getEntityEnhancements: ->
>>> > + rawList = _(Stanbol.getEntityAnnotations @_enhRdf ).filter
>>> (ann) =>
>>> > + relations = _(ann["#{ns.dc}relation"])
>>> > + .map (e) -> e.value
>>> > + if (relations.indexOf @_enhancement.id) isnt -1 then
>>> true
>>> > + else false
>>> > + _(rawList).map (ee) =>
>>> > + new Stanbol.EntityEnhancement ee, @
>>> > + # The type of the entity suggested (e.g. person, location,
>>> organization)
>>> > + getType: ->
>>> > + @_vals("#{ns.dc}type")[0]
>>> > + # Optional, not used
>>> > + getContext: ->
>>> > + @_vals("#{ns.enhancer}selection-context")[0]
>>> > + # start position in the original text
>>> > + getStart: ->
>>> > + Number @_vals("#{ns.enhancer}start")[0]
>>> > + # end position in the original text
>>> > + getEnd: ->
>>> > + Number @_vals("#{ns.enhancer}end")[0]
>>> > + # Optional
>>> > + getOrigText: ->
>>> > + ciUri = @_vals("#{ns.enhancer}extracted-from")[0]
>>> > + @_enhRdf[ciUri]["
>>> http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent
>>> "][0].value
>>> > + _vals: (key) ->
>>> > + _(@_enhancement[key])
>>> > + .map (x) -> x.value
>>> > +
>>> > + # Generic API for an EntityEnhancement. This is the implementation
>>> for Stanbol
>>> > + Stanbol.EntityEnhancement = (ee, textEnh) ->
>>> > + @_textEnhancement = textEnh
>>> > + $.extend @, ee
>>> > + Stanbol.EntityEnhancement.prototype =
>>> > + getLabel: ->
>>> > + @_vals("#{ns.enhancer}entity-label")[0]
>>> > + getUri: ->
>>> > + @_vals("#{ns.enhancer}entity-reference")[0]
>>> > + getTextEnhancement: ->
>>> > + @_textEnhancement
>>> > + getTypes: ->
>>> > + @_vals("#{ns.enhancer}entity-type")
>>> > + getConfidence: ->
>>> > + Number @_vals("#{ns.enhancer}confidence")[0]
>>> > + _vals: (key) ->
>>> > + _(@[key]).map (x) -> x.value
>>> > +
>>> > + # get or create a dom element containing only the occurrence of the
>>> found entity
>>> > + ANTT.getOrCreateDomElement = (element, text, options = {}) ->
>>> > + # Find occurrence indexes of s in str
>>> > + occurrences = (str, s) ->
>>> > + res = []
>>> > + last = 0
>>> > + while str.indexOf(s, last + 1) isnt -1
>>> > + next = str.indexOf s, last+1
>>> > + res.push next
>>> > + last = next
>>> > +
>>> > + # Find the nearest number among the
>>> > + nearest = (arr, nr) ->
>>> > + _(arr).sortedIndex nr
>>> > +
>>> > + # Nearest position
>>> > + nearestPosition = (str, s, ind) ->
>>> > + arr = occurrences(str,s)
>>> > + i1 = nearest arr, ind
>>> > + if arr.length is 1
>>> > + arr[0]
>>> > + else if i1 is arr.length
>>> > + arr[i1-1]
>>> > + else
>>> > + i0 = i1-1
>>> > + d0 = ind - arr[i0]
>>> > + d1 = arr[i1] - ind
>>> > + if d1 > d0 then arr[i0]
>>> > + else arr[i1]
>>> > +
>>> > + domEl = element
>>> > + textContentOf = (element) -> $(element).text().replace(/\n/g, "
>>> ")
>>> > + # find the text node
>>> > + if textContentOf(element).indexOf(text) is -1
>>> > + throw "'#{text}' doesn't appear in the text block."
>>> > + return $()
>>> > + start = options.start +
>>> > + textContentOf(element).indexOf textContentOf(element).trim()
>>> > + # Correct small position errors
>>> > + start = nearestPosition textContentOf(element), text, start
>>> > + pos = 0
>>> > + while textContentOf(domEl).indexOf(text) isnt -1 and
>>> domEl.nodeName isnt '#text'
>>> > + domEl = _(domEl.childNodes).detect (el) ->
>>> > + p = textContentOf(el).lastIndexOf text
>>> > + if p >= start - pos
>>> > + true
>>> > + else
>>> > + pos += textContentOf(el).length
>>> > + false
>>> > +
>>> > + if options.createMode is "existing" and
>>> textContentOf($(domEl).parent()) is text
>>> > + return $(domEl).parent()[0]
>>> > + else
>>> > + pos = start - pos
>>> > + len = text.length
>>> > + textToCut = textContentOf(domEl).substring(pos, pos+len)
>>> > + if textToCut is text
>>> > + domEl.splitText pos + len
>>> > + newElement = document.createElement
>>> options.createElement or 'span'
>>> > + newElement.innerHTML = text
>>> > + $(domEl).parent()[0].replaceChild newElement,
>>> domEl.splitText pos
>>> > + $ newElement
>>> > + else
>>> > + console.warn "dom element creation problem:
>>> #{textToCut} isnt #{text}"
>>> > +
>>> > + # Give back the last part of a uri for fallback label creation
>>> > + ANTT.uriSuffix = (uri) ->
>>> > + res = uri.substring uri.lastIndexOf("#") + 1
>>> > + res.substring res.lastIndexOf("/") + 1
>>> > +
>>> > + # jquery events cloning method
>>> > + ANTT.cloneCopyEvent = (src, dest) ->
>>> > + if dest.nodeType isnt 1 or not jQuery.hasData src
>>> > + return
>>> > +
>>> > + internalKey = $.expando
>>> > + oldData = $.data src
>>> > + curData = $.data dest, oldData
>>> > +
>>> > + # Switch to use the internal data object, if it exists, for the
>>> next
>>> > + # stage of data copying
>>> > + if oldData = oldData[internalKey]
>>> > + events = oldData.events
>>> > + curData = curData[ internalKey ] = jQuery.extend({},
>>> oldData);
>>> > +
>>> > + if events
>>> > + delete curData.handle
>>> > + curData.events = {}
>>> > +
>>> > + `for ( var type in events ) {
>>> > + for ( var i = 0, l = events[ type ].length; i < l;
>>> i++ ) {
>>> > + jQuery.event.add( dest, type + ( events[ type
>>> ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type
>>> ][ i ], events[ type ][ i ].data );
>>> > + }
>>> > + }`
>>> > + null
>>> > +
>>> > + ######################################################
>>> > + # Annotate widget
>>> > + # makes a content dom element interactively annotatable
>>> > + ######################################################
>>> > + jQuery.widget 'IKS.annotate',
>>> > + __widgetName: "IKS.annotate"
>>> > + options:
>>> > + autoAnalyze: false
>>> > + debug: false
>>> > + # namespaces necessary for the widget configuration
>>> > + ns:
>>> > + dbpedia: "http://dbpedia.org/ontology/"
>>> > + skos: "http://www.w3.org/2004/02/skos/core#"
>>> > + # Give a label to your expected enhancement types
>>> > + getTypes: ->
>>> > + [
>>> > + uri: "#{@ns.dbpedia}Place"
>>> > + label: 'Place'
>>> > + ,
>>> > + uri: "#{@ns.dbpedia}Person"
>>> > + label: 'Person'
>>> > + ,
>>> > + uri: "#{@ns.dbpedia}Organisation"
>>> > + label: 'Organisation'
>>> > + ,
>>> > + uri: "#{@ns.skos}Concept"
>>> > + label: 'Concept'
>>> > + ]
>>> > + # Give a label to the sources the entities come from
>>> > + getSources: ->
>>> > + [
>>> > + uri: "http://dbpedia.org/resource/"
>>> > + label: "dbpedia"
>>> > + ,
>>> > + uri: "http://sws.geonames.org/"
>>> > + label: "geonames"
>>> > + ]
>>> > + _create: ->
>>> > + widget = @
>>> > + # logger can be turned on and off. It will show the real
>>> caller line in the log
>>> > + @_logger = if @options.debug then console else
>>> > + info: ->
>>> > + warn: ->
>>> > + error: ->
>>> > + # widget.entityCache.get(uri, cb) will get and cache the
>>> entity from an entityhub
>>> > + @entityCache = window.entityCache =
>>> > + _entities: {}
>>> > + # calling the get with a scope and callback will call
>>> cb(entity) with the scope as soon it's available.'
>>> > + get: (uri, scope, cb) ->
>>> > + # If entity is stored in the cache already just
>>> call cb
>>> > + if @_entities[uri] and @_entities[uri].status is
>>> "done"
>>> > + cb.apply scope, [@_entities[uri].entity]
>>> > + # If the entity is new to the cache
>>> > + else if not @_entities[uri]
>>> > + # create cache entry
>>> > + @_entities[uri] =
>>> > + status: "pending"
>>> > + uri: uri
>>> > + cache = @
>>> > + # make a request to the entity hub
>>> > + widget.options.connector.queryEntityHub uri,
>>> (entity) ->
>>> > + if not entity.status
>>> > + if entity.id isnt uri
>>> > + widget._logger.warn "wrong
>>> callback", uri, entity.id
>>> > + cache._entities[uri].entity = entity
>>> > + cache._entities[uri].status = "done"
>>> > + $(cache._entities[uri]).trigger "done",
>>> entity
>>> > + else
>>> > + widget._logger.warn "error getting
>>> entity", uri, entity
>>> > + if @_entities[uri] and @_entities[uri].status is
>>> "pending"
>>> > + $( @_entities[uri] )
>>> > + .bind "done", (event, entity) ->
>>> > + cb.apply scope, [entity]
>>> > + if @options.autoAnalyze
>>> > + @enable()
>>> > +
>>> > + # analyze the widget element and show text enhancements
>>> > + enable: (cb) ->
>>> > + analyzedNode = @element
>>> > + # the analyzedDocUri makes the connection between a
>>> document state and
>>> > + # the annotations to it. We have to clean up the
>>> annotations to any
>>> > + # old document state
>>> > +
>>> > + @options.connector.analyze @element,
>>> > + success: (rdf) =>
>>> > + # Get enhancements
>>> > + rdfJson = rdf.databank.dump()
>>> > +
>>> > + textAnnotations =
>>> Stanbol.getTextAnnotations(rdfJson)
>>> > + # Remove all textAnnotations without a selected
>>> text property
>>> > + textAnnotations = _(textAnnotations)
>>> > + .filter (textEnh) ->
>>> > + if textEnh.getSelectedText and
>>> textEnh.getSelectedText()
>>> > + true
>>> > + else
>>> > + false
>>> > + _(textAnnotations)
>>> > + .each (s) =>
>>> > + @_logger.info s._enhancement,
>>> > + 'confidence', s.getConfidence(),
>>> > + 'selectedText', s.getSelectedText(),
>>> > + 'type', s.getType(),
>>> > + 'EntityEnhancements',
>>> s.getEntityEnhancements()
>>> > + # Process the text enhancements
>>> > + @processTextEnhancement s, analyzedNode
>>> > + # trigger 'done' event with success = true
>>> > + @_trigger "done", true
>>> > + if typeof cb is "function"
>>> > + cb(true)
>>> > + # Remove all not accepted text enhancement widgets
>>> > + disable: ->
>>> > + $( ':IKS-annotationSelector', @element ).each () ->
>>> > + $(@).annotationSelector 'disable'
>>> > +
>>> > + # processTextEnhancement deals with one TextEnhancement in an
>>> ancestor element of its occurrence
>>> > + processTextEnhancement: (textEnh, parentEl) ->
>>> > + if not textEnh.getSelectedText()
>>> > + console.warn "textEnh", textEnh, "doesn't have
>>> selected-text!"
>>> > + return
>>> > + el = $ ANTT.getOrCreateDomElement parentEl[0],
>>> textEnh.getSelectedText(),
>>> > + createElement: 'span'
>>> > + createMode: 'existing'
>>> > + context: textEnh.getContext()
>>> > + start: textEnh.getStart()
>>> > + end: textEnh.getEnd()
>>> > + sType = textEnh.getType()
>>> > + widget = @
>>> > + el.addClass('entity')
>>> > + .addClass ANTT.uriSuffix(sType).toLowerCase()
>>> > + if textEnh.getEntityEnhancements().length
>>> > + el.addClass "withSuggestions"
>>> > + for eEnh in textEnh.getEntityEnhancements()
>>> > + eEnhUri = eEnh.getUri()
>>> > + @entityCache.get eEnhUri, eEnh, (entity) ->
>>> > + if this.getUri() isnt entity.id
>>> > + widget._logger.warn "wrong callback",
>>> entity.id, this.getUri()
>>> > +# widget._logger.info "entity for",
>>> textEnh.getSelectedText(), this.getUri(), entity
>>> > + # Create widget to select from the suggested entities
>>> > + options =
>>> > + cache: @entityCache
>>> > + $.extend options, @options
>>> > + el.annotationSelector( options )
>>> > + .annotationSelector 'addTextEnhancement', textEnh
>>> > +
>>> > + ######################################################
>>> > + # AnnotationSelector widget
>>> > + # the annotationSelector makes an annotated word interactive
>>> > + ######################################################
>>> > + ANTT.annotationSelector =
>>> > + jQuery.widget 'IKS.annotationSelector',
>>> > + # just for debugging and understanding
>>> > + __widgetName: "IKS.annotationSelector"
>>> > + options:
>>> > + ns:
>>> > + dbpedia: "http://dbpedia.org/ontology/"
>>> > + skos: "http://www.w3.org/2004/02/skos/core#"
>>> > + getTypes: ->
>>> > + [
>>> > + uri: "#{@ns.dbpedia}Place"
>>> > + label: 'Place'
>>> > + ,
>>> > + uri: "#{@ns.dbpedia}Person"
>>> > + label: 'Person'
>>> > + ,
>>> > + uri: "#{@ns.dbpedia}Organisation"
>>> > + label: 'Organisation'
>>> > + ,
>>> > + uri: "#{@ns.skos}Concept"
>>> > + label: 'Concept'
>>> > + ]
>>> > + getSources: ->
>>> > + [
>>> > + uri: "http://dbpedia.org/resource/"
>>> > + label: "dbpedia"
>>> > + ,
>>> > + uri: "http://sws.geonames.org/"
>>> > + label: "geonames"
>>> > + ]
>>> > +
>>> > + _create: ->
>>> > + @element.click =>
>>> > + if not @dialog
>>> > + @_createDialog()
>>> > + setTimeout((=> @dialog.open()), 220)
>>> > + # Collect all EntityEnhancements for all the
>>> TextEnhancements
>>> > + # on the selected node.
>>> > + eEnhancements = []
>>> > + for textEnh in @textEnhancements
>>> > + for enhancement in
>>> textEnh.getEntityEnhancements()
>>> > + eEnhancements.push enhancement
>>> > + # filter enhancements with the same uri
>>> > + # this is necessary because of a bug in stanbol
>>> that creates
>>> > + # duplicate enhancements.
>>> > + #
>>> https://issues.apache.org/jira/browse/STANBOL-228
>>> > + _tempUris = []
>>> > + eEnhancements = _(eEnhancements).filter (eEnh) ->
>>> > + uri = eEnh.getUri()
>>> > + if _tempUris.indexOf(uri) is -1
>>> > + _tempUris.push uri
>>> > + true
>>> > + else
>>> > + false
>>> > + @entityEnhancements = eEnhancements
>>> > +
>>> > + @_createSearchbox()
>>> > + if @entityEnhancements.length > 0
>>> > + @_createMenu() if @menu is undefined
>>> > + else @searchEntryField.find('.search').focus 100
>>> > + @_logger = if @options.debug then console else
>>> > + info: ->
>>> > + warn: ->
>>> > + error: ->
>>> > + _destroy: ->
>>> > + if @menu
>>> > + @menu.destroy()
>>> > + @menu.element.remove()
>>> > + delete @menu
>>> > + if @dialog
>>> > + @dialog.destroy()
>>> > + @dialog.element.remove()
>>> > + @dialog.uiDialogTitlebar.remove()
>>> > + delete @dialog
>>> > +
>>> > + # Produce type label list out of a uri list.
>>> > + # Filtered by the @options.types list
>>> > + _typeLabels: (types) ->
>>> > + knownMapping = @options.getTypes()
>>> > + allKnownPrefixes = _(knownMapping).map (x) -> x.uri
>>> > + knownPrefixes = _.intersect allKnownPrefixes, types
>>> > + _(knownPrefixes).map (key) =>
>>> > + foundPrefix = _(knownMapping).detect (x) -> x.uri is
>>> key
>>> > + foundPrefix.label
>>> > +
>>> > + # make a label for the entity source based on
>>> options.getSources()
>>> > + _sourceLabel: (src) ->
>>> > + sources = @options.getSources()
>>> > + sourceObj = _(sources).detect (s) -> src.indexOf(s.uri)
>>> isnt -1
>>> > + if sourceObj
>>> > + sourceObj.label
>>> > + else
>>> > + src.split("/")[2]
>>> > +
>>> > + # create dialog widget
>>> > + _createDialog: ->
>>> > + label = @element.text()
>>> > + dialogEl = $("<div><span
>>> class='entity-link'></span></div>")
>>> > + .attr( "tabIndex", -1)
>>> > + .addClass()
>>> > + .keydown( (event) =>
>>> > + if not event.isDefaultPrevented() and event.keyCode and
>>> event.keyCode is $.ui.keyCode.ESCAPE
>>> > + @close event
>>> > + event.preventDefault()
>>> > + )
>>> > + .bind('dialogblur', (event) =>
>>> > + @_logger.info 'dialog dialogblur'
>>> > + @close(event)
>>> > + )
>>> > + .bind('blur', (event) =>
>>> > + @_logger.info 'dialog blur'
>>> > + @close(event)
>>> > + )
>>> > + .appendTo( $("body")[0] )
>>> > + widget = @
>>> > + dialogEl.dialog
>>> > + width: 400
>>> > + title: label
>>> > + close: (event, ui) =>
>>> > + @close(event)
>>> > + autoOpen: false
>>> > + open: (e, ui) ->
>>> > + $.data(this, 'dialog').uiDialog.position {
>>> > + of: widget.element
>>> > + my: "left top"
>>> > + at: "left bottom"
>>> > + collision: "none"}
>>> > + @dialog = dialogEl.data 'dialog'
>>> > + @dialog.uiDialogTitlebar.hide()
>>> > + @_logger.info "dialog widget:", @dialog
>>> > + @dialog.element.focus(100)
>>> > + window.d = @dialog
>>> > + @_insertLink()
>>> > + @_updateTitle()
>>> > + @_setButtons()
>>> > +
>>> > + # If annotation is already made insert a link to the entity
>>> > + _insertLink: ->
>>> > + if @isAnnotated() and @dialog
>>> > + $("Annotated: <a href='#{@linkedEntity.uri}'
>>> target='_blank'>
>>> > + #{@linkedEntity.label} @
>>> #{@_sourceLabel(@linkedEntity.uri)}</a><br/>")
>>> > + .appendTo $( '.entity-link', @dialog.element )
>>> > + # create/update the dialog button row
>>> > + _setButtons: ->
>>> > + @dialog.element.dialog 'option', 'buttons',
>>> > + rem:
>>> > + text: if @isAnnotated() then 'Remove' else
>>> 'Decline'
>>> > + click: (event) =>
>>> > + @remove event
>>> > + Cancel: =>
>>> > + @close()
>>> > +
>>> > + # remove textEnhancement/annotation, replace the separate html
>>> > + # element with the plain text and close the dialog
>>> > + remove: (event) ->
>>> > + el = @element.parent()
>>> > + if not @isAnnotated() and @textEnhancements
>>> > + @_trigger 'decline', event,
>>> > + textEnhancements: @textEnhancements
>>> > + else
>>> > + @_trigger 'remove', event,
>>> > + textEnhancement: @_acceptedTextEnhancement
>>> > + entityEnhancement: @_acceptedEntityEnhancement
>>> > + linkedEntity: @linkedEntity
>>> > + @destroy()
>>> > + if @element.qname().name isnt '#text'
>>> > + @element.replaceWith document.createTextNode
>>> @element.text()
>>> > +
>>> > + # Remove the widget if not annotated.
>>> > + disable: ->
>>> > + if not @isAnnotated() and @element.qname().name isnt
>>> '#text'
>>> > + @element.replaceWith document.createTextNode
>>> @element.text()
>>> > +
>>> > + # tells if this is an annotated dom element (not a highlighted
>>> textEnhancement only)
>>> > + isAnnotated: ->
>>> > + if @element.attr 'about' then true else false
>>> > +
>>> > + # Place the annotation on the DOM element (about and typeof
>>> attributes)
>>> > + annotate: (entityEnhancement, styleClass) ->
>>> > + entityUri = entityEnhancement.getUri()
>>> > + entityType =
>>> entityEnhancement.getTextEnhancement().getType()
>>> > + entityHtml = @element.html()
>>> > + # We ignore the old style classes
>>> > + # entityClass = @element.attr 'class'
>>> > + sType = entityEnhancement.getTextEnhancement().getType()
>>> > + entityClass = 'entity ' +
>>> ANTT.uriSuffix(sType).toLowerCase()
>>> > + newElement = $ "<a href='#{entityUri}'
>>> > + about='#{entityUri}'
>>> > + typeof='#{entityType}'
>>> > + class='#{entityClass}'>#{entityHtml}</a>"
>>> > + ANTT.cloneCopyEvent @element[0], newElement[0]
>>> > + @linkedEntity =
>>> > + uri: entityUri
>>> > + type: entityType
>>> > + label: entityEnhancement.getLabel()
>>> > + @element.replaceWith newElement
>>> > + @element = newElement.addClass styleClass
>>> > + @_logger.info "created annotation in", @element
>>> > + @_updateTitle()
>>> > + @_insertLink()
>>> > + @_acceptedTextEnhancement =
>>> entityEnhancement.getTextEnhancement()
>>> > + @_acceptedEntityEnhancement = entityEnhancement
>>> > + @_trigger 'select', null,
>>> > + linkedEntity: @linkedEntity
>>> > + textEnhancement: entityEnhancement.getTextEnhancement()
>>> > + entityEnhancement: entityEnhancement
>>> > + # closing the widget
>>> > + close: ->
>>> > + @destroy()
>>> > + _updateTitle: ->
>>> > + if @dialog
>>> > + if @isAnnotated()
>>> > + title = "#{@linkedEntity.label} <small>@
>>> #{@_sourceLabel(@linkedEntity.uri)}</small>"
>>> > + else
>>> > + title = @element.text()
>>> > + @dialog._setOption 'title', title
>>> > +
>>> > + # create menu and add to the dialog
>>> > + _createMenu: ->
>>> > + ul = $('<ul></ul>')
>>> > + .appendTo( @dialog.element )
>>> > + @_renderMenu ul, @entityEnhancements
>>> > + @menu = ul
>>> > + .menu({
>>> > + select: (event, ui) =>
>>> > + @_logger.info "selected menu item", ui.item
>>> > + @annotate ui.item.data('enhancement'),
>>> 'acknowledged'
>>> > + @close(event)
>>> > + blur: (event, ui) =>
>>> > + @_logger.info 'menu.blur()', ui.item
>>> > + focus: (event, ui) =>
>>> > + @_logger.info 'menu.focus()', ui.item
>>> > + # show preview
>>> > + @_entityPreview ui.item
>>> > + })
>>> > + .bind('blur', (event, ui) ->
>>> > + @_logger.info 'menu blur', ui
>>> > + )
>>> > + .bind('menublur', (event, ui) ->
>>> > + @_logger.info 'menu menublur', ui.item
>>> > + )
>>> > + .focus(150)
>>> > + .data 'menu'
>>> > +
>>> > + # Rendering menu for the EntityEnhancements suggested for the
>>> selected text
>>> > + _renderMenu: (ul, entityEnhancements) ->
>>> > + entityEnhancements = _(entityEnhancements).sortBy (ee) ->
>>> -1 * ee.getConfidence()
>>> > + @_renderItem ul, enhancement for enhancement in
>>> entityEnhancements
>>> > + @_logger.info 'rendered menu for the elements',
>>> entityEnhancements
>>> > + _renderItem: (ul, eEnhancement) ->
>>> > + label = eEnhancement.getLabel().replace /^\"|\"$/g, ""
>>> > + type = @_typeLabels eEnhancement.getTypes()
>>> > + source = @_sourceLabel eEnhancement.getUri()
>>> > + active = if @linkedEntity and eEnhancement.getUri() is
>>> @linkedEntity.uri
>>> > + " class='ui-state-active'"
>>> > + else ""
>>> > + $("<li#{active}><a href='#'>#{label} <small>(#{type} from
>>> #{source})</small></a></li>")
>>> > + .data('enhancement', eEnhancement)
>>> > + .appendTo ul
>>> > +
>>> > + # Render search box with autocompletion for finding the right
>>> entity
>>> > + _createSearchbox: ->
>>> > + # Show an input box for autocompleted search
>>> > + @searchEntryField = $('<span style="background:
>>> fff;"><label for="search">Search:</label> <input id="search"
>>> class="search"></span>')
>>> > + .appendTo @dialog.element
>>> > + sugg = @textEnhancements[0]
>>> > + widget = @
>>> > + $( '.search', @searchEntryField )
>>> > + .autocomplete
>>> > + # Define source method. TODO make independent from
>>> stanbol.
>>> > + source: (req, resp) ->
>>> > + widget._logger.info "req:", req
>>> > + widget.options.connector.findEntity
>>> "#{req.term}#{'*' if req.term.length > 3}", (entityList) ->
>>> > + widget._logger.info "resp:", _(entityList).map
>>> (ent) ->
>>> > + ent.id
>>> > + res = for i, entity of entityList
>>> > + {
>>> > + key: entity.id
>>> > + label: "#{ANTT.getRightLabel entity} @
>>> #{widget._sourceLabel entity.id}"
>>> > + _label: ANTT.getRightLabel entity
>>> > + getLabel: -> @_label
>>> > + getUri: -> @key
>>> > + # To rethink: The type of the annotation
>>> (person, place, org)
>>> > + # should come from the search result, not
>>> from the first textEnhancement
>>> > + _tEnh: sugg
>>> > + getTextEnhancement: -> @_tEnh
>>> > + }
>>> > + resp res
>>> > + # An entity selected, annotate
>>> > + select: (e, ui) =>
>>> > + @annotate ui.item, "acknowledged"
>>> > + @_logger.info "autocomplete.select", e.target, ui
>>> > + focus: (e, ui) =>
>>> > + @_logger.info "autocomplete.focus", e.target, ui
>>> > + @_entityPreview ui.item
>>> > + .focus(200)
>>> > + .blur (e, ui) =>
>>> > + @_dialogCloseTimeout = setTimeout ( => @close()), 200
>>> > + @_logger.info "show searchbox"
>>> > + # Show preview of a hovered item
>>> > + _entityPreview: _.throttle(( (item) ->
>>> > + @_logger.info "Show preview for", item
>>> > + ), 1500)
>>> > +
>>> > + # add a textEnhancement that gets shown when the dialog is
>>> rendered
>>> > + addTextEnhancement: (textEnh) ->
>>> > + @options.textEnhancements = @options.textEnhancements or []
>>> > + @options.textEnhancements.push textEnh
>>> > + @textEnhancements = @options.textEnhancements
>>> > +
>>> > + window.ANTT = ANTT
>>> > +) jQuery
>>> >
>>> > Added:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > Binary file - no diff available.
>>> >
>>> > Propchange:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
>>> >
>>> ------------------------------------------------------------------------------
>>> > svn:mime-type = application/octet-stream
>>> >
>>> > Added:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > Binary file - no diff available.
>>> >
>>> > Propchange:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
>>> >
>>> ------------------------------------------------------------------------------
>>> > svn:mime-type = application/octet-stream
>>> >
>>> > Added:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > Binary file - no diff available.
>>> >
>>> > Propchange:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
>>> >
>>> ------------------------------------------------------------------------------
>>> > svn:mime-type = application/octet-stream
>>> >
>>> > Added:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > Binary file - no diff available.
>>> >
>>> > Propchange:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
>>> >
>>> ------------------------------------------------------------------------------
>>> > svn:mime-type = application/octet-stream
>>> >
>>> > Added:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > Binary file - no diff available.
>>> >
>>> > Propchange:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
>>> >
>>> ------------------------------------------------------------------------------
>>> > svn:mime-type = application/octet-stream
>>> >
>>> > Added:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
>>> > URL:
>>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png?rev=1143692&view=auto
>>> >
>>> ==============================================================================
>>> > Binary file - no diff available.
>>> >
>>> > Propchange:
>>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
>>> >
>>> ------------------------------------------------------------------------------
>>> > svn:mime-type = application/octet-stream
>>> >
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> Fabian
>>>
>>
>>
>
--
Fabian
Re: svn commit: r1143692 [1/10] - in /incubator/stanbol/trunk/commons/web/webvie:
./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/stanbol/ src/main/java/org/apache/stanbol/enhancer/ src/main/java
Posted by Szabolcs Grünwald <sz...@web.de>.
Forgot to mention the dependency on the hallo.coffee rich-text editor (
https://github.com/bergie/hallo)
2011/7/8 Szabolcs Grünwald <sz...@web.de>
> Right, I apologize..
>
> So let me describe shortly what I was working on and committed here.
>
> Similar to the web ui at <stanboluri>/engines, this bundle gives you an
> access to the enhancer engines with the following differences:
>
> - it uses the restful endpoint to communicate
> - Shows the enhancements directly in the text and in the dom.
> - It demonstrates that the text can be changed directly on the page for
> later storage
>
> For reaching this I implemented a jquery ui widget (annotate.coffee). This
> widget is meant to be independent from stanbol so after some further
> refactoring it will be possible to connect it to other enhancer-entityhub
> backends simply by implementing connectors and two classes, one for
> EntityEnancements, one for TextEnhancements.
>
> Dependencies of the annotate widget are
>
> - jquery 1.6+
> - jquery ui 1.9m5+ (using jquery-ui.menu.js which is not yet part of
> 1.8)
> - vie2.connectors.stanbol (I plan to refactor this to make the
> connector independent of vie2)
>
> I created following JIRA issue for this:
> https://issues.apache.org/jira/browse/STANBOL-256
>
> Peace,
> Szaby
>
> On 8 July 2011 10:02, Fabian Christ <ch...@googlemail.com> wrote:
>
>> Hi Szaby,
>>
>> thank you for this contribution but could you please write a few lines
>> to the list what this is about?
>>
>> And please open JIRA issues for such things where you describe the
>> task that you are working on - this makes it easier for others to
>> follow what happens. Then mention the STANBOL-XXX issue identifier in
>> the commit message and the commit is automatically related to the
>> issue in JIRA.
>>
>> https://issues.apache.org/jira/browse/STANBOL
>>
>> Best,
>> - Fabian
>>
>> 2011/7/7 <sz...@apache.org>:
>> > Author: szabyg
>> > Date: Thu Jul 7 07:38:24 2011
>> > New Revision: 1143692
>> >
>> > URL: http://svn.apache.org/viewvc?rev=1143692&view=rev
>> > Log:
>> > First version of the webvie user interface, based on hallo.coffee editor
>> and the annotate.coffee widget.
>> > See also https://github.com/szabyg/stanbol-webvie
>> >
>> > Added:
>> > incubator/stanbol/trunk/commons/web/webvie/
>> > incubator/stanbol/trunk/commons/web/webvie/.svnignore
>> > incubator/stanbol/trunk/commons/web/webvie/README.md
>> > incubator/stanbol/trunk/commons/web/webvie/pom.xml
>> > incubator/stanbol/trunk/commons/web/webvie/src/
>> > incubator/stanbol/trunk/commons/web/webvie/src/main/
>> > incubator/stanbol/trunk/commons/web/webvie/src/main/java/
>> > incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/
>> > incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>> > incubator/stanbol/trunk/commons/web/webvie/src/main/resources/
>> > incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery-ui-1.8.7.custom.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery.ui.menu.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_75_ffffff_40x100.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_65_ffffff_1x400.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_dadada_1x400.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_222222_256x240.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_2e83ff_256x240.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_454545_256x240.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_888888_256x240.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_cd0a0a_256x240.png
>> (with props)
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery-ui-1.8.13.custom.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.accordion.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.all.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.autocomplete.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.base.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.button.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.core.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.datepicker.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.dialog.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.progressbar.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.resizable.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.selectable.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.slider.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.tabs.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.theme.css
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone-min.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/format.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/hallo.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-1.5.1.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-ui.1.9m5.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.debug.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.min.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/underscore-min.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-collectionmanager.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-containermanager.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/dbpedia.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/opencalais.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/rdfa.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/semantictweet.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/stanbol.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/zemanta.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/organization.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/person.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/place.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/task.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/thing.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/vie2-latest.debug.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/test.js
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/enhancervieDescription.ftl
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
>> >
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/index.ftl
>> > incubator/stanbol/trunk/commons/web/webvie/src/test/
>> > incubator/stanbol/trunk/commons/web/webvie/src/test/java/
>> > incubator/stanbol/trunk/commons/web/webvie/src/test/resources/
>> >
>> > Added: incubator/stanbol/trunk/commons/web/webvie/.svnignore
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/.svnignore?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > --- incubator/stanbol/trunk/commons/web/webvie/.svnignore (added)
>> > +++ incubator/stanbol/trunk/commons/web/webvie/.svnignore Thu Jul 7
>> 07:38:24 2011
>> > @@ -0,0 +1,2 @@
>> > +*.sh
>> > +sc
>> >
>> > Added: incubator/stanbol/trunk/commons/web/webvie/README.md
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/README.md?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > --- incubator/stanbol/trunk/commons/web/webvie/README.md (added)
>> > +++ incubator/stanbol/trunk/commons/web/webvie/README.md Thu Jul 7
>> 07:38:24 2011
>> > @@ -0,0 +1,62 @@
>> > +VIE based Stanbol Enhancer UI
>> > +=============================
>> > +
>> > +Adapter to add a VIE based interface for the Stanbol Enhancer
>> > +
>> > +Deploy
>> > +------
>> > +
>> > +After building stanbol in a different folder you can build and deploy
>> this bundle by using the following command:
>> > +
>> > + mvn install -DskipTests -PinstallBundle -Dsling.url=
>> http://localhost:8080/system/console
>> > +
>> > +Development Guide
>> > +=================
>> > +
>> > +The widget development is done in CoffeeScript. Use the following
>> command to
>> > +automatically compile the script in the background
>> > +
>> > + coffee -c -w -o lib annotate.coffee
>> > +
>> > +This will as well show you compile errors right after each save.
>> > +
>> > +To simplify work with the deep directory structure I created a
>> directory for
>> > +shortcuts to the most important directories called 'sc':
>> > +
>> > + ls -ln sc/
>> > + lrwxrwxrwx 1 1000 1000 52 2011-06-01 11:44 java ->
>> ../src/main/java/org/apache/stanbol/enhancer/webvie/
>> > + lrwxrwxrwx 1 1000 1000 63 2011-06-01 11:43 static ->
>> ../src/main/resources/org/apache/stanbol/enhancer/webvie/static
>> > + lrwxrwxrwx 1 1000 1000 135 2011-06-01 11:44 template ->
>> ../src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
>> > +
>> > +Annotate widget API
>> > +===================
>> > +Options:
>> > +--------
>> > +
>> > +Methods:
>> > +--------
>> > +**enable**:
>> > + Analyze text and highlight TextAnnotations. Make TextAnnotations
>> > + interactive.
>> > +
>> > +**disable**:
>> > + Remove TextAnnotation highlighting.
>> > +
>> > +Events
>> > +------
>> > +**select**:
>> > + Triggered on annotating a suggested TextEnhancement
>> > +
>> > +**decline**:
>> > + Triggered on declining a suggested TextEnhancement
>> > +
>> > +**remove**:
>> > + Triggered when an annotation is removed
>> > +
>> > + function (event, ui)
>> > +
>> > + The ui object has the following attributes:
>> > + `textEnhancement`,
>> > + `entityEnhancement`
>> > + `linkedEntity`
>> > +
>> >
>> > Added: incubator/stanbol/trunk/commons/web/webvie/pom.xml
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/pom.xml?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > --- incubator/stanbol/trunk/commons/web/webvie/pom.xml (added)
>> > +++ incubator/stanbol/trunk/commons/web/webvie/pom.xml Thu Jul 7
>> 07:38:24 2011
>> > @@ -0,0 +1,135 @@
>> > +<?xml version="1.0" encoding="UTF-8"?>
>> > +<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>stanbol-parent</artifactId>
>> > + <version>0.9-SNAPSHOT</version>
>> > + <relativePath>../../parent/pom.xml</relativePath>
>> > + </parent>
>> > + <artifactId>org.apache.stanbol.enhancer.webvie</artifactId>
>> > + <packaging>bundle</packaging>
>> > +
>> > + <name>Editable Entity based Enhancer UI</name>
>> > + <description>VIE based user interface for Stanbol
>> > + </description>
>> > +
>> > + <build>
>> > + <!-- make it an OSGi bundle -->
>> > + <plugins>
>> > + <plugin>
>> > + <groupId>org.apache.felix</groupId>
>> > + <artifactId>maven-scr-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.webvie.*
>> > + </Export-Package>
>> > + <Import-Package>*</Import-Package>
>> > + </instructions>
>> > + </configuration>
>> > + </plugin>
>> > + </plugins>
>> > + </build>
>> > +
>> > + <dependencies>
>> > +
>> > + <!-- dependencies on other IKS modules -->
>> > + <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.standalone</artifactId>
>> > + </dependency>
>> > + <dependency>
>> > + <groupId>org.apache.stanbol</groupId>
>> > + <artifactId>org.apache.stanbol.commons.web.base</artifactId>
>> > + </dependency>
>> > +
>> > + <!-- needed for the ContentItem resource -->
>> > + <dependency>
>> > + <groupId>org.apache.stanbol</groupId>
>> > + <artifactId>org.apache.stanbol.enhancer.jersey</artifactId>
>> > + </dependency>
>> > + <!-- Clerezza dependencies -->
>> > + <dependency>
>> > + <groupId>org.apache.clerezza</groupId>
>> > + <artifactId>org.apache.clerezza.rdf.core</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>
>> > + <dependency>
>> > + <groupId>javax.servlet</groupId>
>> > + <artifactId>servlet-api</artifactId>
>> > + </dependency>
>> > +
>> > + <dependency>
>> > + <groupId>org.freemarker</groupId>
>> > + <artifactId>freemarker</artifactId>
>> > + </dependency>
>> > + <!-- indirect dependency for freemarker -->
>> > + <dependency>
>> > + <groupId>org.codehaus.jettison</groupId>
>> > + <artifactId>jettison</artifactId>
>> > + </dependency>
>> > +
>> > + <!-- generic tax -->
>> > + <dependency>
>> > + <groupId>org.slf4j</groupId>
>> > + <artifactId>slf4j-api</artifactId>
>> > + </dependency>
>> > + <dependency>
>> > + <groupId>commons-io</groupId>
>> > + <artifactId>commons-io</artifactId>
>> > + </dependency>
>> > + <dependency>
>> > + <groupId>commons-lang</groupId>
>> > + <artifactId>commons-lang</artifactId>
>> > + </dependency>
>> > +
>> > + <!-- OSGi tax -->
>> > + <dependency>
>> > + <groupId>org.osgi</groupId>
>> > + <artifactId>org.osgi.core</artifactId>
>> > + </dependency>
>> > + <dependency>
>> > + <groupId>org.osgi</groupId>
>> > + <artifactId>org.osgi.compendium</artifactId>
>> > + </dependency>
>> > + <dependency>
>> > + <groupId>org.apache.felix</groupId>
>> > + <artifactId>org.apache.felix.scr.annotations</artifactId>
>> > + </dependency>
>> > +
>> > + <!-- for tests -->
>> > + <dependency>
>> > + <groupId>junit</groupId>
>> > + <artifactId>junit</artifactId>
>> > + <scope>test</scope>
>> > + </dependency>
>> > + <dependency>
>> > + <groupId>org.slf4j</groupId>
>> > + <artifactId>slf4j-simple</artifactId>
>> > + <scope>test</scope>
>> > + </dependency>
>> > +
>> > + </dependencies>
>> > +
>> > +</project>
>> >
>> > Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > ---
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>> (added)
>> > +++
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
>> Thu Jul 7 07:38:24 2011
>> > @@ -0,0 +1,132 @@
>> > +package org.apache.stanbol.enhancer.webvie.fragment;
>> > +
>> > +import java.util.ArrayList;
>> > +import java.util.Collections;
>> > +import java.util.HashSet;
>> > +import java.util.List;
>> > +import java.util.Set;
>> > +
>> > +import org.apache.clerezza.rdf.core.access.TcManager;
>> > +import org.apache.clerezza.rdf.core.serializedform.Serializer;
>> > +import org.apache.felix.scr.annotations.Activate;
>> > +import org.apache.felix.scr.annotations.Component;
>> > +import org.apache.felix.scr.annotations.Reference;
>> > +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.servicesapi.EnhancementJobManager;
>> > +import org.apache.stanbol.enhancer.servicesapi.Store;
>> > +import
>> org.apache.stanbol.enhancer.webvie.resource.EnhancerVieRootResource;
>> > +import org.osgi.framework.BundleContext;
>> > +import org.osgi.service.component.ComponentContext;
>> > +
>> > +import freemarker.cache.ClassTemplateLoader;
>> > +import freemarker.cache.TemplateLoader;
>> > +
>> > +/**
>> > + * Statically define the list of available resources and providers to
>> be contributed to the the Stanbol JAX-RS
>> > + * Endpoint.
>> > + */
>> > +@Component(immediate = true, metatype = true)
>> > +@Service
>> > +public class EnhancerVieWebFragment implements WebFragment {
>> > +
>> > + private static final String NAME = "enhancervie";
>> > +
>> > + private static final String STATIC_RESOURCE_PATH =
>> "/org/apache/stanbol/enhancer/webvie/static";
>> > +
>> > + private static final String TEMPLATE_PATH =
>> "/org/apache/stanbol/enhancer/webvie/templates";
>> > +
>> > + private BundleContext bundleContext;
>> > +
>> > + @Reference
>> > + TcManager tcManager;
>> > +
>> > + @Reference
>> > + Store store;
>> > +
>> > + @Reference
>> > + EnhancementJobManager jobManager;
>> > +
>> > + @Reference
>> > + Serializer serializer;
>> > +
>> > + @Override
>> > + public String getName() {
>> > + return NAME;
>> > + }
>> > +
>> > + @Activate
>> > + protected void activate(ComponentContext ctx) {
>> > + this.bundleContext = ctx.getBundleContext();
>> > + }
>> > +
>> > + @Override
>> > + public Set<Class<?>> getJaxrsResourceClasses() {
>> > + Set<Class<?>> classes = new HashSet<Class<?>>();
>> > + classes.add(EnhancerVieRootResource.class);
>> > + return classes;
>> > + }
>> > +
>> > + @Override
>> > + public Set<Object> getJaxrsResourceSingletons() {
>> > + return Collections.emptySet();
>> > + }
>> > +
>> > + @Override
>> > + public String getStaticResourceClassPath() {
>> > + return STATIC_RESOURCE_PATH;
>> > + }
>> > +
>> > + @Override
>> > + public TemplateLoader getTemplateLoader() {
>> > + return new ClassTemplateLoader(getClass(), TEMPLATE_PATH);
>> > + }
>> > +
>> > + @Override
>> > + public List<LinkResource> getLinkResources() {
>> > + List<LinkResource> resources = new ArrayList<LinkResource>();
>> > +// resources.add(new LinkResource("stylesheet",
>> "lib/Aristo/jquery-ui-1.8.7.custom.css", this, 10));
>> > + resources.add(new LinkResource("stylesheet",
>> "lib/Smoothness/jquery.ui.all.css", this, 10)); // version 1.8.13
>> > +// resources.add(new LinkResource("stylesheet",
>> "lib/Aristo/jquery.ui.menu.css", this, 10));
>> > + return resources;
>> > + }
>> > +
>> > + @Override
>> > + public List<ScriptResource> getScriptResources() {
>> > + List<ScriptResource> resources = new
>> ArrayList<ScriptResource>();
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/jquery-1.5.1.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/jquery-ui.1.9m5.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/underscore-min.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/backbone.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/vie.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/vie-containermanager.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/vie-collectionmanager.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/hallo/hallo.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/hallo/format.js", this, 10));
>> > +
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/jquery.rdfquery.debug.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/vie2/vie2-latest.debug.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/vie2/connector/stanbol.js", this, 10));
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/vie2/mapping/person.js", this, 10));
>> > +
>> > + resources.add(new ScriptResource("text/javascript",
>> "lib/annotate.js", this, 10));
>> > +
>> > + return resources;
>> > + }
>> > +
>> > + @Override
>> > + public List<NavigationLink> getNavigationLinks() {
>> > + List<NavigationLink> links = new ArrayList<NavigationLink>();
>> > + links.add(new NavigationLink("enhancervie", "/enhancer VIE",
>> "/imports/enhancervieDescription.ftl", 20));
>> > + return links;
>> > + }
>> > +
>> > + @Override
>> > + public BundleContext getBundleContext() {
>> > + return bundleContext;
>> > + }
>> > +
>> > +}
>> >
>> > Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > ---
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>> (added)
>> > +++
>> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
>> Thu Jul 7 07:38:24 2011
>> > @@ -0,0 +1,27 @@
>> > +package org.apache.stanbol.enhancer.webvie.resource;
>> > +
>> > +import static javax.ws.rs.core.MediaType.TEXT_HTML;
>> > +
>> > +import javax.ws.rs.GET;
>> > +import javax.ws.rs.Path;
>> > +import javax.ws.rs.Produces;
>> > +
>> > +import
>> org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
>> > +
>> > +import com.sun.jersey.api.view.Viewable;
>> > +
>> > +/**
>> > + * Adapter to add a VIE based interface for the Stanbol Enhancer
>> > + * @author Szaby Gruenwald
>> > + */
>> > +@Path("/enhancervie")
>> > +public class EnhancerVieRootResource extends BaseStanbolResource {
>> > +
>> > +
>> > + @GET
>> > + @Produces(TEXT_HTML + ";qs=2")
>> > + public Viewable getView() {
>> > + return new Viewable("index", this);
>> > + }
>> > +
>> > +}
>> >
>> > Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > ---
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>> (added)
>> > +++
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
>> Thu Jul 7 07:38:24 2011
>> > @@ -0,0 +1,677 @@
>> > +# Annotate - a text enhancement interaction jQuery UI widget
>> > +# (c) 2011 Szaby Gruenwald, IKS Consortium
>> > +# Annotate may be freely distributed under the MIT license
>> > +
>> > +((jQuery) ->
>> > + # The annotate.js widget
>> > + #
>> > +
>> > + # define namespaces
>> > + ns =
>> > + rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
>> > + enhancer: 'http://fise.iks-project.eu/ontology/'
>> > + dc: 'http://purl.org/dc/terms/'
>> > + rdfs: 'http://www.w3.org/2000/01/rdf-schema#'
>> > +
>> > + ANTT = ANTT or {}
>> > + Stanbol = Stanbol or {}
>> > +
>> > + # filter for TextAnnotations
>> > + Stanbol.getTextAnnotations = (enhRdf) ->
>> > + res = _(enhRdf).map((obj, key) ->
>> > + obj.id = key
>> > + obj
>> > + )
>> > + .filter (e) ->
>> > + e["#{ns.rdf}type"]
>> > + .map((x) -> x.value)
>> > + .indexOf("#{ns.enhancer}TextAnnotation") != -1
>> > + res = _(res).sortBy (e) ->
>> > + conf = Number e["#{ns.enhancer}confidence"][0].value if
>> e["#{ns.enhancer}confidence"]
>> > + -1 * conf
>> > +
>> > + _(res).map (s)->
>> > + new Stanbol.TextEnhancement s, enhRdf
>> > +
>> > + # filter the entityManager for TextAnnotations
>> > + Stanbol.getEntityAnnotations = (enhRdf) ->
>> > + _(enhRdf)
>> > + .map((obj, key) ->
>> > + obj.id = key
>> > + obj
>> > + )
>> > + .filter (e) ->
>> > + e["#{ns.rdf}type"]
>> > + .map((x) -> x.value)
>> > + .indexOf("#{ns.enhancer}EntityAnnotation") != -1
>> > +
>> > + # Get the label in the user's language or the first one from a VIE
>> entity
>> > + ANTT.getRightLabel = (entity) ->
>> > + labelMap = {}
>> > + for label in _(entity["#{ns.rdfs}label"]).flatten()
>> > + cleanLabel = label.value
>> > + if cleanLabel.lastIndexOf "@" is cleanLabel.length - 3
>> > + cleanLabel = cleanLabel.substring 0, cleanLabel.length
>> - 3
>> > + labelMap[label["xml:lang"]|| "_"] = cleanLabel
>> > + userLang = window.navigator.language.split("-")[0]
>> > + # Return the first best label
>> > + labelMap[userLang] or labelMap["_"] or labelMap["en"]
>> > +
>> > + # Generic API for a TextEnhancement
>> > + # A TextEnhancement object has the methods for getting generic
>> > + # text-enhancement-specific properties.
>> > + # TODO Place it into a global Stanbol object.
>> > + Stanbol.TextEnhancement = (enhancement, enhRdf) ->
>> > + @_enhancement = enhancement
>> > + @_enhRdf = enhRdf
>> > + @id = @_enhancement.id
>> > + Stanbol.TextEnhancement.prototype =
>> > + # the text the annotation is for
>> > + getSelectedText: ->
>> > + @_vals("#{ns.enhancer}selected-text")[0]
>> > + # confidence value
>> > + getConfidence: ->
>> > + @_vals("#{ns.enhancer}confidence")[0]
>> > + # get Entities suggested for the text enhancement (if any)
>> > + getEntityEnhancements: ->
>> > + rawList = _(Stanbol.getEntityAnnotations @_enhRdf ).filter
>> (ann) =>
>> > + relations = _(ann["#{ns.dc}relation"])
>> > + .map (e) -> e.value
>> > + if (relations.indexOf @_enhancement.id) isnt -1 then
>> true
>> > + else false
>> > + _(rawList).map (ee) =>
>> > + new Stanbol.EntityEnhancement ee, @
>> > + # The type of the entity suggested (e.g. person, location,
>> organization)
>> > + getType: ->
>> > + @_vals("#{ns.dc}type")[0]
>> > + # Optional, not used
>> > + getContext: ->
>> > + @_vals("#{ns.enhancer}selection-context")[0]
>> > + # start position in the original text
>> > + getStart: ->
>> > + Number @_vals("#{ns.enhancer}start")[0]
>> > + # end position in the original text
>> > + getEnd: ->
>> > + Number @_vals("#{ns.enhancer}end")[0]
>> > + # Optional
>> > + getOrigText: ->
>> > + ciUri = @_vals("#{ns.enhancer}extracted-from")[0]
>> > + @_enhRdf[ciUri]["
>> http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent
>> "][0].value
>> > + _vals: (key) ->
>> > + _(@_enhancement[key])
>> > + .map (x) -> x.value
>> > +
>> > + # Generic API for an EntityEnhancement. This is the implementation
>> for Stanbol
>> > + Stanbol.EntityEnhancement = (ee, textEnh) ->
>> > + @_textEnhancement = textEnh
>> > + $.extend @, ee
>> > + Stanbol.EntityEnhancement.prototype =
>> > + getLabel: ->
>> > + @_vals("#{ns.enhancer}entity-label")[0]
>> > + getUri: ->
>> > + @_vals("#{ns.enhancer}entity-reference")[0]
>> > + getTextEnhancement: ->
>> > + @_textEnhancement
>> > + getTypes: ->
>> > + @_vals("#{ns.enhancer}entity-type")
>> > + getConfidence: ->
>> > + Number @_vals("#{ns.enhancer}confidence")[0]
>> > + _vals: (key) ->
>> > + _(@[key]).map (x) -> x.value
>> > +
>> > + # get or create a dom element containing only the occurrence of the
>> found entity
>> > + ANTT.getOrCreateDomElement = (element, text, options = {}) ->
>> > + # Find occurrence indexes of s in str
>> > + occurrences = (str, s) ->
>> > + res = []
>> > + last = 0
>> > + while str.indexOf(s, last + 1) isnt -1
>> > + next = str.indexOf s, last+1
>> > + res.push next
>> > + last = next
>> > +
>> > + # Find the nearest number among the
>> > + nearest = (arr, nr) ->
>> > + _(arr).sortedIndex nr
>> > +
>> > + # Nearest position
>> > + nearestPosition = (str, s, ind) ->
>> > + arr = occurrences(str,s)
>> > + i1 = nearest arr, ind
>> > + if arr.length is 1
>> > + arr[0]
>> > + else if i1 is arr.length
>> > + arr[i1-1]
>> > + else
>> > + i0 = i1-1
>> > + d0 = ind - arr[i0]
>> > + d1 = arr[i1] - ind
>> > + if d1 > d0 then arr[i0]
>> > + else arr[i1]
>> > +
>> > + domEl = element
>> > + textContentOf = (element) -> $(element).text().replace(/\n/g, "
>> ")
>> > + # find the text node
>> > + if textContentOf(element).indexOf(text) is -1
>> > + throw "'#{text}' doesn't appear in the text block."
>> > + return $()
>> > + start = options.start +
>> > + textContentOf(element).indexOf textContentOf(element).trim()
>> > + # Correct small position errors
>> > + start = nearestPosition textContentOf(element), text, start
>> > + pos = 0
>> > + while textContentOf(domEl).indexOf(text) isnt -1 and
>> domEl.nodeName isnt '#text'
>> > + domEl = _(domEl.childNodes).detect (el) ->
>> > + p = textContentOf(el).lastIndexOf text
>> > + if p >= start - pos
>> > + true
>> > + else
>> > + pos += textContentOf(el).length
>> > + false
>> > +
>> > + if options.createMode is "existing" and
>> textContentOf($(domEl).parent()) is text
>> > + return $(domEl).parent()[0]
>> > + else
>> > + pos = start - pos
>> > + len = text.length
>> > + textToCut = textContentOf(domEl).substring(pos, pos+len)
>> > + if textToCut is text
>> > + domEl.splitText pos + len
>> > + newElement = document.createElement
>> options.createElement or 'span'
>> > + newElement.innerHTML = text
>> > + $(domEl).parent()[0].replaceChild newElement,
>> domEl.splitText pos
>> > + $ newElement
>> > + else
>> > + console.warn "dom element creation problem:
>> #{textToCut} isnt #{text}"
>> > +
>> > + # Give back the last part of a uri for fallback label creation
>> > + ANTT.uriSuffix = (uri) ->
>> > + res = uri.substring uri.lastIndexOf("#") + 1
>> > + res.substring res.lastIndexOf("/") + 1
>> > +
>> > + # jquery events cloning method
>> > + ANTT.cloneCopyEvent = (src, dest) ->
>> > + if dest.nodeType isnt 1 or not jQuery.hasData src
>> > + return
>> > +
>> > + internalKey = $.expando
>> > + oldData = $.data src
>> > + curData = $.data dest, oldData
>> > +
>> > + # Switch to use the internal data object, if it exists, for the
>> next
>> > + # stage of data copying
>> > + if oldData = oldData[internalKey]
>> > + events = oldData.events
>> > + curData = curData[ internalKey ] = jQuery.extend({},
>> oldData);
>> > +
>> > + if events
>> > + delete curData.handle
>> > + curData.events = {}
>> > +
>> > + `for ( var type in events ) {
>> > + for ( var i = 0, l = events[ type ].length; i < l;
>> i++ ) {
>> > + jQuery.event.add( dest, type + ( events[ type
>> ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type
>> ][ i ], events[ type ][ i ].data );
>> > + }
>> > + }`
>> > + null
>> > +
>> > + ######################################################
>> > + # Annotate widget
>> > + # makes a content dom element interactively annotatable
>> > + ######################################################
>> > + jQuery.widget 'IKS.annotate',
>> > + __widgetName: "IKS.annotate"
>> > + options:
>> > + autoAnalyze: false
>> > + debug: false
>> > + # namespaces necessary for the widget configuration
>> > + ns:
>> > + dbpedia: "http://dbpedia.org/ontology/"
>> > + skos: "http://www.w3.org/2004/02/skos/core#"
>> > + # Give a label to your expected enhancement types
>> > + getTypes: ->
>> > + [
>> > + uri: "#{@ns.dbpedia}Place"
>> > + label: 'Place'
>> > + ,
>> > + uri: "#{@ns.dbpedia}Person"
>> > + label: 'Person'
>> > + ,
>> > + uri: "#{@ns.dbpedia}Organisation"
>> > + label: 'Organisation'
>> > + ,
>> > + uri: "#{@ns.skos}Concept"
>> > + label: 'Concept'
>> > + ]
>> > + # Give a label to the sources the entities come from
>> > + getSources: ->
>> > + [
>> > + uri: "http://dbpedia.org/resource/"
>> > + label: "dbpedia"
>> > + ,
>> > + uri: "http://sws.geonames.org/"
>> > + label: "geonames"
>> > + ]
>> > + _create: ->
>> > + widget = @
>> > + # logger can be turned on and off. It will show the real
>> caller line in the log
>> > + @_logger = if @options.debug then console else
>> > + info: ->
>> > + warn: ->
>> > + error: ->
>> > + # widget.entityCache.get(uri, cb) will get and cache the
>> entity from an entityhub
>> > + @entityCache = window.entityCache =
>> > + _entities: {}
>> > + # calling the get with a scope and callback will call
>> cb(entity) with the scope as soon it's available.'
>> > + get: (uri, scope, cb) ->
>> > + # If entity is stored in the cache already just
>> call cb
>> > + if @_entities[uri] and @_entities[uri].status is
>> "done"
>> > + cb.apply scope, [@_entities[uri].entity]
>> > + # If the entity is new to the cache
>> > + else if not @_entities[uri]
>> > + # create cache entry
>> > + @_entities[uri] =
>> > + status: "pending"
>> > + uri: uri
>> > + cache = @
>> > + # make a request to the entity hub
>> > + widget.options.connector.queryEntityHub uri,
>> (entity) ->
>> > + if not entity.status
>> > + if entity.id isnt uri
>> > + widget._logger.warn "wrong
>> callback", uri, entity.id
>> > + cache._entities[uri].entity = entity
>> > + cache._entities[uri].status = "done"
>> > + $(cache._entities[uri]).trigger "done",
>> entity
>> > + else
>> > + widget._logger.warn "error getting
>> entity", uri, entity
>> > + if @_entities[uri] and @_entities[uri].status is
>> "pending"
>> > + $( @_entities[uri] )
>> > + .bind "done", (event, entity) ->
>> > + cb.apply scope, [entity]
>> > + if @options.autoAnalyze
>> > + @enable()
>> > +
>> > + # analyze the widget element and show text enhancements
>> > + enable: (cb) ->
>> > + analyzedNode = @element
>> > + # the analyzedDocUri makes the connection between a
>> document state and
>> > + # the annotations to it. We have to clean up the
>> annotations to any
>> > + # old document state
>> > +
>> > + @options.connector.analyze @element,
>> > + success: (rdf) =>
>> > + # Get enhancements
>> > + rdfJson = rdf.databank.dump()
>> > +
>> > + textAnnotations =
>> Stanbol.getTextAnnotations(rdfJson)
>> > + # Remove all textAnnotations without a selected
>> text property
>> > + textAnnotations = _(textAnnotations)
>> > + .filter (textEnh) ->
>> > + if textEnh.getSelectedText and
>> textEnh.getSelectedText()
>> > + true
>> > + else
>> > + false
>> > + _(textAnnotations)
>> > + .each (s) =>
>> > + @_logger.info s._enhancement,
>> > + 'confidence', s.getConfidence(),
>> > + 'selectedText', s.getSelectedText(),
>> > + 'type', s.getType(),
>> > + 'EntityEnhancements',
>> s.getEntityEnhancements()
>> > + # Process the text enhancements
>> > + @processTextEnhancement s, analyzedNode
>> > + # trigger 'done' event with success = true
>> > + @_trigger "done", true
>> > + if typeof cb is "function"
>> > + cb(true)
>> > + # Remove all not accepted text enhancement widgets
>> > + disable: ->
>> > + $( ':IKS-annotationSelector', @element ).each () ->
>> > + $(@).annotationSelector 'disable'
>> > +
>> > + # processTextEnhancement deals with one TextEnhancement in an
>> ancestor element of its occurrence
>> > + processTextEnhancement: (textEnh, parentEl) ->
>> > + if not textEnh.getSelectedText()
>> > + console.warn "textEnh", textEnh, "doesn't have
>> selected-text!"
>> > + return
>> > + el = $ ANTT.getOrCreateDomElement parentEl[0],
>> textEnh.getSelectedText(),
>> > + createElement: 'span'
>> > + createMode: 'existing'
>> > + context: textEnh.getContext()
>> > + start: textEnh.getStart()
>> > + end: textEnh.getEnd()
>> > + sType = textEnh.getType()
>> > + widget = @
>> > + el.addClass('entity')
>> > + .addClass ANTT.uriSuffix(sType).toLowerCase()
>> > + if textEnh.getEntityEnhancements().length
>> > + el.addClass "withSuggestions"
>> > + for eEnh in textEnh.getEntityEnhancements()
>> > + eEnhUri = eEnh.getUri()
>> > + @entityCache.get eEnhUri, eEnh, (entity) ->
>> > + if this.getUri() isnt entity.id
>> > + widget._logger.warn "wrong callback",
>> entity.id, this.getUri()
>> > +# widget._logger.info "entity for",
>> textEnh.getSelectedText(), this.getUri(), entity
>> > + # Create widget to select from the suggested entities
>> > + options =
>> > + cache: @entityCache
>> > + $.extend options, @options
>> > + el.annotationSelector( options )
>> > + .annotationSelector 'addTextEnhancement', textEnh
>> > +
>> > + ######################################################
>> > + # AnnotationSelector widget
>> > + # the annotationSelector makes an annotated word interactive
>> > + ######################################################
>> > + ANTT.annotationSelector =
>> > + jQuery.widget 'IKS.annotationSelector',
>> > + # just for debugging and understanding
>> > + __widgetName: "IKS.annotationSelector"
>> > + options:
>> > + ns:
>> > + dbpedia: "http://dbpedia.org/ontology/"
>> > + skos: "http://www.w3.org/2004/02/skos/core#"
>> > + getTypes: ->
>> > + [
>> > + uri: "#{@ns.dbpedia}Place"
>> > + label: 'Place'
>> > + ,
>> > + uri: "#{@ns.dbpedia}Person"
>> > + label: 'Person'
>> > + ,
>> > + uri: "#{@ns.dbpedia}Organisation"
>> > + label: 'Organisation'
>> > + ,
>> > + uri: "#{@ns.skos}Concept"
>> > + label: 'Concept'
>> > + ]
>> > + getSources: ->
>> > + [
>> > + uri: "http://dbpedia.org/resource/"
>> > + label: "dbpedia"
>> > + ,
>> > + uri: "http://sws.geonames.org/"
>> > + label: "geonames"
>> > + ]
>> > +
>> > + _create: ->
>> > + @element.click =>
>> > + if not @dialog
>> > + @_createDialog()
>> > + setTimeout((=> @dialog.open()), 220)
>> > + # Collect all EntityEnhancements for all the
>> TextEnhancements
>> > + # on the selected node.
>> > + eEnhancements = []
>> > + for textEnh in @textEnhancements
>> > + for enhancement in
>> textEnh.getEntityEnhancements()
>> > + eEnhancements.push enhancement
>> > + # filter enhancements with the same uri
>> > + # this is necessary because of a bug in stanbol
>> that creates
>> > + # duplicate enhancements.
>> > + #
>> https://issues.apache.org/jira/browse/STANBOL-228
>> > + _tempUris = []
>> > + eEnhancements = _(eEnhancements).filter (eEnh) ->
>> > + uri = eEnh.getUri()
>> > + if _tempUris.indexOf(uri) is -1
>> > + _tempUris.push uri
>> > + true
>> > + else
>> > + false
>> > + @entityEnhancements = eEnhancements
>> > +
>> > + @_createSearchbox()
>> > + if @entityEnhancements.length > 0
>> > + @_createMenu() if @menu is undefined
>> > + else @searchEntryField.find('.search').focus 100
>> > + @_logger = if @options.debug then console else
>> > + info: ->
>> > + warn: ->
>> > + error: ->
>> > + _destroy: ->
>> > + if @menu
>> > + @menu.destroy()
>> > + @menu.element.remove()
>> > + delete @menu
>> > + if @dialog
>> > + @dialog.destroy()
>> > + @dialog.element.remove()
>> > + @dialog.uiDialogTitlebar.remove()
>> > + delete @dialog
>> > +
>> > + # Produce type label list out of a uri list.
>> > + # Filtered by the @options.types list
>> > + _typeLabels: (types) ->
>> > + knownMapping = @options.getTypes()
>> > + allKnownPrefixes = _(knownMapping).map (x) -> x.uri
>> > + knownPrefixes = _.intersect allKnownPrefixes, types
>> > + _(knownPrefixes).map (key) =>
>> > + foundPrefix = _(knownMapping).detect (x) -> x.uri is
>> key
>> > + foundPrefix.label
>> > +
>> > + # make a label for the entity source based on
>> options.getSources()
>> > + _sourceLabel: (src) ->
>> > + sources = @options.getSources()
>> > + sourceObj = _(sources).detect (s) -> src.indexOf(s.uri)
>> isnt -1
>> > + if sourceObj
>> > + sourceObj.label
>> > + else
>> > + src.split("/")[2]
>> > +
>> > + # create dialog widget
>> > + _createDialog: ->
>> > + label = @element.text()
>> > + dialogEl = $("<div><span
>> class='entity-link'></span></div>")
>> > + .attr( "tabIndex", -1)
>> > + .addClass()
>> > + .keydown( (event) =>
>> > + if not event.isDefaultPrevented() and event.keyCode and
>> event.keyCode is $.ui.keyCode.ESCAPE
>> > + @close event
>> > + event.preventDefault()
>> > + )
>> > + .bind('dialogblur', (event) =>
>> > + @_logger.info 'dialog dialogblur'
>> > + @close(event)
>> > + )
>> > + .bind('blur', (event) =>
>> > + @_logger.info 'dialog blur'
>> > + @close(event)
>> > + )
>> > + .appendTo( $("body")[0] )
>> > + widget = @
>> > + dialogEl.dialog
>> > + width: 400
>> > + title: label
>> > + close: (event, ui) =>
>> > + @close(event)
>> > + autoOpen: false
>> > + open: (e, ui) ->
>> > + $.data(this, 'dialog').uiDialog.position {
>> > + of: widget.element
>> > + my: "left top"
>> > + at: "left bottom"
>> > + collision: "none"}
>> > + @dialog = dialogEl.data 'dialog'
>> > + @dialog.uiDialogTitlebar.hide()
>> > + @_logger.info "dialog widget:", @dialog
>> > + @dialog.element.focus(100)
>> > + window.d = @dialog
>> > + @_insertLink()
>> > + @_updateTitle()
>> > + @_setButtons()
>> > +
>> > + # If annotation is already made insert a link to the entity
>> > + _insertLink: ->
>> > + if @isAnnotated() and @dialog
>> > + $("Annotated: <a href='#{@linkedEntity.uri}'
>> target='_blank'>
>> > + #{@linkedEntity.label} @
>> #{@_sourceLabel(@linkedEntity.uri)}</a><br/>")
>> > + .appendTo $( '.entity-link', @dialog.element )
>> > + # create/update the dialog button row
>> > + _setButtons: ->
>> > + @dialog.element.dialog 'option', 'buttons',
>> > + rem:
>> > + text: if @isAnnotated() then 'Remove' else
>> 'Decline'
>> > + click: (event) =>
>> > + @remove event
>> > + Cancel: =>
>> > + @close()
>> > +
>> > + # remove textEnhancement/annotation, replace the separate html
>> > + # element with the plain text and close the dialog
>> > + remove: (event) ->
>> > + el = @element.parent()
>> > + if not @isAnnotated() and @textEnhancements
>> > + @_trigger 'decline', event,
>> > + textEnhancements: @textEnhancements
>> > + else
>> > + @_trigger 'remove', event,
>> > + textEnhancement: @_acceptedTextEnhancement
>> > + entityEnhancement: @_acceptedEntityEnhancement
>> > + linkedEntity: @linkedEntity
>> > + @destroy()
>> > + if @element.qname().name isnt '#text'
>> > + @element.replaceWith document.createTextNode
>> @element.text()
>> > +
>> > + # Remove the widget if not annotated.
>> > + disable: ->
>> > + if not @isAnnotated() and @element.qname().name isnt
>> '#text'
>> > + @element.replaceWith document.createTextNode
>> @element.text()
>> > +
>> > + # tells if this is an annotated dom element (not a highlighted
>> textEnhancement only)
>> > + isAnnotated: ->
>> > + if @element.attr 'about' then true else false
>> > +
>> > + # Place the annotation on the DOM element (about and typeof
>> attributes)
>> > + annotate: (entityEnhancement, styleClass) ->
>> > + entityUri = entityEnhancement.getUri()
>> > + entityType =
>> entityEnhancement.getTextEnhancement().getType()
>> > + entityHtml = @element.html()
>> > + # We ignore the old style classes
>> > + # entityClass = @element.attr 'class'
>> > + sType = entityEnhancement.getTextEnhancement().getType()
>> > + entityClass = 'entity ' +
>> ANTT.uriSuffix(sType).toLowerCase()
>> > + newElement = $ "<a href='#{entityUri}'
>> > + about='#{entityUri}'
>> > + typeof='#{entityType}'
>> > + class='#{entityClass}'>#{entityHtml}</a>"
>> > + ANTT.cloneCopyEvent @element[0], newElement[0]
>> > + @linkedEntity =
>> > + uri: entityUri
>> > + type: entityType
>> > + label: entityEnhancement.getLabel()
>> > + @element.replaceWith newElement
>> > + @element = newElement.addClass styleClass
>> > + @_logger.info "created annotation in", @element
>> > + @_updateTitle()
>> > + @_insertLink()
>> > + @_acceptedTextEnhancement =
>> entityEnhancement.getTextEnhancement()
>> > + @_acceptedEntityEnhancement = entityEnhancement
>> > + @_trigger 'select', null,
>> > + linkedEntity: @linkedEntity
>> > + textEnhancement: entityEnhancement.getTextEnhancement()
>> > + entityEnhancement: entityEnhancement
>> > + # closing the widget
>> > + close: ->
>> > + @destroy()
>> > + _updateTitle: ->
>> > + if @dialog
>> > + if @isAnnotated()
>> > + title = "#{@linkedEntity.label} <small>@
>> #{@_sourceLabel(@linkedEntity.uri)}</small>"
>> > + else
>> > + title = @element.text()
>> > + @dialog._setOption 'title', title
>> > +
>> > + # create menu and add to the dialog
>> > + _createMenu: ->
>> > + ul = $('<ul></ul>')
>> > + .appendTo( @dialog.element )
>> > + @_renderMenu ul, @entityEnhancements
>> > + @menu = ul
>> > + .menu({
>> > + select: (event, ui) =>
>> > + @_logger.info "selected menu item", ui.item
>> > + @annotate ui.item.data('enhancement'),
>> 'acknowledged'
>> > + @close(event)
>> > + blur: (event, ui) =>
>> > + @_logger.info 'menu.blur()', ui.item
>> > + focus: (event, ui) =>
>> > + @_logger.info 'menu.focus()', ui.item
>> > + # show preview
>> > + @_entityPreview ui.item
>> > + })
>> > + .bind('blur', (event, ui) ->
>> > + @_logger.info 'menu blur', ui
>> > + )
>> > + .bind('menublur', (event, ui) ->
>> > + @_logger.info 'menu menublur', ui.item
>> > + )
>> > + .focus(150)
>> > + .data 'menu'
>> > +
>> > + # Rendering menu for the EntityEnhancements suggested for the
>> selected text
>> > + _renderMenu: (ul, entityEnhancements) ->
>> > + entityEnhancements = _(entityEnhancements).sortBy (ee) ->
>> -1 * ee.getConfidence()
>> > + @_renderItem ul, enhancement for enhancement in
>> entityEnhancements
>> > + @_logger.info 'rendered menu for the elements',
>> entityEnhancements
>> > + _renderItem: (ul, eEnhancement) ->
>> > + label = eEnhancement.getLabel().replace /^\"|\"$/g, ""
>> > + type = @_typeLabels eEnhancement.getTypes()
>> > + source = @_sourceLabel eEnhancement.getUri()
>> > + active = if @linkedEntity and eEnhancement.getUri() is
>> @linkedEntity.uri
>> > + " class='ui-state-active'"
>> > + else ""
>> > + $("<li#{active}><a href='#'>#{label} <small>(#{type} from
>> #{source})</small></a></li>")
>> > + .data('enhancement', eEnhancement)
>> > + .appendTo ul
>> > +
>> > + # Render search box with autocompletion for finding the right
>> entity
>> > + _createSearchbox: ->
>> > + # Show an input box for autocompleted search
>> > + @searchEntryField = $('<span style="background:
>> fff;"><label for="search">Search:</label> <input id="search"
>> class="search"></span>')
>> > + .appendTo @dialog.element
>> > + sugg = @textEnhancements[0]
>> > + widget = @
>> > + $( '.search', @searchEntryField )
>> > + .autocomplete
>> > + # Define source method. TODO make independent from
>> stanbol.
>> > + source: (req, resp) ->
>> > + widget._logger.info "req:", req
>> > + widget.options.connector.findEntity
>> "#{req.term}#{'*' if req.term.length > 3}", (entityList) ->
>> > + widget._logger.info "resp:", _(entityList).map
>> (ent) ->
>> > + ent.id
>> > + res = for i, entity of entityList
>> > + {
>> > + key: entity.id
>> > + label: "#{ANTT.getRightLabel entity} @
>> #{widget._sourceLabel entity.id}"
>> > + _label: ANTT.getRightLabel entity
>> > + getLabel: -> @_label
>> > + getUri: -> @key
>> > + # To rethink: The type of the annotation
>> (person, place, org)
>> > + # should come from the search result, not
>> from the first textEnhancement
>> > + _tEnh: sugg
>> > + getTextEnhancement: -> @_tEnh
>> > + }
>> > + resp res
>> > + # An entity selected, annotate
>> > + select: (e, ui) =>
>> > + @annotate ui.item, "acknowledged"
>> > + @_logger.info "autocomplete.select", e.target, ui
>> > + focus: (e, ui) =>
>> > + @_logger.info "autocomplete.focus", e.target, ui
>> > + @_entityPreview ui.item
>> > + .focus(200)
>> > + .blur (e, ui) =>
>> > + @_dialogCloseTimeout = setTimeout ( => @close()), 200
>> > + @_logger.info "show searchbox"
>> > + # Show preview of a hovered item
>> > + _entityPreview: _.throttle(( (item) ->
>> > + @_logger.info "Show preview for", item
>> > + ), 1500)
>> > +
>> > + # add a textEnhancement that gets shown when the dialog is
>> rendered
>> > + addTextEnhancement: (textEnh) ->
>> > + @options.textEnhancements = @options.textEnhancements or []
>> > + @options.textEnhancements.push textEnh
>> > + @textEnhancements = @options.textEnhancements
>> > +
>> > + window.ANTT = ANTT
>> > +) jQuery
>> >
>> > Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > Binary file - no diff available.
>> >
>> > Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
>> >
>> ------------------------------------------------------------------------------
>> > svn:mime-type = application/octet-stream
>> >
>> > Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > Binary file - no diff available.
>> >
>> > Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
>> >
>> ------------------------------------------------------------------------------
>> > svn:mime-type = application/octet-stream
>> >
>> > Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > Binary file - no diff available.
>> >
>> > Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
>> >
>> ------------------------------------------------------------------------------
>> > svn:mime-type = application/octet-stream
>> >
>> > Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > Binary file - no diff available.
>> >
>> > Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
>> >
>> ------------------------------------------------------------------------------
>> > svn:mime-type = application/octet-stream
>> >
>> > Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > Binary file - no diff available.
>> >
>> > Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
>> >
>> ------------------------------------------------------------------------------
>> > svn:mime-type = application/octet-stream
>> >
>> > Added:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
>> > URL:
>> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png?rev=1143692&view=auto
>> >
>> ==============================================================================
>> > Binary file - no diff available.
>> >
>> > Propchange:
>> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
>> >
>> ------------------------------------------------------------------------------
>> > svn:mime-type = application/octet-stream
>> >
>> >
>> >
>>
>>
>>
>> --
>> Fabian
>>
>
>
Re: svn commit: r1143692 [1/10] - in /incubator/stanbol/trunk/commons/web/webvie:
./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/stanbol/ src/main/java/org/apache/stanbol/enhancer/ src/main/java
Posted by Szabolcs Grünwald <sz...@web.de>.
Right, I apologize..
So let me describe shortly what I was working on and committed here.
Similar to the web ui at <stanboluri>/engines, this bundle gives you an
access to the enhancer engines with the following differences:
- it uses the restful endpoint to communicate
- Shows the enhancements directly in the text and in the dom.
- It demonstrates that the text can be changed directly on the page for
later storage
For reaching this I implemented a jquery ui widget (annotate.coffee). This
widget is meant to be independent from stanbol so after some further
refactoring it will be possible to connect it to other enhancer-entityhub
backends simply by implementing connectors and two classes, one for
EntityEnancements, one for TextEnhancements.
Dependencies of the annotate widget are
- jquery 1.6+
- jquery ui 1.9m5+ (using jquery-ui.menu.js which is not yet part of 1.8)
- vie2.connectors.stanbol (I plan to refactor this to make the connector
independent of vie2)
I created following JIRA issue for this:
https://issues.apache.org/jira/browse/STANBOL-256
Peace,
Szaby
On 8 July 2011 10:02, Fabian Christ <ch...@googlemail.com> wrote:
> Hi Szaby,
>
> thank you for this contribution but could you please write a few lines
> to the list what this is about?
>
> And please open JIRA issues for such things where you describe the
> task that you are working on - this makes it easier for others to
> follow what happens. Then mention the STANBOL-XXX issue identifier in
> the commit message and the commit is automatically related to the
> issue in JIRA.
>
> https://issues.apache.org/jira/browse/STANBOL
>
> Best,
> - Fabian
>
> 2011/7/7 <sz...@apache.org>:
> > Author: szabyg
> > Date: Thu Jul 7 07:38:24 2011
> > New Revision: 1143692
> >
> > URL: http://svn.apache.org/viewvc?rev=1143692&view=rev
> > Log:
> > First version of the webvie user interface, based on hallo.coffee editor
> and the annotate.coffee widget.
> > See also https://github.com/szabyg/stanbol-webvie
> >
> > Added:
> > incubator/stanbol/trunk/commons/web/webvie/
> > incubator/stanbol/trunk/commons/web/webvie/.svnignore
> > incubator/stanbol/trunk/commons/web/webvie/README.md
> > incubator/stanbol/trunk/commons/web/webvie/pom.xml
> > incubator/stanbol/trunk/commons/web/webvie/src/
> > incubator/stanbol/trunk/commons/web/webvie/src/main/
> > incubator/stanbol/trunk/commons/web/webvie/src/main/java/
> > incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/
> > incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
> > incubator/stanbol/trunk/commons/web/webvie/src/main/resources/
> > incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery-ui-1.8.7.custom.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/jquery.ui.menu.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_flat_75_ffffff_40x100.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_65_ffffff_1x400.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_dadada_1x400.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_222222_256x240.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_2e83ff_256x240.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_454545_256x240.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_888888_256x240.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/images/ui-icons_cd0a0a_256x240.png
> (with props)
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery-ui-1.8.13.custom.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.accordion.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.all.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.autocomplete.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.base.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.button.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.core.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.datepicker.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.dialog.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.progressbar.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.resizable.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.selectable.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.slider.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.tabs.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Smoothness/jquery.ui.theme.css
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone-min.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/backbone.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/format.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/hallo/hallo.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-1.5.1.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery-ui.1.9m5.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.debug.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/jquery.rdfquery.min.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/underscore-min.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-collectionmanager.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie-containermanager.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/dbpedia.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/opencalais.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/rdfa.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/semantictweet.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/stanbol.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/connector/zemanta.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/organization.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/person.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/place.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/task.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/mapping/thing.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/vie2/vie2-latest.debug.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/test.js
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/imports/enhancervieDescription.ftl
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
> >
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/index.ftl
> > incubator/stanbol/trunk/commons/web/webvie/src/test/
> > incubator/stanbol/trunk/commons/web/webvie/src/test/java/
> > incubator/stanbol/trunk/commons/web/webvie/src/test/resources/
> >
> > Added: incubator/stanbol/trunk/commons/web/webvie/.svnignore
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/.svnignore?rev=1143692&view=auto
> >
> ==============================================================================
> > --- incubator/stanbol/trunk/commons/web/webvie/.svnignore (added)
> > +++ incubator/stanbol/trunk/commons/web/webvie/.svnignore Thu Jul 7
> 07:38:24 2011
> > @@ -0,0 +1,2 @@
> > +*.sh
> > +sc
> >
> > Added: incubator/stanbol/trunk/commons/web/webvie/README.md
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/README.md?rev=1143692&view=auto
> >
> ==============================================================================
> > --- incubator/stanbol/trunk/commons/web/webvie/README.md (added)
> > +++ incubator/stanbol/trunk/commons/web/webvie/README.md Thu Jul 7
> 07:38:24 2011
> > @@ -0,0 +1,62 @@
> > +VIE based Stanbol Enhancer UI
> > +=============================
> > +
> > +Adapter to add a VIE based interface for the Stanbol Enhancer
> > +
> > +Deploy
> > +------
> > +
> > +After building stanbol in a different folder you can build and deploy
> this bundle by using the following command:
> > +
> > + mvn install -DskipTests -PinstallBundle -Dsling.url=
> http://localhost:8080/system/console
> > +
> > +Development Guide
> > +=================
> > +
> > +The widget development is done in CoffeeScript. Use the following
> command to
> > +automatically compile the script in the background
> > +
> > + coffee -c -w -o lib annotate.coffee
> > +
> > +This will as well show you compile errors right after each save.
> > +
> > +To simplify work with the deep directory structure I created a directory
> for
> > +shortcuts to the most important directories called 'sc':
> > +
> > + ls -ln sc/
> > + lrwxrwxrwx 1 1000 1000 52 2011-06-01 11:44 java ->
> ../src/main/java/org/apache/stanbol/enhancer/webvie/
> > + lrwxrwxrwx 1 1000 1000 63 2011-06-01 11:43 static ->
> ../src/main/resources/org/apache/stanbol/enhancer/webvie/static
> > + lrwxrwxrwx 1 1000 1000 135 2011-06-01 11:44 template ->
> ../src/main/resources/org/apache/stanbol/enhancer/webvie/templates/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource/
> > +
> > +Annotate widget API
> > +===================
> > +Options:
> > +--------
> > +
> > +Methods:
> > +--------
> > +**enable**:
> > + Analyze text and highlight TextAnnotations. Make TextAnnotations
> > + interactive.
> > +
> > +**disable**:
> > + Remove TextAnnotation highlighting.
> > +
> > +Events
> > +------
> > +**select**:
> > + Triggered on annotating a suggested TextEnhancement
> > +
> > +**decline**:
> > + Triggered on declining a suggested TextEnhancement
> > +
> > +**remove**:
> > + Triggered when an annotation is removed
> > +
> > + function (event, ui)
> > +
> > + The ui object has the following attributes:
> > + `textEnhancement`,
> > + `entityEnhancement`
> > + `linkedEntity`
> > +
> >
> > Added: incubator/stanbol/trunk/commons/web/webvie/pom.xml
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/pom.xml?rev=1143692&view=auto
> >
> ==============================================================================
> > --- incubator/stanbol/trunk/commons/web/webvie/pom.xml (added)
> > +++ incubator/stanbol/trunk/commons/web/webvie/pom.xml Thu Jul 7
> 07:38:24 2011
> > @@ -0,0 +1,135 @@
> > +<?xml version="1.0" encoding="UTF-8"?>
> > +<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>stanbol-parent</artifactId>
> > + <version>0.9-SNAPSHOT</version>
> > + <relativePath>../../parent/pom.xml</relativePath>
> > + </parent>
> > + <artifactId>org.apache.stanbol.enhancer.webvie</artifactId>
> > + <packaging>bundle</packaging>
> > +
> > + <name>Editable Entity based Enhancer UI</name>
> > + <description>VIE based user interface for Stanbol
> > + </description>
> > +
> > + <build>
> > + <!-- make it an OSGi bundle -->
> > + <plugins>
> > + <plugin>
> > + <groupId>org.apache.felix</groupId>
> > + <artifactId>maven-scr-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.webvie.*
> > + </Export-Package>
> > + <Import-Package>*</Import-Package>
> > + </instructions>
> > + </configuration>
> > + </plugin>
> > + </plugins>
> > + </build>
> > +
> > + <dependencies>
> > +
> > + <!-- dependencies on other IKS modules -->
> > + <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.standalone</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>org.apache.stanbol</groupId>
> > + <artifactId>org.apache.stanbol.commons.web.base</artifactId>
> > + </dependency>
> > +
> > + <!-- needed for the ContentItem resource -->
> > + <dependency>
> > + <groupId>org.apache.stanbol</groupId>
> > + <artifactId>org.apache.stanbol.enhancer.jersey</artifactId>
> > + </dependency>
> > + <!-- Clerezza dependencies -->
> > + <dependency>
> > + <groupId>org.apache.clerezza</groupId>
> > + <artifactId>org.apache.clerezza.rdf.core</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>
> > + <dependency>
> > + <groupId>javax.servlet</groupId>
> > + <artifactId>servlet-api</artifactId>
> > + </dependency>
> > +
> > + <dependency>
> > + <groupId>org.freemarker</groupId>
> > + <artifactId>freemarker</artifactId>
> > + </dependency>
> > + <!-- indirect dependency for freemarker -->
> > + <dependency>
> > + <groupId>org.codehaus.jettison</groupId>
> > + <artifactId>jettison</artifactId>
> > + </dependency>
> > +
> > + <!-- generic tax -->
> > + <dependency>
> > + <groupId>org.slf4j</groupId>
> > + <artifactId>slf4j-api</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>commons-io</groupId>
> > + <artifactId>commons-io</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>commons-lang</groupId>
> > + <artifactId>commons-lang</artifactId>
> > + </dependency>
> > +
> > + <!-- OSGi tax -->
> > + <dependency>
> > + <groupId>org.osgi</groupId>
> > + <artifactId>org.osgi.core</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>org.osgi</groupId>
> > + <artifactId>org.osgi.compendium</artifactId>
> > + </dependency>
> > + <dependency>
> > + <groupId>org.apache.felix</groupId>
> > + <artifactId>org.apache.felix.scr.annotations</artifactId>
> > + </dependency>
> > +
> > + <!-- for tests -->
> > + <dependency>
> > + <groupId>junit</groupId>
> > + <artifactId>junit</artifactId>
> > + <scope>test</scope>
> > + </dependency>
> > + <dependency>
> > + <groupId>org.slf4j</groupId>
> > + <artifactId>slf4j-simple</artifactId>
> > + <scope>test</scope>
> > + </dependency>
> > +
> > + </dependencies>
> > +
> > +</project>
> >
> > Added:
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java?rev=1143692&view=auto
> >
> ==============================================================================
> > ---
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
> (added)
> > +++
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/fragment/EnhancerVieWebFragment.java
> Thu Jul 7 07:38:24 2011
> > @@ -0,0 +1,132 @@
> > +package org.apache.stanbol.enhancer.webvie.fragment;
> > +
> > +import java.util.ArrayList;
> > +import java.util.Collections;
> > +import java.util.HashSet;
> > +import java.util.List;
> > +import java.util.Set;
> > +
> > +import org.apache.clerezza.rdf.core.access.TcManager;
> > +import org.apache.clerezza.rdf.core.serializedform.Serializer;
> > +import org.apache.felix.scr.annotations.Activate;
> > +import org.apache.felix.scr.annotations.Component;
> > +import org.apache.felix.scr.annotations.Reference;
> > +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.servicesapi.EnhancementJobManager;
> > +import org.apache.stanbol.enhancer.servicesapi.Store;
> > +import
> org.apache.stanbol.enhancer.webvie.resource.EnhancerVieRootResource;
> > +import org.osgi.framework.BundleContext;
> > +import org.osgi.service.component.ComponentContext;
> > +
> > +import freemarker.cache.ClassTemplateLoader;
> > +import freemarker.cache.TemplateLoader;
> > +
> > +/**
> > + * Statically define the list of available resources and providers to be
> contributed to the the Stanbol JAX-RS
> > + * Endpoint.
> > + */
> > +@Component(immediate = true, metatype = true)
> > +@Service
> > +public class EnhancerVieWebFragment implements WebFragment {
> > +
> > + private static final String NAME = "enhancervie";
> > +
> > + private static final String STATIC_RESOURCE_PATH =
> "/org/apache/stanbol/enhancer/webvie/static";
> > +
> > + private static final String TEMPLATE_PATH =
> "/org/apache/stanbol/enhancer/webvie/templates";
> > +
> > + private BundleContext bundleContext;
> > +
> > + @Reference
> > + TcManager tcManager;
> > +
> > + @Reference
> > + Store store;
> > +
> > + @Reference
> > + EnhancementJobManager jobManager;
> > +
> > + @Reference
> > + Serializer serializer;
> > +
> > + @Override
> > + public String getName() {
> > + return NAME;
> > + }
> > +
> > + @Activate
> > + protected void activate(ComponentContext ctx) {
> > + this.bundleContext = ctx.getBundleContext();
> > + }
> > +
> > + @Override
> > + public Set<Class<?>> getJaxrsResourceClasses() {
> > + Set<Class<?>> classes = new HashSet<Class<?>>();
> > + classes.add(EnhancerVieRootResource.class);
> > + return classes;
> > + }
> > +
> > + @Override
> > + public Set<Object> getJaxrsResourceSingletons() {
> > + return Collections.emptySet();
> > + }
> > +
> > + @Override
> > + public String getStaticResourceClassPath() {
> > + return STATIC_RESOURCE_PATH;
> > + }
> > +
> > + @Override
> > + public TemplateLoader getTemplateLoader() {
> > + return new ClassTemplateLoader(getClass(), TEMPLATE_PATH);
> > + }
> > +
> > + @Override
> > + public List<LinkResource> getLinkResources() {
> > + List<LinkResource> resources = new ArrayList<LinkResource>();
> > +// resources.add(new LinkResource("stylesheet",
> "lib/Aristo/jquery-ui-1.8.7.custom.css", this, 10));
> > + resources.add(new LinkResource("stylesheet",
> "lib/Smoothness/jquery.ui.all.css", this, 10)); // version 1.8.13
> > +// resources.add(new LinkResource("stylesheet",
> "lib/Aristo/jquery.ui.menu.css", this, 10));
> > + return resources;
> > + }
> > +
> > + @Override
> > + public List<ScriptResource> getScriptResources() {
> > + List<ScriptResource> resources = new
> ArrayList<ScriptResource>();
> > + resources.add(new ScriptResource("text/javascript",
> "lib/jquery-1.5.1.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/jquery-ui.1.9m5.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/underscore-min.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/backbone.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/vie.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/vie-containermanager.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/vie-collectionmanager.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/hallo/hallo.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/hallo/format.js", this, 10));
> > +
> > + resources.add(new ScriptResource("text/javascript",
> "lib/jquery.rdfquery.debug.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/vie2/vie2-latest.debug.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/vie2/connector/stanbol.js", this, 10));
> > + resources.add(new ScriptResource("text/javascript",
> "lib/vie2/mapping/person.js", this, 10));
> > +
> > + resources.add(new ScriptResource("text/javascript",
> "lib/annotate.js", this, 10));
> > +
> > + return resources;
> > + }
> > +
> > + @Override
> > + public List<NavigationLink> getNavigationLinks() {
> > + List<NavigationLink> links = new ArrayList<NavigationLink>();
> > + links.add(new NavigationLink("enhancervie", "/enhancer VIE",
> "/imports/enhancervieDescription.ftl", 20));
> > + return links;
> > + }
> > +
> > + @Override
> > + public BundleContext getBundleContext() {
> > + return bundleContext;
> > + }
> > +
> > +}
> >
> > Added:
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java?rev=1143692&view=auto
> >
> ==============================================================================
> > ---
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
> (added)
> > +++
> incubator/stanbol/trunk/commons/web/webvie/src/main/java/org/apache/stanbol/enhancer/webvie/resource/EnhancerVieRootResource.java
> Thu Jul 7 07:38:24 2011
> > @@ -0,0 +1,27 @@
> > +package org.apache.stanbol.enhancer.webvie.resource;
> > +
> > +import static javax.ws.rs.core.MediaType.TEXT_HTML;
> > +
> > +import javax.ws.rs.GET;
> > +import javax.ws.rs.Path;
> > +import javax.ws.rs.Produces;
> > +
> > +import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
> > +
> > +import com.sun.jersey.api.view.Viewable;
> > +
> > +/**
> > + * Adapter to add a VIE based interface for the Stanbol Enhancer
> > + * @author Szaby Gruenwald
> > + */
> > +@Path("/enhancervie")
> > +public class EnhancerVieRootResource extends BaseStanbolResource {
> > +
> > +
> > + @GET
> > + @Produces(TEXT_HTML + ";qs=2")
> > + public Viewable getView() {
> > + return new Viewable("index", this);
> > + }
> > +
> > +}
> >
> > Added:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee?rev=1143692&view=auto
> >
> ==============================================================================
> > ---
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
> (added)
> > +++
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
> Thu Jul 7 07:38:24 2011
> > @@ -0,0 +1,677 @@
> > +# Annotate - a text enhancement interaction jQuery UI widget
> > +# (c) 2011 Szaby Gruenwald, IKS Consortium
> > +# Annotate may be freely distributed under the MIT license
> > +
> > +((jQuery) ->
> > + # The annotate.js widget
> > + #
> > +
> > + # define namespaces
> > + ns =
> > + rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
> > + enhancer: 'http://fise.iks-project.eu/ontology/'
> > + dc: 'http://purl.org/dc/terms/'
> > + rdfs: 'http://www.w3.org/2000/01/rdf-schema#'
> > +
> > + ANTT = ANTT or {}
> > + Stanbol = Stanbol or {}
> > +
> > + # filter for TextAnnotations
> > + Stanbol.getTextAnnotations = (enhRdf) ->
> > + res = _(enhRdf).map((obj, key) ->
> > + obj.id = key
> > + obj
> > + )
> > + .filter (e) ->
> > + e["#{ns.rdf}type"]
> > + .map((x) -> x.value)
> > + .indexOf("#{ns.enhancer}TextAnnotation") != -1
> > + res = _(res).sortBy (e) ->
> > + conf = Number e["#{ns.enhancer}confidence"][0].value if
> e["#{ns.enhancer}confidence"]
> > + -1 * conf
> > +
> > + _(res).map (s)->
> > + new Stanbol.TextEnhancement s, enhRdf
> > +
> > + # filter the entityManager for TextAnnotations
> > + Stanbol.getEntityAnnotations = (enhRdf) ->
> > + _(enhRdf)
> > + .map((obj, key) ->
> > + obj.id = key
> > + obj
> > + )
> > + .filter (e) ->
> > + e["#{ns.rdf}type"]
> > + .map((x) -> x.value)
> > + .indexOf("#{ns.enhancer}EntityAnnotation") != -1
> > +
> > + # Get the label in the user's language or the first one from a VIE
> entity
> > + ANTT.getRightLabel = (entity) ->
> > + labelMap = {}
> > + for label in _(entity["#{ns.rdfs}label"]).flatten()
> > + cleanLabel = label.value
> > + if cleanLabel.lastIndexOf "@" is cleanLabel.length - 3
> > + cleanLabel = cleanLabel.substring 0, cleanLabel.length -
> 3
> > + labelMap[label["xml:lang"]|| "_"] = cleanLabel
> > + userLang = window.navigator.language.split("-")[0]
> > + # Return the first best label
> > + labelMap[userLang] or labelMap["_"] or labelMap["en"]
> > +
> > + # Generic API for a TextEnhancement
> > + # A TextEnhancement object has the methods for getting generic
> > + # text-enhancement-specific properties.
> > + # TODO Place it into a global Stanbol object.
> > + Stanbol.TextEnhancement = (enhancement, enhRdf) ->
> > + @_enhancement = enhancement
> > + @_enhRdf = enhRdf
> > + @id = @_enhancement.id
> > + Stanbol.TextEnhancement.prototype =
> > + # the text the annotation is for
> > + getSelectedText: ->
> > + @_vals("#{ns.enhancer}selected-text")[0]
> > + # confidence value
> > + getConfidence: ->
> > + @_vals("#{ns.enhancer}confidence")[0]
> > + # get Entities suggested for the text enhancement (if any)
> > + getEntityEnhancements: ->
> > + rawList = _(Stanbol.getEntityAnnotations @_enhRdf ).filter
> (ann) =>
> > + relations = _(ann["#{ns.dc}relation"])
> > + .map (e) -> e.value
> > + if (relations.indexOf @_enhancement.id) isnt -1 then
> true
> > + else false
> > + _(rawList).map (ee) =>
> > + new Stanbol.EntityEnhancement ee, @
> > + # The type of the entity suggested (e.g. person, location,
> organization)
> > + getType: ->
> > + @_vals("#{ns.dc}type")[0]
> > + # Optional, not used
> > + getContext: ->
> > + @_vals("#{ns.enhancer}selection-context")[0]
> > + # start position in the original text
> > + getStart: ->
> > + Number @_vals("#{ns.enhancer}start")[0]
> > + # end position in the original text
> > + getEnd: ->
> > + Number @_vals("#{ns.enhancer}end")[0]
> > + # Optional
> > + getOrigText: ->
> > + ciUri = @_vals("#{ns.enhancer}extracted-from")[0]
> > + @_enhRdf[ciUri]["
> http://www.semanticdesktop.org/ontologies/2007/01/19/nie#plainTextContent
> "][0].value
> > + _vals: (key) ->
> > + _(@_enhancement[key])
> > + .map (x) -> x.value
> > +
> > + # Generic API for an EntityEnhancement. This is the implementation
> for Stanbol
> > + Stanbol.EntityEnhancement = (ee, textEnh) ->
> > + @_textEnhancement = textEnh
> > + $.extend @, ee
> > + Stanbol.EntityEnhancement.prototype =
> > + getLabel: ->
> > + @_vals("#{ns.enhancer}entity-label")[0]
> > + getUri: ->
> > + @_vals("#{ns.enhancer}entity-reference")[0]
> > + getTextEnhancement: ->
> > + @_textEnhancement
> > + getTypes: ->
> > + @_vals("#{ns.enhancer}entity-type")
> > + getConfidence: ->
> > + Number @_vals("#{ns.enhancer}confidence")[0]
> > + _vals: (key) ->
> > + _(@[key]).map (x) -> x.value
> > +
> > + # get or create a dom element containing only the occurrence of the
> found entity
> > + ANTT.getOrCreateDomElement = (element, text, options = {}) ->
> > + # Find occurrence indexes of s in str
> > + occurrences = (str, s) ->
> > + res = []
> > + last = 0
> > + while str.indexOf(s, last + 1) isnt -1
> > + next = str.indexOf s, last+1
> > + res.push next
> > + last = next
> > +
> > + # Find the nearest number among the
> > + nearest = (arr, nr) ->
> > + _(arr).sortedIndex nr
> > +
> > + # Nearest position
> > + nearestPosition = (str, s, ind) ->
> > + arr = occurrences(str,s)
> > + i1 = nearest arr, ind
> > + if arr.length is 1
> > + arr[0]
> > + else if i1 is arr.length
> > + arr[i1-1]
> > + else
> > + i0 = i1-1
> > + d0 = ind - arr[i0]
> > + d1 = arr[i1] - ind
> > + if d1 > d0 then arr[i0]
> > + else arr[i1]
> > +
> > + domEl = element
> > + textContentOf = (element) -> $(element).text().replace(/\n/g, "
> ")
> > + # find the text node
> > + if textContentOf(element).indexOf(text) is -1
> > + throw "'#{text}' doesn't appear in the text block."
> > + return $()
> > + start = options.start +
> > + textContentOf(element).indexOf textContentOf(element).trim()
> > + # Correct small position errors
> > + start = nearestPosition textContentOf(element), text, start
> > + pos = 0
> > + while textContentOf(domEl).indexOf(text) isnt -1 and
> domEl.nodeName isnt '#text'
> > + domEl = _(domEl.childNodes).detect (el) ->
> > + p = textContentOf(el).lastIndexOf text
> > + if p >= start - pos
> > + true
> > + else
> > + pos += textContentOf(el).length
> > + false
> > +
> > + if options.createMode is "existing" and
> textContentOf($(domEl).parent()) is text
> > + return $(domEl).parent()[0]
> > + else
> > + pos = start - pos
> > + len = text.length
> > + textToCut = textContentOf(domEl).substring(pos, pos+len)
> > + if textToCut is text
> > + domEl.splitText pos + len
> > + newElement = document.createElement
> options.createElement or 'span'
> > + newElement.innerHTML = text
> > + $(domEl).parent()[0].replaceChild newElement,
> domEl.splitText pos
> > + $ newElement
> > + else
> > + console.warn "dom element creation problem: #{textToCut}
> isnt #{text}"
> > +
> > + # Give back the last part of a uri for fallback label creation
> > + ANTT.uriSuffix = (uri) ->
> > + res = uri.substring uri.lastIndexOf("#") + 1
> > + res.substring res.lastIndexOf("/") + 1
> > +
> > + # jquery events cloning method
> > + ANTT.cloneCopyEvent = (src, dest) ->
> > + if dest.nodeType isnt 1 or not jQuery.hasData src
> > + return
> > +
> > + internalKey = $.expando
> > + oldData = $.data src
> > + curData = $.data dest, oldData
> > +
> > + # Switch to use the internal data object, if it exists, for the
> next
> > + # stage of data copying
> > + if oldData = oldData[internalKey]
> > + events = oldData.events
> > + curData = curData[ internalKey ] = jQuery.extend({},
> oldData);
> > +
> > + if events
> > + delete curData.handle
> > + curData.events = {}
> > +
> > + `for ( var type in events ) {
> > + for ( var i = 0, l = events[ type ].length; i < l;
> i++ ) {
> > + jQuery.event.add( dest, type + ( events[ type ][
> i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][
> i ], events[ type ][ i ].data );
> > + }
> > + }`
> > + null
> > +
> > + ######################################################
> > + # Annotate widget
> > + # makes a content dom element interactively annotatable
> > + ######################################################
> > + jQuery.widget 'IKS.annotate',
> > + __widgetName: "IKS.annotate"
> > + options:
> > + autoAnalyze: false
> > + debug: false
> > + # namespaces necessary for the widget configuration
> > + ns:
> > + dbpedia: "http://dbpedia.org/ontology/"
> > + skos: "http://www.w3.org/2004/02/skos/core#"
> > + # Give a label to your expected enhancement types
> > + getTypes: ->
> > + [
> > + uri: "#{@ns.dbpedia}Place"
> > + label: 'Place'
> > + ,
> > + uri: "#{@ns.dbpedia}Person"
> > + label: 'Person'
> > + ,
> > + uri: "#{@ns.dbpedia}Organisation"
> > + label: 'Organisation'
> > + ,
> > + uri: "#{@ns.skos}Concept"
> > + label: 'Concept'
> > + ]
> > + # Give a label to the sources the entities come from
> > + getSources: ->
> > + [
> > + uri: "http://dbpedia.org/resource/"
> > + label: "dbpedia"
> > + ,
> > + uri: "http://sws.geonames.org/"
> > + label: "geonames"
> > + ]
> > + _create: ->
> > + widget = @
> > + # logger can be turned on and off. It will show the real
> caller line in the log
> > + @_logger = if @options.debug then console else
> > + info: ->
> > + warn: ->
> > + error: ->
> > + # widget.entityCache.get(uri, cb) will get and cache the
> entity from an entityhub
> > + @entityCache = window.entityCache =
> > + _entities: {}
> > + # calling the get with a scope and callback will call
> cb(entity) with the scope as soon it's available.'
> > + get: (uri, scope, cb) ->
> > + # If entity is stored in the cache already just call
> cb
> > + if @_entities[uri] and @_entities[uri].status is
> "done"
> > + cb.apply scope, [@_entities[uri].entity]
> > + # If the entity is new to the cache
> > + else if not @_entities[uri]
> > + # create cache entry
> > + @_entities[uri] =
> > + status: "pending"
> > + uri: uri
> > + cache = @
> > + # make a request to the entity hub
> > + widget.options.connector.queryEntityHub uri,
> (entity) ->
> > + if not entity.status
> > + if entity.id isnt uri
> > + widget._logger.warn "wrong
> callback", uri, entity.id
> > + cache._entities[uri].entity = entity
> > + cache._entities[uri].status = "done"
> > + $(cache._entities[uri]).trigger "done",
> entity
> > + else
> > + widget._logger.warn "error getting
> entity", uri, entity
> > + if @_entities[uri] and @_entities[uri].status is
> "pending"
> > + $( @_entities[uri] )
> > + .bind "done", (event, entity) ->
> > + cb.apply scope, [entity]
> > + if @options.autoAnalyze
> > + @enable()
> > +
> > + # analyze the widget element and show text enhancements
> > + enable: (cb) ->
> > + analyzedNode = @element
> > + # the analyzedDocUri makes the connection between a document
> state and
> > + # the annotations to it. We have to clean up the annotations
> to any
> > + # old document state
> > +
> > + @options.connector.analyze @element,
> > + success: (rdf) =>
> > + # Get enhancements
> > + rdfJson = rdf.databank.dump()
> > +
> > + textAnnotations =
> Stanbol.getTextAnnotations(rdfJson)
> > + # Remove all textAnnotations without a selected text
> property
> > + textAnnotations = _(textAnnotations)
> > + .filter (textEnh) ->
> > + if textEnh.getSelectedText and
> textEnh.getSelectedText()
> > + true
> > + else
> > + false
> > + _(textAnnotations)
> > + .each (s) =>
> > + @_logger.info s._enhancement,
> > + 'confidence', s.getConfidence(),
> > + 'selectedText', s.getSelectedText(),
> > + 'type', s.getType(),
> > + 'EntityEnhancements',
> s.getEntityEnhancements()
> > + # Process the text enhancements
> > + @processTextEnhancement s, analyzedNode
> > + # trigger 'done' event with success = true
> > + @_trigger "done", true
> > + if typeof cb is "function"
> > + cb(true)
> > + # Remove all not accepted text enhancement widgets
> > + disable: ->
> > + $( ':IKS-annotationSelector', @element ).each () ->
> > + $(@).annotationSelector 'disable'
> > +
> > + # processTextEnhancement deals with one TextEnhancement in an
> ancestor element of its occurrence
> > + processTextEnhancement: (textEnh, parentEl) ->
> > + if not textEnh.getSelectedText()
> > + console.warn "textEnh", textEnh, "doesn't have
> selected-text!"
> > + return
> > + el = $ ANTT.getOrCreateDomElement parentEl[0],
> textEnh.getSelectedText(),
> > + createElement: 'span'
> > + createMode: 'existing'
> > + context: textEnh.getContext()
> > + start: textEnh.getStart()
> > + end: textEnh.getEnd()
> > + sType = textEnh.getType()
> > + widget = @
> > + el.addClass('entity')
> > + .addClass ANTT.uriSuffix(sType).toLowerCase()
> > + if textEnh.getEntityEnhancements().length
> > + el.addClass "withSuggestions"
> > + for eEnh in textEnh.getEntityEnhancements()
> > + eEnhUri = eEnh.getUri()
> > + @entityCache.get eEnhUri, eEnh, (entity) ->
> > + if this.getUri() isnt entity.id
> > + widget._logger.warn "wrong callback", entity.id,
> this.getUri()
> > +# widget._logger.info "entity for",
> textEnh.getSelectedText(), this.getUri(), entity
> > + # Create widget to select from the suggested entities
> > + options =
> > + cache: @entityCache
> > + $.extend options, @options
> > + el.annotationSelector( options )
> > + .annotationSelector 'addTextEnhancement', textEnh
> > +
> > + ######################################################
> > + # AnnotationSelector widget
> > + # the annotationSelector makes an annotated word interactive
> > + ######################################################
> > + ANTT.annotationSelector =
> > + jQuery.widget 'IKS.annotationSelector',
> > + # just for debugging and understanding
> > + __widgetName: "IKS.annotationSelector"
> > + options:
> > + ns:
> > + dbpedia: "http://dbpedia.org/ontology/"
> > + skos: "http://www.w3.org/2004/02/skos/core#"
> > + getTypes: ->
> > + [
> > + uri: "#{@ns.dbpedia}Place"
> > + label: 'Place'
> > + ,
> > + uri: "#{@ns.dbpedia}Person"
> > + label: 'Person'
> > + ,
> > + uri: "#{@ns.dbpedia}Organisation"
> > + label: 'Organisation'
> > + ,
> > + uri: "#{@ns.skos}Concept"
> > + label: 'Concept'
> > + ]
> > + getSources: ->
> > + [
> > + uri: "http://dbpedia.org/resource/"
> > + label: "dbpedia"
> > + ,
> > + uri: "http://sws.geonames.org/"
> > + label: "geonames"
> > + ]
> > +
> > + _create: ->
> > + @element.click =>
> > + if not @dialog
> > + @_createDialog()
> > + setTimeout((=> @dialog.open()), 220)
> > + # Collect all EntityEnhancements for all the
> TextEnhancements
> > + # on the selected node.
> > + eEnhancements = []
> > + for textEnh in @textEnhancements
> > + for enhancement in
> textEnh.getEntityEnhancements()
> > + eEnhancements.push enhancement
> > + # filter enhancements with the same uri
> > + # this is necessary because of a bug in stanbol that
> creates
> > + # duplicate enhancements.
> > + # https://issues.apache.org/jira/browse/STANBOL-228
> > + _tempUris = []
> > + eEnhancements = _(eEnhancements).filter (eEnh) ->
> > + uri = eEnh.getUri()
> > + if _tempUris.indexOf(uri) is -1
> > + _tempUris.push uri
> > + true
> > + else
> > + false
> > + @entityEnhancements = eEnhancements
> > +
> > + @_createSearchbox()
> > + if @entityEnhancements.length > 0
> > + @_createMenu() if @menu is undefined
> > + else @searchEntryField.find('.search').focus 100
> > + @_logger = if @options.debug then console else
> > + info: ->
> > + warn: ->
> > + error: ->
> > + _destroy: ->
> > + if @menu
> > + @menu.destroy()
> > + @menu.element.remove()
> > + delete @menu
> > + if @dialog
> > + @dialog.destroy()
> > + @dialog.element.remove()
> > + @dialog.uiDialogTitlebar.remove()
> > + delete @dialog
> > +
> > + # Produce type label list out of a uri list.
> > + # Filtered by the @options.types list
> > + _typeLabels: (types) ->
> > + knownMapping = @options.getTypes()
> > + allKnownPrefixes = _(knownMapping).map (x) -> x.uri
> > + knownPrefixes = _.intersect allKnownPrefixes, types
> > + _(knownPrefixes).map (key) =>
> > + foundPrefix = _(knownMapping).detect (x) -> x.uri is key
> > + foundPrefix.label
> > +
> > + # make a label for the entity source based on
> options.getSources()
> > + _sourceLabel: (src) ->
> > + sources = @options.getSources()
> > + sourceObj = _(sources).detect (s) -> src.indexOf(s.uri) isnt
> -1
> > + if sourceObj
> > + sourceObj.label
> > + else
> > + src.split("/")[2]
> > +
> > + # create dialog widget
> > + _createDialog: ->
> > + label = @element.text()
> > + dialogEl = $("<div><span class='entity-link'></span></div>")
> > + .attr( "tabIndex", -1)
> > + .addClass()
> > + .keydown( (event) =>
> > + if not event.isDefaultPrevented() and event.keyCode and
> event.keyCode is $.ui.keyCode.ESCAPE
> > + @close event
> > + event.preventDefault()
> > + )
> > + .bind('dialogblur', (event) =>
> > + @_logger.info 'dialog dialogblur'
> > + @close(event)
> > + )
> > + .bind('blur', (event) =>
> > + @_logger.info 'dialog blur'
> > + @close(event)
> > + )
> > + .appendTo( $("body")[0] )
> > + widget = @
> > + dialogEl.dialog
> > + width: 400
> > + title: label
> > + close: (event, ui) =>
> > + @close(event)
> > + autoOpen: false
> > + open: (e, ui) ->
> > + $.data(this, 'dialog').uiDialog.position {
> > + of: widget.element
> > + my: "left top"
> > + at: "left bottom"
> > + collision: "none"}
> > + @dialog = dialogEl.data 'dialog'
> > + @dialog.uiDialogTitlebar.hide()
> > + @_logger.info "dialog widget:", @dialog
> > + @dialog.element.focus(100)
> > + window.d = @dialog
> > + @_insertLink()
> > + @_updateTitle()
> > + @_setButtons()
> > +
> > + # If annotation is already made insert a link to the entity
> > + _insertLink: ->
> > + if @isAnnotated() and @dialog
> > + $("Annotated: <a href='#{@linkedEntity.uri}'
> target='_blank'>
> > + #{@linkedEntity.label} @
> #{@_sourceLabel(@linkedEntity.uri)}</a><br/>")
> > + .appendTo $( '.entity-link', @dialog.element )
> > + # create/update the dialog button row
> > + _setButtons: ->
> > + @dialog.element.dialog 'option', 'buttons',
> > + rem:
> > + text: if @isAnnotated() then 'Remove' else 'Decline'
> > + click: (event) =>
> > + @remove event
> > + Cancel: =>
> > + @close()
> > +
> > + # remove textEnhancement/annotation, replace the separate html
> > + # element with the plain text and close the dialog
> > + remove: (event) ->
> > + el = @element.parent()
> > + if not @isAnnotated() and @textEnhancements
> > + @_trigger 'decline', event,
> > + textEnhancements: @textEnhancements
> > + else
> > + @_trigger 'remove', event,
> > + textEnhancement: @_acceptedTextEnhancement
> > + entityEnhancement: @_acceptedEntityEnhancement
> > + linkedEntity: @linkedEntity
> > + @destroy()
> > + if @element.qname().name isnt '#text'
> > + @element.replaceWith document.createTextNode
> @element.text()
> > +
> > + # Remove the widget if not annotated.
> > + disable: ->
> > + if not @isAnnotated() and @element.qname().name isnt '#text'
> > + @element.replaceWith document.createTextNode
> @element.text()
> > +
> > + # tells if this is an annotated dom element (not a highlighted
> textEnhancement only)
> > + isAnnotated: ->
> > + if @element.attr 'about' then true else false
> > +
> > + # Place the annotation on the DOM element (about and typeof
> attributes)
> > + annotate: (entityEnhancement, styleClass) ->
> > + entityUri = entityEnhancement.getUri()
> > + entityType =
> entityEnhancement.getTextEnhancement().getType()
> > + entityHtml = @element.html()
> > + # We ignore the old style classes
> > + # entityClass = @element.attr 'class'
> > + sType = entityEnhancement.getTextEnhancement().getType()
> > + entityClass = 'entity ' +
> ANTT.uriSuffix(sType).toLowerCase()
> > + newElement = $ "<a href='#{entityUri}'
> > + about='#{entityUri}'
> > + typeof='#{entityType}'
> > + class='#{entityClass}'>#{entityHtml}</a>"
> > + ANTT.cloneCopyEvent @element[0], newElement[0]
> > + @linkedEntity =
> > + uri: entityUri
> > + type: entityType
> > + label: entityEnhancement.getLabel()
> > + @element.replaceWith newElement
> > + @element = newElement.addClass styleClass
> > + @_logger.info "created annotation in", @element
> > + @_updateTitle()
> > + @_insertLink()
> > + @_acceptedTextEnhancement =
> entityEnhancement.getTextEnhancement()
> > + @_acceptedEntityEnhancement = entityEnhancement
> > + @_trigger 'select', null,
> > + linkedEntity: @linkedEntity
> > + textEnhancement: entityEnhancement.getTextEnhancement()
> > + entityEnhancement: entityEnhancement
> > + # closing the widget
> > + close: ->
> > + @destroy()
> > + _updateTitle: ->
> > + if @dialog
> > + if @isAnnotated()
> > + title = "#{@linkedEntity.label} <small>@
> #{@_sourceLabel(@linkedEntity.uri)}</small>"
> > + else
> > + title = @element.text()
> > + @dialog._setOption 'title', title
> > +
> > + # create menu and add to the dialog
> > + _createMenu: ->
> > + ul = $('<ul></ul>')
> > + .appendTo( @dialog.element )
> > + @_renderMenu ul, @entityEnhancements
> > + @menu = ul
> > + .menu({
> > + select: (event, ui) =>
> > + @_logger.info "selected menu item", ui.item
> > + @annotate ui.item.data('enhancement'),
> 'acknowledged'
> > + @close(event)
> > + blur: (event, ui) =>
> > + @_logger.info 'menu.blur()', ui.item
> > + focus: (event, ui) =>
> > + @_logger.info 'menu.focus()', ui.item
> > + # show preview
> > + @_entityPreview ui.item
> > + })
> > + .bind('blur', (event, ui) ->
> > + @_logger.info 'menu blur', ui
> > + )
> > + .bind('menublur', (event, ui) ->
> > + @_logger.info 'menu menublur', ui.item
> > + )
> > + .focus(150)
> > + .data 'menu'
> > +
> > + # Rendering menu for the EntityEnhancements suggested for the
> selected text
> > + _renderMenu: (ul, entityEnhancements) ->
> > + entityEnhancements = _(entityEnhancements).sortBy (ee) -> -1
> * ee.getConfidence()
> > + @_renderItem ul, enhancement for enhancement in
> entityEnhancements
> > + @_logger.info 'rendered menu for the elements',
> entityEnhancements
> > + _renderItem: (ul, eEnhancement) ->
> > + label = eEnhancement.getLabel().replace /^\"|\"$/g, ""
> > + type = @_typeLabels eEnhancement.getTypes()
> > + source = @_sourceLabel eEnhancement.getUri()
> > + active = if @linkedEntity and eEnhancement.getUri() is
> @linkedEntity.uri
> > + " class='ui-state-active'"
> > + else ""
> > + $("<li#{active}><a href='#'>#{label} <small>(#{type} from
> #{source})</small></a></li>")
> > + .data('enhancement', eEnhancement)
> > + .appendTo ul
> > +
> > + # Render search box with autocompletion for finding the right
> entity
> > + _createSearchbox: ->
> > + # Show an input box for autocompleted search
> > + @searchEntryField = $('<span style="background: fff;"><label
> for="search">Search:</label> <input id="search" class="search"></span>')
> > + .appendTo @dialog.element
> > + sugg = @textEnhancements[0]
> > + widget = @
> > + $( '.search', @searchEntryField )
> > + .autocomplete
> > + # Define source method. TODO make independent from
> stanbol.
> > + source: (req, resp) ->
> > + widget._logger.info "req:", req
> > + widget.options.connector.findEntity
> "#{req.term}#{'*' if req.term.length > 3}", (entityList) ->
> > + widget._logger.info "resp:", _(entityList).map
> (ent) ->
> > + ent.id
> > + res = for i, entity of entityList
> > + {
> > + key: entity.id
> > + label: "#{ANTT.getRightLabel entity} @
> #{widget._sourceLabel entity.id}"
> > + _label: ANTT.getRightLabel entity
> > + getLabel: -> @_label
> > + getUri: -> @key
> > + # To rethink: The type of the annotation
> (person, place, org)
> > + # should come from the search result, not
> from the first textEnhancement
> > + _tEnh: sugg
> > + getTextEnhancement: -> @_tEnh
> > + }
> > + resp res
> > + # An entity selected, annotate
> > + select: (e, ui) =>
> > + @annotate ui.item, "acknowledged"
> > + @_logger.info "autocomplete.select", e.target, ui
> > + focus: (e, ui) =>
> > + @_logger.info "autocomplete.focus", e.target, ui
> > + @_entityPreview ui.item
> > + .focus(200)
> > + .blur (e, ui) =>
> > + @_dialogCloseTimeout = setTimeout ( => @close()), 200
> > + @_logger.info "show searchbox"
> > + # Show preview of a hovered item
> > + _entityPreview: _.throttle(( (item) ->
> > + @_logger.info "Show preview for", item
> > + ), 1500)
> > +
> > + # add a textEnhancement that gets shown when the dialog is
> rendered
> > + addTextEnhancement: (textEnh) ->
> > + @options.textEnhancements = @options.textEnhancements or []
> > + @options.textEnhancements.push textEnh
> > + @textEnhancements = @options.textEnhancements
> > +
> > + window.ANTT = ANTT
> > +) jQuery
> >
> > Added:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png?rev=1143692&view=auto
> >
> ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/bg_fallback.png
> >
> ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> > Added:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png?rev=1143692&view=auto
> >
> ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/icon_sprite.png
> >
> ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> > Added:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif?rev=1143692&view=auto
> >
> ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/progress_bar.gif
> >
> ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> > Added:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png?rev=1143692&view=auto
> >
> ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/slider_handles.png
> >
> ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> > Added:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png?rev=1143692&view=auto
> >
> ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_222222_256x240.png
> >
> ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> > Added:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
> > URL:
> http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png?rev=1143692&view=auto
> >
> ==============================================================================
> > Binary file - no diff available.
> >
> > Propchange:
> incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/Aristo/images/ui-icons_454545_256x240.png
> >
> ------------------------------------------------------------------------------
> > svn:mime-type = application/octet-stream
> >
> >
> >
>
>
>
> --
> Fabian
>