You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Martin Zdila <m....@mwaysolutions.com> on 2008/03/06 18:29:17 UTC

incorrect system view export if property is String[1]

hello

i think i've found a bug. if i have multivalue with only one item, then export 
is ambiguous. after import i see only String property. please check 
attachments. should i report it to jira?

the other strange thing is that document view export is empty. is it ok? why?

thanks in advance.

-- 
Martin Zdila 
CTO

M-Way Solutions Slovakia s.r.o.
Letna 27, 040 01 Kosice
Slovakia

tel:+421-908-363-848
mailto:m.zdila@mwaysolutions.com
http://www.mwaysolutions.com
xmpp:zdila@jabbim.sk (Jabber)
skype:m.zdila

Re: incorrect system view export if property is String[1]

Posted by Stefan Guggisberg <st...@gmail.com>.
On Fri, Mar 7, 2008 at 9:58 AM, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
>  2008/3/6 Martin Zdila <m....@mwaysolutions.com>:
>
> >  i think i've found a bug. if i have multivalue with only one item, then export
>  >  is ambiguous. after import i see only String property. please check
>  >  attachments. should i report it to jira?
>
>  Yes, please.
>
>  The problem is that there is an ambiguity related to multivalued
>  properties in the system view format specified in JSR 170. Normally
>  the import can determine whether a property should be multivalued or
>  not by looking at the matching property definition associated with the
>  node type. But with nt:unstructured there is both a single- and a
>  multivalued property definition that matches the imported property. In
>  such cases Jackrabbit looks at the number of values in the imported
>  property, and defaults to the single-valued property definition if
>  just a single value is being imported like in your String[1] case.
>
>  We can't really solve the problem by improving the heuristics on the
>  import side, so we should add some explicit property metadata like
>  rep:multivalued="true" to the system view export to help solve the
>  ambiguity.
>

you might also use specific node types instead of the generic nt:unstructured
(if that's an option) in order to avoid this issue.

e.g.

[myapp:book]
  - myapp:title (string) mandatory
  - myapp:authors (string) multiple mandatory
  ...

cheers
stefan


>
>  >  the other strange thing is that document view export is empty. is it ok? why?
>
>  That's a long-lived known issue, see
>  https://issues.apache.org/jira/browse/JCR-325.
>
>  The reason is basically that since we currently can't import
>  multivalued properties in document view, we think it's better also not
>  to export them to avoid giving people the wrong idea. There is no
>  concept of multivalued attributes in XML, so while the JCR spec
>  specifies a way to handle that case it also leaves a lot of freedom to
>  implementations to decide if they want to support that feature.
>
>  In the general case it is impossible to properly import multivalued
>  properties using the document view, but there are a lot of heuristics
>  we could apply to make that feature work reasonably well in practice.
>  I spent some time on that issue two years ago, but dropped the effort
>  since it's rather complex and there is no clear need for such
>  functionality.
>
>  BR,
>
>  Jukka Zitting
>

Re: incorrect system view export if property is String[1]

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

2008/3/6 Martin Zdila <m....@mwaysolutions.com>:
>  i think i've found a bug. if i have multivalue with only one item, then export
>  is ambiguous. after import i see only String property. please check
>  attachments. should i report it to jira?

Yes, please.

The problem is that there is an ambiguity related to multivalued
properties in the system view format specified in JSR 170. Normally
the import can determine whether a property should be multivalued or
not by looking at the matching property definition associated with the
node type. But with nt:unstructured there is both a single- and a
multivalued property definition that matches the imported property. In
such cases Jackrabbit looks at the number of values in the imported
property, and defaults to the single-valued property definition if
just a single value is being imported like in your String[1] case.

We can't really solve the problem by improving the heuristics on the
import side, so we should add some explicit property metadata like
rep:multivalued="true" to the system view export to help solve the
ambiguity.

>  the other strange thing is that document view export is empty. is it ok? why?

That's a long-lived known issue, see
https://issues.apache.org/jira/browse/JCR-325.

The reason is basically that since we currently can't import
multivalued properties in document view, we think it's better also not
to export them to avoid giving people the wrong idea. There is no
concept of multivalued attributes in XML, so while the JCR spec
specifies a way to handle that case it also leaves a lot of freedom to
implementations to decide if they want to support that feature.

In the general case it is impossible to properly import multivalued
properties using the document view, but there are a lot of heuristics
we could apply to make that feature work reasonably well in practice.
I spent some time on that issue two years ago, but dropped the effort
since it's rather complex and there is no clear need for such
functionality.

BR,

Jukka Zitting