You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by wk...@apache.org on 2011/06/10 13:12:18 UTC

svn commit: r1134279 - /incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java

Author: wkasper
Date: Fri Jun 10 11:12:18 2011
New Revision: 1134279

URL: http://svn.apache.org/viewvc?rev=1134279&view=rev
Log:
Display text extracts for non-plain text documents

Modified:
    incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java

Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java?rev=1134279&r1=1134278&r2=1134279&view=diff
==============================================================================
--- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java (original)
+++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/ContentItemResource.java Fri Jun 10 11:12:18 2011
@@ -6,6 +6,7 @@ import static org.apache.stanbol.enhance
 import static org.apache.stanbol.enhancer.servicesapi.rdf.OntologicalClasses.DBPEDIA_PLACE;
 import static org.apache.stanbol.enhancer.servicesapi.rdf.Properties.GEO_LAT;
 import static org.apache.stanbol.enhancer.servicesapi.rdf.Properties.GEO_LONG;
+import static org.apache.stanbol.enhancer.servicesapi.rdf.Properties.NIE_PLAINTEXTCONTENT;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -118,6 +119,12 @@ public class ContentItemResource extends
             } else if (ci.getMimeType().startsWith("image/")) {
                 this.imageSrc = rawURI;
             }
+            else {
+              Iterator<Triple> it = ci.getMetadata().filter(new UriRef(ci.getId()), NIE_PLAINTEXTCONTENT, null);
+              if (it.hasNext()) {
+                this.textContent = ((Literal)it.next().getObject()).getLexicalForm();
+              }
+            }
             this.downloadHref = rawURI;
             this.metadataHref = uriInfo.getBaseUriBuilder().path("/store/metadata").path(localId).build();
         }