You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Rakesh Vidyadharan <ra...@sptci.com> on 2010/01/22 22:38:25 UTC
Preserve multi-value properties?
The current import/export system does not preserve multi-values properties when they happen to have only a single value. This causes some issues when we work with known node structures, and where our application logic always ensures that a certain property is always created as multi-value. The fix is easy enough (always check and delete and recreate if necessary), but is still inconvenient and counter intuitive. Are there any plans to preserve the node definitions while exporting?
Thanks
Rakesh
Re: Preserve multi-value properties?
Posted by Rakesh Vidyadharan <ra...@sptci.com>.
On 27 Jan 2010, at 03:37, Alexander Klimetschek wrote:
> On Tue, Jan 26, 2010 at 16:53, Rakesh Vidyadharan <ra...@sptci.com> wrote:
>> but if I remove one of the values
>
> Just to be sure: you mean if you remove the property in JCR, export
> the system view again, it won't have the multiple attribute and import
> will produce a single-value property, right? The interesting export is
> when a multi-value property has only one value.
Correct. It works in other cases (well I have not tested with an empty multi-value property).
Rakesh
Re: Preserve multi-value properties?
Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Jan 26, 2010 at 16:53, Rakesh Vidyadharan <ra...@sptci.com> wrote:
> but if I remove one of the values
Just to be sure: you mean if you remove the property in JCR, export
the system view again, it won't have the multiple attribute and import
will produce a single-value property, right? The interesting export is
when a multi-value property has only one value.
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: Preserve multi-value properties?
Posted by Rakesh Vidyadharan <ra...@sptci.com>.
On 26 Jan 2010, at 01:57, Alexander Klimetschek wrote:
> On Mon, Jan 25, 2010 at 16:30, Rakesh Vidyadharan <ra...@sptci.com> wrote:
>> I used the system view. You can see the exporter code at http://kenai.com/projects/jcrmanager/sources/svn/content/trunk/src/app/com/sptci/jcr/webui/listener/menu/NodeExportListener.java?rev=48 (line 99).
>
> In JCR 2.0 the property sv:multiple=true must be set for multi-value
> properties (see [1]). I thought this is the case for Jackrabbit 1.x
> already (but I might be wrong). Do you see that property in your
> exports?
>
> [1] http://www.day.com/specs/jcr/2.0/7_Export.html#SystemView
That does not seem to be the case with JR 1.6.1 (I think I started with 1.4). Here is a sample export output with a multi-value property. In this case import will work since there are two values, but if I remove one of the values and then import the imported node has only a single-valued property.
<?xml version="1.0" encoding="UTF-8"?>
<sv:node sv:name="test" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:mgnl="http://www.magnolia.info/jcr/mgnl" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:rep="internal" xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
<sv:property sv:name="jcr:primaryType" sv:type="Name">
<sv:value>nt:unstructured</sv:value>
</sv:property>
<sv:property sv:name="multivalue" sv:type="String">
<sv:value>First value</sv:value>
<sv:value>Second value.</sv:value>
</sv:property>
</sv:node>
Re: Preserve multi-value properties?
Posted by Alexander Klimetschek <ak...@day.com>.
On Mon, Jan 25, 2010 at 16:30, Rakesh Vidyadharan <ra...@sptci.com> wrote:
> I used the system view. You can see the exporter code at http://kenai.com/projects/jcrmanager/sources/svn/content/trunk/src/app/com/sptci/jcr/webui/listener/menu/NodeExportListener.java?rev=48 (line 99).
In JCR 2.0 the property sv:multiple=true must be set for multi-value
properties (see [1]). I thought this is the case for Jackrabbit 1.x
already (but I might be wrong). Do you see that property in your
exports?
[1] http://www.day.com/specs/jcr/2.0/7_Export.html#SystemView
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
Re: Preserve multi-value properties?
Posted by Rakesh Vidyadharan <ra...@sptci.com>.
On 25 Jan 2010, at 06:18, Alexander Klimetschek wrote:
> On Fri, Jan 22, 2010 at 22:38, Rakesh Vidyadharan <ra...@sptci.com> wrote:
>> The current import/export system does not preserve multi-values properties when they happen to have only a single value. This causes some issues when we work with known node structures, and where our application logic always ensures that a certain property is always created as multi-value. The fix is easy enough (always check and delete and recreate if necessary), but is still inconvenient and counter intuitive. Are there any plans to preserve the node definitions while exporting?
>
> Did you use document or system view? In system view it should work,
> but for document view round-tripping cannot be guaranteed, as things
> like multi-value properties don't map natively onto XML.
>
> See also this enhancement issue: https://issues.apache.org/jira/browse/JCR-325
>
> Regards,
> Alex
I used the system view. You can see the exporter code at http://kenai.com/projects/jcrmanager/sources/svn/content/trunk/src/app/com/sptci/jcr/webui/listener/menu/NodeExportListener.java?rev=48 (line 99).
Re: Preserve multi-value properties?
Posted by Alexander Klimetschek <ak...@day.com>.
On Fri, Jan 22, 2010 at 22:38, Rakesh Vidyadharan <ra...@sptci.com> wrote:
> The current import/export system does not preserve multi-values properties when they happen to have only a single value. This causes some issues when we work with known node structures, and where our application logic always ensures that a certain property is always created as multi-value. The fix is easy enough (always check and delete and recreate if necessary), but is still inconvenient and counter intuitive. Are there any plans to preserve the node definitions while exporting?
Did you use document or system view? In system view it should work,
but for document view round-tripping cannot be guaranteed, as things
like multi-value properties don't map natively onto XML.
See also this enhancement issue: https://issues.apache.org/jira/browse/JCR-325
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com