Modified: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource.java?rev=1297071&r1=1297070&r2=1297071&view=diff ============================================================================== --- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource.java (original) +++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource.java Mon Mar 5 14:31:28 2012 @@ -17,69 +17,48 @@ package org.apache.stanbol.enhancer.jersey.resource; import static javax.ws.rs.core.MediaType.APPLICATION_FORM_URLENCODED; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static javax.ws.rs.core.MediaType.APPLICATION_XML; import static javax.ws.rs.core.MediaType.TEXT_HTML; -import static javax.ws.rs.core.MediaType.TEXT_PLAIN; -import static javax.ws.rs.core.MediaType.WILDCARD; -import static org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper.*; +import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N3; +import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.N_TRIPLE; +import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_JSON; +import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.RDF_XML; +import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.TURTLE; +import static org.apache.clerezza.rdf.core.serializedform.SupportedFormat.X_TURTLE; import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin; -import static org.apache.stanbol.commons.web.base.CorsHelper.enableCORS; - -import java.io.IOException; -import java.net.URI; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import static org.apache.stanbol.enhancer.jersey.utils.EnhancerUtils.addActiveChains; +import static org.apache.stanbol.enhancer.jersey.utils.EnhancerUtils.addActiveEngines; import javax.servlet.ServletContext; import javax.ws.rs.Consumes; import javax.ws.rs.FormParam; import javax.ws.rs.GET; -import javax.ws.rs.OPTIONS; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; -import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; -import org.apache.clerezza.rdf.core.Graph; import org.apache.clerezza.rdf.core.MGraph; -import org.apache.clerezza.rdf.core.NonLiteral; -import org.apache.clerezza.rdf.core.TripleCollection; import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.access.TcManager; -import org.apache.clerezza.rdf.core.serializedform.Serializer; -import org.apache.stanbol.commons.web.base.ContextHelper; -import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource; -import org.apache.stanbol.commons.web.base.utils.MediaTypeUtil; -import org.apache.stanbol.enhancer.jersey.utils.EnhancementPropertiesHelper; -import org.apache.stanbol.enhancer.servicesapi.Chain; -import org.apache.stanbol.enhancer.servicesapi.ChainException; -import org.apache.stanbol.enhancer.servicesapi.ChainManager; -import org.apache.stanbol.enhancer.servicesapi.ContentItem; -import org.apache.stanbol.enhancer.servicesapi.EngineException; -import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine; -import org.apache.stanbol.enhancer.servicesapi.EnhancementEngineManager; -import org.apache.stanbol.enhancer.servicesapi.EnhancementException; -import org.apache.stanbol.enhancer.servicesapi.EnhancementJobManager; -import org.apache.stanbol.enhancer.servicesapi.NoSuchPartException; -import org.apache.stanbol.enhancer.servicesapi.helper.ExecutionPlanHelper; -import org.apache.stanbol.enhancer.servicesapi.helper.InMemoryContentItem; -import org.apache.stanbol.enhancer.servicesapi.rdf.ExecutionMetadata; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.clerezza.rdf.core.impl.SimpleMGraph; +import org.apache.clerezza.rdf.core.impl.TripleImpl; +import org.apache.clerezza.rdf.core.sparql.ParseException; +import org.apache.clerezza.rdf.core.sparql.QueryParser; +import org.apache.clerezza.rdf.core.sparql.query.ConstructQuery; +import org.apache.clerezza.rdf.core.sparql.query.DescribeQuery; +import org.apache.clerezza.rdf.core.sparql.query.Query; +import org.apache.clerezza.rdf.ontologies.RDF; +import org.apache.stanbol.enhancer.servicesapi.SparqlQueryEngine.SparqlQueryEngineException; +import org.apache.stanbol.enhancer.servicesapi.rdf.Enhancer; import com.sun.jersey.api.view.Viewable; + /** * RESTful interface to browse the list of available engines and allow to call them in a stateless, * synchronous way. @@ -88,326 +67,60 @@ import com.sun.jersey.api.view.Viewable; * instead. */ @Path("/enhancer") -public class EnhancerRootResource extends BaseStanbolResource { - - public final Logger log = LoggerFactory.getLogger(getClass()); - - protected EnhancementJobManager jobManager; - - protected TcManager tcManager; - - /** - * The chain. The default chain in this case, but might be set by sub-classes - */ - protected Chain chain; - private LinkedHashSet<ExecutionNode> _executionNodes; - private LinkedHashSet<ExecutionNode> _activeNodes; - protected EnhancementEngineManager engineManager; - protected ChainManager chainManager; - - protected Serializer serializer; +public final class EnhancerRootResource extends AbstractEnhancerUiResource { - public EnhancerRootResource(@Context ServletContext context) { - // bind the job manager by looking it up from the servlet request context - jobManager = ContextHelper.getServiceFromContext(EnhancementJobManager.class, context); - tcManager = ContextHelper.getServiceFromContext(TcManager.class, context); - serializer = ContextHelper.getServiceFromContext(Serializer.class, context); - chainManager = ContextHelper.getServiceFromContext(ChainManager.class, context); - engineManager = ContextHelper.getServiceFromContext(EnhancementEngineManager.class, context); - chain = chainManager.getDefault(); + public EnhancerRootResource(@Context ServletContext context){ + super(null,context); } - - public URI getServiceUrl() { - return uriInfo.getAbsolutePath(); - } - - @OPTIONS - public Response handleCorsPreflight(@Context HttpHeaders headers) { - ResponseBuilder res = Response.ok(); - enableCORS(servletContext, res, headers); - return res.build(); - } - + @GET - @Produces(TEXT_HTML) - public Response get(@Context HttpHeaders headers) { - ResponseBuilder res = Response.ok(new Viewable("index", this), TEXT_HTML); - addCORSOrigin(servletContext, res, headers); + @Produces(value={APPLICATION_JSON,N3,N_TRIPLE,RDF_JSON,RDF_XML,TURTLE,X_TURTLE}) + public Response getEngines(@Context HttpHeaders headers){ + MGraph graph = getEnhancerConfigGraph(); + ResponseBuilder res = Response.ok(graph); + addCORSOrigin(servletContext,res, headers); return res.build(); } - public boolean isEngineActive(String name) { - return engineManager.isEngine(name); - } - /** - * Getter for the executionNodes - * - * @return + * Creates the RDF graph for the current Stanbol Enhancer configuration + * @return the graph with the configuration */ - public Set<ExecutionNode> getExecutionNodes() { - if (_executionNodes == null) { - Graph ep; - try { - ep = chain.getExecutionPlan(); - } catch (ChainException e) { - ep = null; - } - if (ep != null) { - _executionNodes = new LinkedHashSet<ExecutionNode>(); - Set<NonLiteral> processed = new HashSet<NonLiteral>(); - Set<NonLiteral> next; - do { - next = ExecutionPlanHelper.getExecutable(ep, processed); - for (NonLiteral node : next) { - _executionNodes.add(new ExecutionNode(ep, node)); - } - processed.addAll(next); - } while (!next.isEmpty()); - } - } - return _executionNodes; + private MGraph getEnhancerConfigGraph() { + String rootUrl = uriInfo.getBaseUriBuilder().path(getRootUrl()).build().toString(); + UriRef enhancerResource = new UriRef(rootUrl+"enhancer"); + MGraph graph = new SimpleMGraph(); + graph.add(new TripleImpl(enhancerResource, RDF.type, Enhancer.ENHANCER)); + addActiveEngines(engineManager, graph, rootUrl); + addActiveChains(chainManager, graph, rootUrl); + return graph; } - - public Set<ExecutionNode> getActiveNodes() { - if (_activeNodes == null) { - Set<ExecutionNode> ens = getExecutionNodes(); - if (ens != null) { - _activeNodes = new LinkedHashSet<ExecutionNode>(); - for (ExecutionNode en : ens) { - if (en.isEngineActive()) { - _activeNodes.add(en); - } - } - } - } - return _activeNodes; - } - - // public EnhancementEngine getEngine(String name){ - // return engineManager.getEngine(name); - // } - // public Map<String,EnhancementEngine> getActiveEngines() { - // Graph ep; - // try { - // ep = chain.getExecutionPlan(); - // } catch (ChainException e) { - // return null; - // } - // Map<String,EnhancementEngine> active; - // if(ep != null){ - // active = new HashMap<String,EnhancementEngine>(); - // for(EnhancementEngine engine : ExecutionPlanHelper.getActiveEngines(engineManager, ep)){ - // active.put(engine.getName(), engine); - // } - // } else { - // active = null; - // } - // return active; - // } - - public Chain getChain() { - return chain; - } - - public boolean isChainAvailable() { - Set<ExecutionNode> nodes = getExecutionNodes(); - if (nodes == null) { - return false; - } - for (ExecutionNode node : getExecutionNodes()) { - if (!node.isOptional() && !node.isEngineActive()) { - return false; - } - } - return true; - } - - public static String makeEngineId(EnhancementEngine engine) { - // TODO: add a property on engines to provided custom local ids and make - // this static method a method of the interface EnhancementEngine - String engineClassName = engine.getClass().getSimpleName(); - String suffixToRemove = "EnhancementEngine"; - if (engineClassName.endsWith(suffixToRemove)) { - engineClassName = engineClassName - .substring(0, engineClassName.length() - suffixToRemove.length()); + + @GET + @Path("/sparql") + @Consumes(APPLICATION_FORM_URLENCODED) + @Produces({TEXT_HTML + ";qs=2", "application/sparql-results+xml", "application/rdf+xml", APPLICATION_XML}) + public Object sparql(@QueryParam(value = "query") String sparqlQuery) throws SparqlQueryEngineException, + ParseException { + if (sparqlQuery == null) { + return Response.ok(new Viewable("sparql", this), TEXT_HTML).build(); + } + Query query = QueryParser.getInstance().parse(sparqlQuery); + String mediaType = "application/sparql-results+xml"; + if (query instanceof DescribeQuery || query instanceof ConstructQuery) { + mediaType = "application/rdf+xml"; } - return engineClassName.toLowerCase(); + Object result = tcManager.executeSparqlQuery(query, getEnhancerConfigGraph()); + return Response.ok(result, mediaType).build(); } - /** - * Form-based OpenCalais-compatible interface - * - * TODO: should we parse the OpenCalais paramsXML and find the closest Stanbol Enhancer semantics too? - * - * Note: the format parameter is not part of the official API - * - * @throws EngineException - * if the content is somehow corrupted - * @throws IOException - */ @POST + @Path("/sparql") @Consumes(APPLICATION_FORM_URLENCODED) - public Response enhanceFromForm(@FormParam("content") String content, - @FormParam("format") String format, - @FormParam("ajax") boolean buildAjaxview, - @Context HttpHeaders headers) throws EnhancementException, IOException { - log.info("enhance from From: " + content); - ContentItem ci = new InMemoryContentItem(content.getBytes("UTF-8"), TEXT_PLAIN); -// ci.addPart(ENHANCEMENT_PROPERTIES_URI, Collections.singletonMap(INCLUDE_EXECUTION_METADATA, false)); - return enhanceAndBuildResponse(format, headers, ci, buildAjaxview); - } - - /** - * Media-Type based handling of the raw POST data. - * - * @param data - * binary payload to analyze - * @param uri - * optional URI for the content items (to be used as an identifier in the enhancement graph) - * @throws EngineException - * if the content is somehow corrupted - * @throws IOException - */ - @POST - @Consumes(WILDCARD) - public Response enhanceFromData(ContentItem ci, - @QueryParam(value = "uri") String uri, - @QueryParam(value = "executionmetadata") boolean inclExecMetadata, - @QueryParam(value = "outputContent") Set<String> mediaTypes, - @QueryParam(value = "omitParsed") boolean omitParsed, - @QueryParam(value = "outputContentPart") Set<String> contentParts, - @QueryParam(value = "omitMetadata") boolean omitMetadata, - @QueryParam(value = "rdfFormat") String rdfFormat, - @Context HttpHeaders headers) throws EnhancementException, IOException { - Map<String,Object> enhancementProperties = getEnhancementProperties(ci); - enhancementProperties.put(INCLUDE_EXECUTION_METADATA, inclExecMetadata); - if(mediaTypes != null && !mediaTypes.isEmpty()){ - enhancementProperties.put(OUTPUT_CONTENT, mediaTypes); - } - enhancementProperties.put(OMIT_PARSED_CONTENT, omitParsed); - if(contentParts != null && !contentParts.isEmpty()){ - Set<UriRef> outputContentParts = new HashSet<UriRef>(); - for(String contentPartUri : contentParts){ - if(contentPartUri != null && !contentPartUri.isEmpty()){ - if("*".equals(contentPartUri)){ - outputContentParts.add(null); //indicated wildcard - } else { - outputContentParts.add(new UriRef(contentPartUri)); - } - } - } - enhancementProperties.put(OUTPUT_CONTENT_PART, outputContentParts); - } - enhancementProperties.put(OMIT_METADATA, omitMetadata); - if(rdfFormat != null && !rdfFormat.isEmpty()){ - try { - enhancementProperties.put(RDF_FORMAT,MediaType.valueOf(rdfFormat).toString()); - } catch (IllegalArgumentException e) { - throw new WebApplicationException(e, - Response.status(Response.Status.BAD_REQUEST) - .entity(String.format("Unable to parse MediaType form parameter" + - "rdfFormat=%s",rdfFormat)) - .build()); - } - } -// String format = TEXT_PLAIN; -// if (headers.getMediaType() != null) { -// format = headers.getMediaType().toString(); -// } -// if (uri != null && uri.isEmpty()) { -// // let the store build an internal URI based on the content -// uri = null; -// } -// ContentItem ci = new InMemoryContentItem(uri, data, format); - return enhanceAndBuildResponse(null, headers, ci, false); - } - - protected Response enhanceAndBuildResponse(String format, - HttpHeaders headers, - ContentItem ci, - boolean buildAjaxview) throws EnhancementException, - IOException { - Map<String,Object> enhancementPropertis = EnhancementPropertiesHelper.getEnhancementProperties(ci); - if (jobManager != null) { - jobManager.enhanceContent(ci, chain); - } - - if (buildAjaxview) { - ContentItemResource contentItemResource = new ContentItemResource(null, ci, uriInfo, "", - tcManager, serializer, servletContext); - contentItemResource.setRdfSerializationFormat(format); - Viewable ajaxView = new Viewable("/ajax/contentitem", contentItemResource); - ResponseBuilder rb = Response.ok(ajaxView); - rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=UTF-8"); - addCORSOrigin(servletContext, rb, headers); - return rb.build(); - } - - MGraph graph = ci.getMetadata(); - Boolean includeExecutionMetadata = (Boolean)enhancementPropertis.get(INCLUDE_EXECUTION_METADATA); - if (includeExecutionMetadata != null && includeExecutionMetadata.booleanValue()) { - try { - graph.addAll(ci.getPart(ExecutionMetadata.CHAIN_EXECUTION, MGraph.class)); - } catch (NoSuchPartException e) { - // no executionMetadata available - } - } - ResponseBuilder rb = Response.ok(ci); - // List<String> accepted = headers.getRequestHeader(HttpHeaders.ACCEPT); - MediaType mediaType = MediaTypeUtil.getAcceptableMediaType(headers, null); - // This can be used to create a customised WebExection. Jersey will sent - // a 500er response code in any case - // if(isAcceptableMediaType(mediaType, SUPPORTED_RDF_TYPES)){ - // //USE THIS for special error response - // } - if (mediaType != null) { - rb.header(HttpHeaders.CONTENT_TYPE, mediaType); - } - - addCORSOrigin(servletContext, rb, headers); - return rb.build(); - } - - public class ExecutionNode { - - private final NonLiteral node; - private final TripleCollection ep; - private final boolean optional; - private final String engineName; - - public ExecutionNode(TripleCollection executionPlan, NonLiteral node) { - this.node = node; - this.ep = executionPlan; - this.optional = ExecutionPlanHelper.isOptional(ep, node); - this.engineName = ExecutionPlanHelper.getEngine(ep, node); - } - - public boolean isOptional() { - return optional; - } - - public String getEngineName() { - return engineName; - } - - public EnhancementEngine getEngine() { - return engineManager.getEngine(engineName); - } - - public boolean isEngineActive() { - return engineManager.isEngine(engineName); - } - - @Override - public int hashCode() { - return node.hashCode(); - } - - @Override - public boolean equals(Object o) { - return o instanceof ExecutionNode && ((ExecutionNode) o).node.equals(node); - } + @Produces({"application/sparql-results+xml", "application/rdf+xml", APPLICATION_XML}) + public Object postSparql(@FormParam("query") String sparqlQuery) throws SparqlQueryEngineException, + ParseException { + return sparql(sparqlQuery); } }
Added: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/utils/EnhancerUtils.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/utils/EnhancerUtils.java?rev=1297071&view=auto ============================================================================== --- incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/utils/EnhancerUtils.java (added) +++ incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/utils/EnhancerUtils.java Mon Mar 5 14:31:28 2012 @@ -0,0 +1,169 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.stanbol.enhancer.jersey.utils; + +import static org.apache.stanbol.enhancer.servicesapi.rdf.Enhancer.ENHANCEMENT_ENGINE; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.clerezza.rdf.core.MGraph; +import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl; +import org.apache.clerezza.rdf.core.impl.TripleImpl; +import org.apache.clerezza.rdf.ontologies.RDF; +import org.apache.clerezza.rdf.ontologies.RDFS; +import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource; +import org.apache.stanbol.enhancer.servicesapi.Chain; +import org.apache.stanbol.enhancer.servicesapi.ChainManager; +import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine; +import org.apache.stanbol.enhancer.servicesapi.EnhancementEngineManager; +import org.apache.stanbol.enhancer.servicesapi.rdf.Enhancer; +import org.osgi.framework.ServiceReference; + +public final class EnhancerUtils { + + private EnhancerUtils(){}; + + + /** + * Uses the parsed {@link EnhancementEngineManager} to build a Map + * representing the current snapshot of the active enhancement engines. + * + * @param engineManager The engine manager used to build the snapshot + * @return the map with the names as key and an Entry with the {@link ServiceReference} + * and the {@link EnhancementEngine} instance as value. + */ + public static Map<String, Entry<ServiceReference,EnhancementEngine>> buildEnginesMap(EnhancementEngineManager engineManager) { + Map<String, Entry<ServiceReference,EnhancementEngine>> engines = new HashMap<String,Map.Entry<ServiceReference,EnhancementEngine>>(); + for(String engineName : engineManager.getActiveEngineNames()){ + ServiceReference engineRef = engineManager.getReference(engineName); + if(engineRef != null){ + EnhancementEngine engine = engineManager.getEngine(engineRef); + if(engine != null){ + Map<ServiceReference,EnhancementEngine> m = Collections.singletonMap(engineRef, engine); + engines.put(engineName, m.entrySet().iterator().next()); + } + } + } + return engines; + } + /** + * Uses the parsed {@link ChainManager} to build a Map + * representing the current snapshot of the active enhancement chains. + * + * @param chainManager The chain manager used to build the snapshot + * @return the map with the names as key and an Entry with the {@link ServiceReference} + * and the {@link Chain} instance as value. + */ + public static Map<String,Map.Entry<ServiceReference,Chain>> buildChainsMap(ChainManager chainManager) { + Map<String,Map.Entry<ServiceReference,Chain>> chains = new HashMap<String,Map.Entry<ServiceReference,Chain>>(); + for(String chainName : chainManager.getActiveChainNames()){ + ServiceReference chainRef = chainManager.getReference(chainName); + if(chainRef != null){ + Chain chain = chainManager.getChain(chainRef); + if(chain != null){ + Map<ServiceReference,Chain> m = Collections.singletonMap(chainRef, chain); + chains.put(chainName, m.entrySet().iterator().next()); + } + } + } + return chains; + } + /** + * Create the RDF data for the currently active EnhancementEngines.<p> + * Note the the parsed rootUrl MUST already consider offsets configured + * for the Stanbol RESTful service. When called from within a + * {@link BaseStanbolResource} the following code segment should be used:<p> + * <code><pre> + * String rootUrl = uriInfo.getBaseUriBuilder().path(getRootUrl()).build().toString(); + * </pre></code> + * @param engineManager the enhancement engine manager + * @param graph the RDF graph to add the triples + * @param rootUrl the root URL used by the current request + */ + public static void addActiveEngines(EnhancementEngineManager engineManager,MGraph graph, String rootUrl) { + addActiveEngines(buildEnginesMap(engineManager).values(), graph, rootUrl); + } + /** + * Create the RDF data for the currently active EnhancementEngines.<p> + * Note the the parsed rootUrl MUST already consider offsets configured + * for the Stanbol RESTful service. When called from within a + * {@link BaseStanbolResource} the following code segment should be used:<p> + * <code><pre> + * String rootUrl = uriInfo.getBaseUriBuilder().path(getRootUrl()).build().toString(); + * </pre></code> + * @param activeEngines the active enhancement engines as {@link Entry entries}. + * @param graph the RDF graph to add the triples + * @param rootUrl the root URL used by the current request + * @see EnhancerUtils#buildEnginesMap(EnhancementEngineManager) + */ + public static void addActiveEngines(Iterable<Entry<ServiceReference,EnhancementEngine>> activeEngines,MGraph graph, String rootUrl) { + UriRef enhancerResource = new UriRef(rootUrl+"enhancer"); + graph.add(new TripleImpl(enhancerResource, RDF.type, Enhancer.ENHANCER)); + for(Entry<ServiceReference,EnhancementEngine> entry : activeEngines){ + UriRef engineResource = new UriRef(rootUrl+"enhancer/engine/"+entry.getValue().getName()); + graph.add(new TripleImpl(enhancerResource, Enhancer.HAS_ENGINE, engineResource)); + graph.add(new TripleImpl(engineResource, RDF.type, ENHANCEMENT_ENGINE)); + graph.add(new TripleImpl(engineResource, RDFS.label, new PlainLiteralImpl(entry.getValue().getName()))); + } + } + + /** + * Create the RDF data for the currently active Enhancement {@link Chain}s.<p> + * Note the the parsed rootUrl MUST already consider offsets configured + * for the Stanbol RESTful service. When called from within a + * {@link BaseStanbolResource} the following code segment should be used:<p> + * <code><pre> + * String rootUrl = uriInfo.getBaseUriBuilder().path(getRootUrl()).build().toString(); + * </pre></code> + * @param chainManager the enhancement chain manager. + * @param graph the RDF graph to add the triples + * @param rootUrl the root URL used by the current request + */ + public static void addActiveChains(ChainManager chainManager, MGraph graph, String rootUrl) { + addActiveChains(buildChainsMap(chainManager).values(), chainManager.getDefault(), graph, rootUrl); + } + /** + * Create the RDF data for the currently active Enhancement {@link Chain}s.<p> + * Note the the parsed rootUrl MUST already consider offsets configured + * for the Stanbol RESTful service. When called from within a + * {@link BaseStanbolResource} the following code segment should be used:<p> + * <code><pre> + * String rootUrl = uriInfo.getBaseUriBuilder().path(getRootUrl()).build().toString(); + * </pre></code> + * @param activeChains the active enhancement chains as {@link Entry entries}. + * @param defaultChain the default chain + * @param graph the RDF graph to add the triples + * @param rootUrl the root URL used by the current request + */ + public static void addActiveChains(Iterable<Entry<ServiceReference,Chain>> activeChains, Chain defaultChain, MGraph graph, String rootUrl) { + UriRef enhancer = new UriRef(rootUrl+"enhancer"); + graph.add(new TripleImpl(enhancer, RDF.type, Enhancer.ENHANCER)); + for(Entry<ServiceReference,Chain> entry : activeChains){ + UriRef chainResource = new UriRef(rootUrl+"enhancer/chain/"+entry.getValue().getName()); + graph.add(new TripleImpl(enhancer, Enhancer.HAS_CHAIN, chainResource)); + if(entry.getValue().equals(defaultChain)){ + graph.add(new TripleImpl(enhancer, Enhancer.HAS_DEFAULT_CHAIN, chainResource)); + } + graph.add(new TripleImpl(chainResource, RDF.type, Enhancer.ENHANCEMENT_CHAIN)); + graph.add(new TripleImpl(chainResource, RDFS.label, new PlainLiteralImpl(entry.getValue().getName()))); + } + } +} Propchange: incubator/stanbol/trunk/enhancer/jersey/src/main/java/org/apache/stanbol/enhancer/jersey/utils/EnhancerUtils.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancersparql.ftl URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancersparql.ftl?rev=1297071&view=auto ============================================================================== --- incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancersparql.ftl (added) +++ incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/imports/enhancersparql.ftl Mon Mar 5 14:31:28 2012 @@ -0,0 +1,63 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<#macro form> +<form id="sparql" action="${it.rootUrl}enhancer/sparql" method="GET" + enctype="application/x-www-form-urlencoded" + accept="application/sparql-results+xml, application/rdf+xml"> +<textarea class="query" rows="11" name="query"> +PREFIX enhancer: <http://stanbol.apache.org/ontology/enhancer/enhancer#> +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +SELECT distinct ?name ?chain +WHERE { + ?chain a enhancer:EnhancementChain . + ?chain rdfs:label ?name . +} +ORDER BY ASC(?name) +</textarea> +<p><input type="submit" class="submit" value="Run SPARQL query" /></p> +<pre class="prettyprint result" style="max-height: 200px; display: none" disabled="disabled"> +</pre> +</form> +<script language="javascript"> +function registersSparqlHandler() { + $("#sparql input.submit", this).click(function(e) { + // disable regular form click + e.preventDefault(); + + // clean the result area + $("#sparql textarea.result").text(''); + + // submit sparql query using Ajax + $.ajax({ + type: "POST", + url: "${it.rootUrl}enhancer/sparql", + data: {query: $("#sparql textarea.query").val()}, + dataType: "html", + cache: false, + success: function(result) { + $("#sparql pre.result").text(result).css("display", "block"); + prettyPrint(); + }, + error: function(result) { + $("#sparql pre.result").text('Invalid query.').css("display", "block"); + } + }); + }); + } + $(document).ready(registersSparqlHandler); +</script> +</#macro> \ No newline at end of file Added: incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource/sparql.ftl URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource/sparql.ftl?rev=1297071&view=auto ============================================================================== --- incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource/sparql.ftl (added) +++ incubator/stanbol/trunk/enhancer/jersey/src/main/resources/org/apache/stanbol/enhancer/jersey/templates/org/apache/stanbol/enhancer/jersey/resource/EnhancerRootResource/sparql.ftl Mon Mar 5 14:31:28 2012 @@ -0,0 +1,48 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<#import "/imports/common.ftl" as common> +<#import "/imports/enhancersparql.ftl" as sparql> +<#escape x as x?html> +<@common.page title="SPARQL Endpoint for the Stanbol Enhancer Configuration" hasrestapi=false> + + <p>This allows to query the configuration of the Stanbol Enhancer for + active Enhancement Engines and EnhancementChains.</p> + + <p><a href="http://en.wikipedia.org/wiki/Sparql">SPARQL</a> is the + standard query language the most commonly used to provide interactive + access to semantic knowledge bases.</p> + + <p>A SPARQL endpoint is a standardized HTTP access to perform SPARQL queries. + Developers of REST clients will find all the necessary documentation in the + official <a href="http://www.w3.org/TR/rdf-sparql-protocol/#query-bindings-http">W3C + page for the RDF SPARQL protocol</a>.</p> + + <p>The Stanbol enhancer SPARQL endpoint gives access to the Configuration + of the Stanbol Enhancer. It does NOT allow to auery enhancement results. + Users that want to query/search for ContentItems based on extracted + knowledge should use instead:<ul> + <li> the <b><a href="${it.rootUrl}contenthub">Contenthub</a></b>: Supports + semantic search based on configurable semantic indexes.</li> + <li> <b><a href="${it.rootUrl}sparql">Sparql Endpoint</a></b>: Supports + SPARQL querys over the RDF graph containing the metadata of all enhanced + ContentItmes. </li> + </ul></p> + + <@sparql.form/> + +</@common.page> +</#escape> Modified: incubator/stanbol/trunk/integration-tests/pom.xml URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/pom.xml?rev=1297071&r1=1297070&r2=1297071&view=diff ============================================================================== --- incubator/stanbol/trunk/integration-tests/pom.xml (original) +++ incubator/stanbol/trunk/integration-tests/pom.xml Mon Mar 5 14:31:28 2012 @@ -173,7 +173,7 @@ <keepJarRunning>${keepJarRunning}</keepJarRunning> <server.ready.timeout.seconds>180</server.ready.timeout.seconds> <server.ready.path.1>/:stanbol.css</server.ready.path.1> - <server.ready.path.2>/enhancer:Stateless REST analysis</server.ready.path.2> + <server.ready.path.2>/enhancer:Stateless REST analysis:Accept:text/html</server.ready.path.2> <server.ready.path.3>/factstore:What is the FactStore</server.ready.path.3> <server.ready.path.4>/contenthub:Recently uploaded Content Items</server.ready.path.4> <server.ready.path.5>/entityhub:The RESTful API of the Entityhub</server.ready.path.5> Modified: incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/DefaultChainTest.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/DefaultChainTest.java?rev=1297071&r1=1297070&r2=1297071&view=diff ============================================================================== --- incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/DefaultChainTest.java (original) +++ incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/DefaultChainTest.java Mon Mar 5 14:31:28 2012 @@ -70,7 +70,7 @@ public class DefaultChainTest extends En .assertStatus(200) .assertContentRegexp( //check execution metadata - "http://stanbol.apache.org/ontology/enhancer/executionMetadata#executionPart", + "http://stanbol.apache.org/ontology/enhancer/executionmetadata#executionPart", //check execution of metaxa & if executionPlan is included "http://stanbol.apache.org/ontology/enhancer/executionplan#engine.*metaxa", "http://purl.org/dc/terms/creator.*LangIdEnhancementEngine", Added: incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EngineEnhancementRequestTest.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EngineEnhancementRequestTest.java?rev=1297071&view=auto ============================================================================== --- incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EngineEnhancementRequestTest.java (added) +++ incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EngineEnhancementRequestTest.java Mon Mar 5 14:31:28 2012 @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.stanbol.enhancer.it; + +import java.io.InputStream; + +import org.apache.http.entity.InputStreamEntity; +import org.junit.Assert; +import org.junit.Test; +/** + * Tests sending EnhancementRequests to single Engines + * + */ +public class EngineEnhancementRequestTest extends EnhancerTestBase { + + public EngineEnhancementRequestTest(){ + super(); + } + + /** + * Tests an normal enhancement request directed to the tika engine + * @throws Exception + */ + @Test + public void testTikaMetadata() throws Exception { + InputStream in = EngineEnhancementRequestTest.class.getClassLoader().getResourceAsStream("testJPEG_EXIF.jpg"); + Assert.assertNotNull("Unable to find test resource 'testJPEG_EXIF.jpg'",in); + executor.execute( + builder.buildPostRequest(getEndpoint()+"/engine/tika") + .withHeader("Accept","text/rdf+nt") + .withEntity(new InputStreamEntity(in, -1)) + ) + .assertStatus(200) + .assertContentRegexp( //we need not test the extraction results here + //only that the Enhancer REST API works also with engines! + "<http://purl.org/dc/terms/format> \"image/jpeg\"", + "<http://www.w3.org/ns/ma-ont#hasKeyword> \"serbor\" .", + "<http://www.semanticdesktop.org/ontologies/2007/05/10/nexif#isoSpeedRatings> \"400\"" + ); + } + /** + * Tests plain text extraction for an request directly sent to the tika + * engine + * @throws Exception + */ + @Test + public void testPlainTextExtraction() throws Exception { + InputStream in = EngineEnhancementRequestTest.class.getClassLoader().getResourceAsStream("test.pdf"); + Assert.assertNotNull("Unable to find test resource 'test.pdf'",in); + executor.execute( + builder.buildPostRequest(getEndpoint()+"/engine/tika?omitMetadata=true") + .withHeader("Accept","text/plain") + .withEntity(new InputStreamEntity(in, -1)) + ) + .assertStatus(200) + .assertContentRegexp( //we need not test the extraction results here + //only that the Enhancer REST API works also with engines! + "The Apache Stanbol Enhancer", + "The Stanbol enhancer can detect famous cities such as Paris" + ); + } + +} Propchange: incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EngineEnhancementRequestTest.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerConfigurationTest.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerConfigurationTest.java?rev=1297071&view=auto ============================================================================== --- incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerConfigurationTest.java (added) +++ incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerConfigurationTest.java Mon Mar 5 14:31:28 2012 @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.stanbol.enhancer.it; + +import java.io.IOException; + +import org.junit.Test; + +public class EnhancerConfigurationTest extends EnhancerTestBase { + + + + @Test + public void testEnhancerConfig() throws IOException{ + executor.execute( + builder.buildGetRequest(getEndpoint()) + .withHeader("Accept","application/rdf+xml") + ) + .assertStatus(200) + .assertContentRegexp( + "<rdf:Description rdf:about=\"http://localhost:.*/enhancer\">", + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/enhancer#Enhancer\"/>", + "<j.0:hasEngine rdf:resource=\"http://localhost:.*/enhancer/engine/dbpediaLinking\"/>", + "<j.0:hasEngine rdf:resource=\"http://localhost:.*/enhancer/engine/langid\"/>", + "<j.0:hasEngine rdf:resource=\"http://localhost:.*/enhancer/engine/tika\"/>", + "<j.0:hasEngine rdf:resource=\"http://localhost:.*/enhancer/engine/ner\"/>", + "<j.0:hasChain rdf:resource=\"http://localhost:.*/enhancer/chain/default\"/>", + "<j.0:hasChain rdf:resource=\"http://localhost:.*/enhancer/chain/language\"/>", + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/enhancer#EnhancementChain\"/>", + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/enhancer#EnhancementEngine\"/>", + "<rdfs:label>ner</rdfs:label>", + "<rdfs:label>language</rdfs:label>" + ); + } + @Test + public void testEngineConfig() throws IOException{ + executor.execute( + builder.buildGetRequest(getEndpoint()+"/engine") + .withHeader("Accept","application/rdf+xml") + ) + .assertStatus(200) + .assertContentRegexp( + "<rdf:Description rdf:about=\"http://localhost:.*/enhancer\">", + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/enhancer#Enhancer\"/>", + "<j.0:hasEngine rdf:resource=\"http://localhost:.*/enhancer/engine/dbpediaLinking\"/>", + "<j.0:hasEngine rdf:resource=\"http://localhost:.*/enhancer/engine/langid\"/>", + "<j.0:hasEngine rdf:resource=\"http://localhost:.*/enhancer/engine/tika\"/>", + "<j.0:hasEngine rdf:resource=\"http://localhost:.*/enhancer/engine/ner\"/>", + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/enhancer#EnhancementEngine\"/>", + "<rdfs:label>ner</rdfs:label>" + ); + } + @Test + public void testChainConfig() throws IOException{ + executor.execute( + builder.buildGetRequest(getEndpoint()+"/chain") + .withHeader("Accept","application/rdf+xml") + ) + .assertStatus(200) + .assertContentRegexp( + "<rdf:Description rdf:about=\"http://localhost:.*/enhancer\">", + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/enhancer#Enhancer\"/>", + "<j.0:hasChain rdf:resource=\"http://localhost:.*/enhancer/chain/default\"/>", + "<j.0:hasChain rdf:resource=\"http://localhost:.*/enhancer/chain/language\"/>", + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/enhancer#EnhancementChain\"/>", + "<rdfs:label>language</rdfs:label>" + ); + } + @Test + public void testSparqlConfig() throws IOException{ + StringBuilder query = new StringBuilder(); + query.append("PREFIX enhancer: <http://stanbol.apache.org/ontology/enhancer/enhancer#>"); + query.append("PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"); + query.append("SELECT distinct ?name ?chain "); + query.append("WHERE {"); + query.append("?chain a enhancer:EnhancementChain ."); + query.append("?chain rdfs:label ?name ."); + query.append("}"); + query.append("ORDER BY ASC(?name)"); + executor.execute( + builder.buildGetRequest(getEndpoint()+"/sparql","query",query.toString()) + .withHeader("Accept","application/sparql-results+xml") + ) + .assertStatus(200) + .assertContentRegexp( + "<sparql xmlns=\"http://www.w3.org/2005/sparql-results#\">", + "<head>", + "<variable name=\"chain\"/>", + "<variable name=\"name\"/>", + "</head>", + "<results>", + "<result>", + "<binding name=\"chain\">", + "<uri>http://localhost:.*/enhancer/chain/default</uri>", + "<uri>http://localhost:.*/enhancer/chain/language</uri>", + "<binding name=\"name\">", + "<literal>default</literal>", + "<literal>language</literal>" + ); + } + + public void testExecutionPlan() throws IOException{ + //We need not to validate the executionplan data. + //This is already done by other tests. + //only check for the rdf:types to check if the correct RDF data are returned + String [] validate = new String[]{ + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionplan#ExecutionNode\"/>", + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionplan#ExecutionPlan\"/>" + }; + executor.execute( + builder.buildGetRequest(getEndpoint()+"/ep") + .withHeader("Accept","application/rdf+xml") + ) + .assertStatus(200) + .assertContentRegexp(validate); + executor.execute( + builder.buildGetRequest(getEndpoint()+"/chain/language/ep") + .withHeader("Accept","application/rdf+xml") + ) + .assertStatus(200) + .assertContentRegexp(validate); + executor.execute( + builder.buildGetRequest(getEndpoint()+"/chain/engine/tika") + .withHeader("Accept","application/rdf+xml") + ) + .assertStatus(200) + .assertContentRegexp(validate); + + } + +} Propchange: incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerConfigurationTest.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerTestBase.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerTestBase.java?rev=1297071&r1=1297070&r2=1297071&view=diff ============================================================================== --- incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerTestBase.java (original) +++ incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/EnhancerTestBase.java Mon Mar 5 14:31:28 2012 @@ -73,7 +73,8 @@ public class EnhancerTestBase extends St "langid","LangIdEnhancementEngine", "ner","NamedEntityExtractionEnhancementEngine", "entityhubLinking","NamedEntityTaggingEngine", - "dbpediaLinking","NamedEntityTaggingEngine" + "dbpediaLinking","NamedEntityTaggingEngine", + "tika","TikaEngine" }; /** * Getter for the Endpoint for a specific enhancement chain Modified: incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java?rev=1297071&r1=1297070&r2=1297071&view=diff ============================================================================== --- incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java (original) +++ incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java Mon Mar 5 14:31:28 2012 @@ -302,7 +302,7 @@ public class MultipartRequestTest extend @Test public void testOutputContentPart() throws IOException { String[] params = new String []{ - "outputContentPart","http://stanbol.apache.org/ontology/enhancer/executionMetadata#ChainExecution", + "outputContentPart","http://stanbol.apache.org/ontology/enhancer/executionmetadata#ChainExecution", "omitMetadata","true", "rdfFormat","application/rdf+xml"}; String content = executor.execute( @@ -315,12 +315,12 @@ public class MultipartRequestTest extend .assertContentContains( "--contentItem", "--contentItem--", - "Content-Disposition: form-data; name=\"http://stanbol.apache.org/ontology/enhancer/executionMetadata#ChainExecution\"", + "Content-Disposition: form-data; name=\"http://stanbol.apache.org/ontology/enhancer/executionmetadata#ChainExecution\"", "Content-Type: application/rdf+xml; charset=UTF-8", "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionplan#ExecutionPlan\"/>", "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionplan#ExecutionNode\"/>", - "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionMetadata#EngineExecution\"/>", - "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionMetadata#ChainExecution\"/>") + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionmetadata#EngineExecution\"/>", + "<rdf:type rdf:resource=\"http://stanbol.apache.org/ontology/enhancer/executionmetadata#ChainExecution\"/>") .getContent(); log.debug("Content:\n{}\n",content); } Added: incubator/stanbol/trunk/integration-tests/src/test/resources/test.pdf URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/resources/test.pdf?rev=1297071&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stanbol/trunk/integration-tests/src/test/resources/test.pdf ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/stanbol/trunk/integration-tests/src/test/resources/testJPEG_EXIF.jpg URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/resources/testJPEG_EXIF.jpg?rev=1297071&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/stanbol/trunk/integration-tests/src/test/resources/testJPEG_EXIF.jpg ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream
