[ 
https://issues.apache.org/jira/browse/STANBOL-414?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13171812#comment-13171812
 ] 

Rupert Westenthaler commented on STANBOL-414:
---------------------------------------------

Hi

### getId()

I am also unsure about the usage of UriRef for the getId Method, but maybe Reto 
is right and it just feels 'wrong' in some places because other components that 
use the new API are not yet adapted to also internally use UriRef instead of 
String.

### Parts

I am not really happy with the Part API. Working with the "index" is hard, 
because indexes might change depending on the configuration of the chain. Also 
access via the URI is not as easy because URIs are constructed by appending to 
the id of the content item. So code that does use the URI to access a specific 
part would still depend on a specific suffix added to a content item.

A third way would be to access additional metadata provided for a Part in the 
Metadata. But as Reto mentioned there might be cases where such metadata are 
not added to the metadata of the ContentItem.

Because of this I suggest to define a "Part<T>" class that 

* provided access to the Part: "Object<?extends T> get()", "Class<T> getType()"
* a getter for the Uri "UriRef getPartId"
* provides additional metadata. We could use something like "Collection<UriRef> 
getProperties()"; "Object getMetadata(UriRef property); void setMetadata(UriRef 
property, Object object)". As an alternative we could also use the Clerezza 
GraphNode utility.

To create a Part that is represented within the Metadata of the ContentItem 
users would use "Part<T> ContentItem.createPart(String partName, Object<? 
extends T> part, Class<T> clazz)". Where "partName" would be a suggestion for 
the suffix added to the URI of the ContentItem. This method would create and 
link (<ci> :hasPart <part>) a ContentPart instance within the metadata of the 
ContentItem.

To create a "private" content part users would need to instantiate an own Part 
and than register it with the ContentItem by using a "int 
ConentItem.registerPart(Part<T> part)". This method returns the index of the 
Part.

WDYT
Rupert
                
> Refactor EnhancementEngine to support contents with multiple related parts
> --------------------------------------------------------------------------
>
>                 Key: STANBOL-414
>                 URL: https://issues.apache.org/jira/browse/STANBOL-414
>             Project: Stanbol
>          Issue Type: Improvement
>            Reporter: Reto Bachmann-Gmür
>         Attachments: 
> 0001-CLEREZZA-414-changed-ContentItem-interface-and-utili.patch
>
>
> Some notes from a discussion with Rupert and Olivier
> ContentItem
> - getBlob() returns a blob of type multipart/mime iff the ContentItem was 
> created from a multipart/mime content
> - ci.getBlob() eq ci.getPart(0, Blob.class)
> - ci.getUri()+"_main" eq ci.getPartUri(0)
> Rest
> /enhancer
> /enhancer/engine/<engineId>
> /enhancer/chains/<chaiId>
> - query params: 
> Optional inputWithMetadata -> expects multipart/mime with 2 sections of which 
> the first is rdf
> Optional outputWithContentParts[=<section-ordinal>] -> the result is 
> multipart (instead of rdf) containing rdf as the first section and the parts 
> in the second section, if there is more than one part this second section is 
> itself multipart, this argument might be repated to have different sections
> Optional omitMetada -> no metadate in the result, makes only sense with 
> outputContentParts argument, the result will correspond to the second section 
> of the malipart returned without this argument

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to