Package org.apache.stanbol.enhancer.servicesapi

Examples of org.apache.stanbol.enhancer.servicesapi.ContentItem.addPart()


            log.error("Failed to create contentitem with uri: {}", uri.getUnicodeString());
            throw new StoreException(String.format("Failed to create contentitem with uri: %s",
                uri.getUnicodeString()));
        }
        if (title != null && !title.trim().isEmpty()) {
            ci.addPart(TITLE_URI, title.trim());
        }
        return ci;
    }

    private void enhance(ContentItem ci, String chainName) throws StoreException {
View Full Code Here


        ContentItem ci = null;
        try {
            ci = solrStore.create(contentContext.getContent(), contentItemId, contentContext.getNodeName(),
                contentContext.getContentType());
            ci.addPart(ADDITIONAL_METADATA_URI, additionalMetadata);
            solrStore.enhanceAndPut(ci, indexName, null);
        } catch (StoreException e) {
            log.error(e.getMessage(), e);
        }
        log.info("Document submitted to Contenthub.");
View Full Code Here

    ContentItem ci = createContentItem(contentSource);
    assertNotNull(ci);
    assertNotNull(ci.getUri());
    UriRef partUri = new UriRef("http://foo/");
    Date someObject = new Date();
    ci.addPart(partUri, someObject);
    ci.getMetadata().add(new TripleImpl(ci.getUri(), new UriRef("http://example.org/ontology#hasPart"), partUri));
        ci.getMetadata().add(new TripleImpl(partUri, new UriRef("http://example.org/ontology#isPartOf"),ci.getUri()));
    assertEquals(someObject, ci.getPart(partUri, Date.class));
    assertEquals(someObject, ci.getPart(1, Date.class));
    assertEquals(partUri, ci.getPartUri(1));
View Full Code Here

    log.info("toString: {}",ci);
  }
  @Test(expected=IllegalArgumentException.class)
  public void addPartWithoutUri() throws IOException{
        ContentItem ci = createContentItem(contentSource);
      ci.addPart(null, new Date());
  }
    @Test(expected=IllegalArgumentException.class)
    public void addPartWithoutPartContent() throws IOException{
        ContentItem ci = createContentItem(contentSource);
        ci.addPart(new UriRef("http://foo/"), null);
View Full Code Here

      ci.addPart(null, new Date());
  }
    @Test(expected=IllegalArgumentException.class)
    public void addPartWithoutPartContent() throws IOException{
        ContentItem ci = createContentItem(contentSource);
        ci.addPart(new UriRef("http://foo/"), null);
    }
    /**
     * The ContentItem MUST NOT allow to replace the main content part (the
     * Blob stored at index 0)
     */
 
View Full Code Here

     */
    @Test(expected=IllegalArgumentException.class)
    public void replaceMainPart() throws IOException{
        ContentItem ci = createContentItem(contentSource);
        UriRef mainPart = ci.getPartUri(0);
        ci.addPart(mainPart, new Date());
    }
    @Test(expected=IllegalArgumentException.class)
    public void removeNullPart()  throws IOException{
        ContentItem ci = createContentItem(contentSource);
        ci.removePart(null);
View Full Code Here

    }
    @Test
    public void removeRemoveByUri() throws IOException {
        ContentItem ci = createContentItem(contentSource);
        UriRef uri = new UriRef("urn:content.part:remove.test");
        ci.addPart(uri, new Date());
        try {
            ci.getPart(uri, Date.class);
        }catch (NoSuchPartException e) {
            assertFalse("The part with the uri "+uri+" was not added correctly",
                true);
View Full Code Here

    }
    @Test
    public void removeRemoveByIndex() throws IOException {
        ContentItem ci = createContentItem(contentSource);
        UriRef uri = new UriRef("urn:content.part:remove.test");
        ci.addPart(uri, new Date());
        int index = -1;
        try {
            for(int i=0; index < 0; i++){
                UriRef partUri = ci.getPartUri(i);
                if(partUri.equals(uri)){
View Full Code Here

        String id = d.getId();
        id = attachBaseURI(id);
        ContentItem ci = null;
        try {
            ci = solrStore.create(content, id, d.getName(), mimeType);
            ci.addPart(ADDITIONAL_METADATA_URI, constraints);
            solrStore.enhanceAndPut(ci, indexName, null);
        } catch (StoreException e) {
            log.error(e.getMessage(), e);
        }
        log.info("Document submitted to Contenthub.");
View Full Code Here

                                        "for ContentPart '%s' ( contentType: %s)",
                                        fis.getName(),fis.getContentType()))
                                .build());
                        }
                        UriRef contentPartId = new UriRef(fis.getFieldName());
                        contentItem.addPart(contentPartId, graph);
                    }
                }
                if(contentItem == null){
                    throw new WebApplicationException(
                        Response.status(Response.Status.BAD_REQUEST)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.