chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "krzysztoffzielinski@gmail.com"<krzysztoffzielin...@gmail.com>
Subject Re: RE: Secondary Type example from opencmis doc throws type unknown error
Date Wed, 11 Oct 2017 21:29:59 GMT
Thank you so much for very insightful response, Jeff. I'll raise this. But it will be hard
to switch to different technology now as we have some other functionality implemented with
CMIS.
It may be overcomplicating the problem. But if possible I would still try storing multiple
secondary types against document to have this as an option. Would it work like this:

// MyPropertyItem type : key, value properties
List<String> secondaryTypes = new ArrayList<String>();
secondaryTypes.add("custom:MyPropertyItem");

properties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, secondaryTypes);

// set secondary type properties key-values
properties.put("client", "xxxxx");
properties.put("task", "yyyyyh");

Would this be stored against document?
And to query this I would need to join cm:document with MyPropertyItem where key='client'
and value='xxxx' to query document having this property set?

Thanks
Krzysztof 

On 2017-10-11 20:17, Jeff Potts <jeffpotts01@gmail.com> wrote: 
> Based on the flexibility you need, including querying capabilities, I
> wouldn't use a CMIS repository to persist this data. I would use a NoSQL
> document store. Then, depending on the implementation selected, I'd have
> full schemaless capabilities to store any data in any structure as needed.
> One of the properties would be a cross reference that linked back to the
> object in the CMIS repository.
> 
> But, to answer your question, if you define a secondary type with two
> properies, key and value, you can make them multi-valued. But then you've
> got the nightmare of having to keep two arrays "aligned". In other words, [
> "key1", "key2", "key3" ] in one property and [ "value1", "value2", "value3"
> ] in the other. Of course that assumes all of your values are of the same
> type. Depending on how many properties you have that can be a problem, and
> of course querying is also difficult.
> 
> You can have as many secondary types as you want, but they must be unique,
> and the property names also need to be unique within their namespace, so
> you cannot just define a single secondary type with a single key and value
> and then add that type N-times to the document. That will not work.
> 
> You could have a relationship that associates a document with N number of
> objects, each of which has a single key-value pair, but associations are
> not queryable. So you'd have to do an initial query that gets the documents
> you care about ignoring the key values, then you'd have to iterate over the
> set to inspect all of their associations. Obviously, this will not scale.
> 
> As you can see, while CMIS does provide a fairly rich set of metadata
> capabilities, it does not come close to approaching the flexibility of a
> more general persistence technology, so I would encourage you to consider
> using additional technologies that might be better suited to the
> requirements.
> 
> Jeff
> 
> 
> On Wed, Oct 11, 2017 at 11:28 AM, krzysztoffzielinski@gmail.com <
> krzysztoffzielinski@gmail.com> wrote:
> 
> > Thanks for reply.
> >
> > The question would be how should i name these properties, since they are
> > not known upfront? They are derived from client input.
> >
> > I have an idea to define a secondary type with two properties: key and
> > value. and store my dynamic property there.
> >
> > Is it possible to store a list/bag/array of secondary properties of the
> > same type, as opposed to storing just one?
> >
> > would i be able to specify cmis query that would check if the document has
> > the secondary property in the collection with given key and value?
> >
> > Thanks
> > Krzysztof
> >
> > On 2017-10-11 17:11, "Suhaib Fahad" <fahad.suhaib@pogeyan.com> wrote:
> > > Could you inherit from "cmis:document" as base type and define custom
> > > properties in your custom type? That should give you the flexibility to
> > use
> > > files + custom key-value pairs.
> > >
> > > Thanks,
> > > Fahad
> > >
> > > -----Original Message-----
> > > From: krzysztoffzielinski@gmail.com [mailto:krzysztoffzielinski@
> > gmail.com]
> > > Sent: Wednesday, October 11, 2017 9:15 PM
> > > To: dev@chemistry.apache.org
> > > Subject: Re: Secondary Type example from opencmis doc throws type unknown
> > > error
> > >
> > > Is there another way of storing key-value pairs on documents that are not
> > > known upfront? i.e. to store a property that was not defined before?
> > >
> > > Krzysztof
> > >
> > > On 2017-10-11 16:39, Jeff Potts <jeffpotts01@gmail.com> wrote:
> > > > They are not dynamic. A secondary type must already be known by the
> > > > repository before it can be applied.
> > > >
> > > > Some repositories support using CMIS to add type and secondary type
> > > > definitions to the repository. Once the repository registers your
> > > > definition you can then use it. But you cannot simply make up a
> > > > content model and start using it without registering it first,
> > > > otherwise you will get type unknown errors, as you have seen.
> > > >
> > > > Jeff
> > > >
> > > > On Wed, Oct 11, 2017 at 10:15 AM, krzysztoffzielinski@gmail.com <
> > > > krzysztoffzielinski@gmail.com> wrote:
> > > >
> > > > > Hello All,
> > > > > I was wondering how the secondary type work. They are meant to be
> > > > > dynamic, so when you should be able to create them on the fly.
> > > > > however, when i run example from the docs, i get
> > > > >
> > > > > CmisObjectNotFoundException: Type 'custom:classifictaion' is unknown!
> > > > >
> > > > > do you need to predefine the "custom" namespace?
> > > > >
> > > > > Thanks a lot
> > > > > Krzysztof
> > > > >
> > > >
> > >
> > >
> >
> 

Mime
View raw message