You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Stefan Guggisberg <st...@gmail.com> on 2006/11/08 17:13:42 UTC

Re: Session Importer: Question on NodeType matching

On 11/8/06, Dan Connelly <ds...@adelphia.net> wrote:
> All:
>
> This is a follow-up on my questions posted per "ThirdHop for structured
> node types".   I have got most of what I want working, but not all.
>
> One remaining problem is that a certain child-node stays unstructured
> although I have provided a structured node type for it.   It is
> difficult to diagnose why I am not getting jcr:primaryType of
> "teneo:proxy" for the "author" child node.
>
> Details below.   The "library:Book" node is imported (correctly) as a
> structured type.   But its child "author" is not.   It should be a
> "teneo:proxy" primary node type.
>
> Could there be a problem here because the"author" element is in the
> un-named namespace, not in the "library" namespace of its parent?

no. the problem is the following:

[...]
 <library:Book jcr:primaryType="teneo:eobject"
[...]

i.e. library:Book is of type teneo:eobject which extends
nt:unstructured. that's why "author" ends up being of type
nt:unstructured.

i guess library:Book should be of type library:Book.

btw: the naming of node and type is somewhat confusing...

cheers
stefan

> (XML input is provided to me.   I cannot re-structure it.)
>
> custom_nodetypes.xml (part):
>
>   <nodeType name="teneo:eobject" isMixin="false">
>     <supertypes>
>       <supertype>mix:referenceable</supertype>
>       <supertype>nt:unstructured</supertype>
>     </supertypes>
>   </nodeType>
>
>     <nodeType name="teneo:proxy" isMixin="false" >
>      <supertypes>
>       <supertype>nt:base</supertype>
>       </supertypes>
>     <propertyDefinition name="href" requiredType="String"
> autoCreated="false" mandatory="true" onParentVersion="COPY"
> protected="false" multiple="false" />
>     </nodeType>
>
>     <nodeType name="library:Book" isMixin="true"
> hasOrderableChildNodes="false">
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="title" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <propertyDefinition name="pages" requiredType="Long"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <propertyDefinition name="category" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="author"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="true"
> onParentVersion="COPY" protected="false" sameNameSiblings="false" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>         </childNodeDefinition>
>     </nodeType>
>
>
> Session DocView Import:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <library:Book xmlns:library="http://www.example.eclipse.org/Library"
> category="ScienceFiction" pages="500" title="The Hobbit">
> <author href="jcr://proxies.test.writer/#/Content.2"/>
> </library:Book>
>
>
> Session DocView Export:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Content.1 xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:rep="internal"
> xmlns:graffito="http://incubator.apache.org/graffito"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:library="http://www.example.eclipse.org/Library"
> xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
> xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
> xmlns:fn="http://www.w3.org/2004/10/xpath-functions"
> xmlns:jcr="http://www.jcp.org/jcr/1.0"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:teneo="http://www.eclipse.org/emft/projects/teneo"
> jcr:primaryType="teneo:content">
> <library:Book jcr:primaryType="teneo:eobject"
> jcr:uuid="e22d24a5-9532-4dcc-b45b-38ac045de7e5" pages="500"
> category="ScienceFiction" title="The Hobbit">
> <author jcr:primaryType="nt:unstructured"
> href="jcr://proxies.test.writer/#/Content.2"/>
> </library:Book>
> </Content.1>
>
>
> Should be:
>
> ............
> <author jcr:primaryType="teneo:proxy"
> href="jcr://proxies.test.writer/#/Content.2"/>
> ...........
>
>
>

Re: Session Importer: Question on NodeType matching

Posted by Stefan Guggisberg <st...@gmail.com>.
On 11/10/06, Kar, Swayambhuba <sw...@hp.com> wrote:
> Guys,
>
> Marking the super type of all the generated custom types to nt:base is
> hard coded in the schema converter class and hence the behavior.

if you don't specify a super type for a non-mixin type, the implementation
defaults to nt:base since every non-mixin type must directly or indirectly
extend nt:base.

you have to explicitly specify your super type(s), otherwise nt:base
will be assumed.

cheers
stefan

>
> Thanks,
> -Swayam
>
> -----Original Message-----
> From: Kar, Swayambhuba
> Sent: Friday, November 10, 2006 11:18 AM
> To: users@jackrabbit.apache.org
> Subject: RE: Session Importer: Question on NodeType matching
>
> Hi Dan/Stefen:
>
> I have a similar kind of requirement. Only exception being, I create the
> custom node types from a .xsd schema definition. However, after the node
> types have been crated, the super type for all the node types are set to
> nt:base. How do I tweak the .xsd to create correct node type hierarchy?
>
> Thanks!
>
> -Swayam
>
> -----Original Message-----
> From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com]
> Sent: Thursday, November 09, 2006 6:23 AM
> To: users@jackrabbit.apache.org
> Subject: Re: Session Importer: Question on NodeType matching
>
> On 11/9/06, Dan Connelly <ds...@adelphia.net> wrote:
> > Stefan Guggisberg wrote:
> >
> > > On 11/8/06, Dan Connelly <ds...@adelphia.net> wrote:
> > >
> > >> All:
> > >>
> > >> This is a follow-up on my questions posted per "ThirdHop for
> structured
> > >> node types".   I have got most of what I want working, but not all.
> > >>
> > >> One remaining problem is that a certain child-node stays
> unstructured
> > >> although I have provided a structured node type for it.   It is
> > >> difficult to diagnose why I am not getting jcr:primaryType of
> > >> "teneo:proxy" for the "author" child node.
> > >>
> > >> Details below.   The "library:Book" node is imported (correctly) as
> a
> > >> structured type.   But its child "author" is not.   It should be a
> > >> "teneo:proxy" primary node type.
> > >>
> > >> Could there be a problem here because the"author" element is in the
> > >> un-named namespace, not in the "library" namespace of its parent?
> > >
> > >
> > > no. the problem is the following:
> > >
> > > [...]
> > > <library:Book jcr:primaryType="teneo:eobject"
> > > [...]
> > >
> > > i.e. library:Book is of type teneo:eobject which extends
> > > nt:unstructured. that's why "author" ends up being of type
> > > nt:unstructured.
> > >
> > > i guess library:Book should be of type library:Book.
> > >
> > > btw: the naming of node and type is somewhat confusing...
> > >
> > > cheers
> > > stefan
> > >
> > <snip>
> >
> ------------------------------------------------------------------------
> --------------------------------
> >
> > Stefan:
> >
> > Agreed, the jcr:primaryType attribute on element library:Book gets set
> > incorrectly.
> >
> > How can I fix this in my node type specification?
> >
> > (I assume that I can alter this behavior through the node type defs,
> > that this is not a bug in Jackrabbit.)
> >
> > I made some changes in my custom_nodetype.xml spec trying to make this
> > change:
> >
> >     * I set isMixin="true" for teneo:eobject.
>
> why do you think that this would help?
>
> >     * I set explicit requiredPrimaryType in the childNode defs of
> >       teneo:content.
> >
> > However, the output XML is unchanged.   The element library:Book still
> > has attribute jcr:primaryType="teneo:eobject", which is incorrect.
>
> i quickly ran a test with your node type definitions and your
> xml data, here's my test code:
>
>             root.addNode("tmp", "teneo:content");
>             root.save();
>
>             FileInputStream fis = new
> FileInputStream("d:/temp/xml/book.xml");
>             wsp.importXML("/tmp", fis,
> ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
>             fis.close();
>             dumpTree(root.getNode("tmp"), System.out);
>
> here's the console output:
>
> [node]   /tmp
>         [prop]   jcr:primaryType teneo:content
>         [node]   /library:Book
>                 [prop]   pages 500
>                 [prop]   jcr:primaryType library:Book
>                 [prop]   category ScienceFiction
>                 [prop]   jcr:uuid 41a71535-3749-4e36-9981-47e8c6bcb4da
>                 [prop]   title The Hobbit
>                 [node]   /author
>                         [prop]   href
> jcr://proxies.test.writer/#/Content.2
>                         [prop]   jcr:primaryType teneo:proxy
>
> i guess everything's fine.
>
> i suggest you redo your test with a clean repository.
>
> cheers
> stefan
> >
> > I have listed the relevant portion of my new custom_nodetype.xml
> below.
> >
> >        Thanks,    Dan
> >
> >  <nodeType name="teneo:eobject" isMixin="true">
> >     <supertypes>
> >       <supertype>mix:referenceable</supertype>
> >       <supertype>nt:unstructured</supertype>
> >     </supertypes>
> >   </nodeType>
> >
> >     <nodeType name="teneo:proxy" isMixin="false" >
> >      <supertypes>
> >       <supertype>nt:base</supertype>
> >       </supertypes>
> >     <propertyDefinition name="href" requiredType="String"
> > autoCreated="false" mandatory="true" onParentVersion="COPY"
> > protected="false" multiple="false" />
> >     </nodeType>
> >
> >     <nodeType name="library:Book" isMixin="false"
> > hasOrderableChildNodes="false" >
> >         <supertypes>
> >             <supertype>teneo:eobject</supertype>
> >         </supertypes>
> >         <propertyDefinition name="title" requiredType="String"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <propertyDefinition name="pages" requiredType="Long"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <propertyDefinition name="category" requiredType="String"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <childNodeDefinition name="author"
> > defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="true"
> > onParentVersion="COPY" protected="false" sameNameSiblings="false" >
> >           <requiredPrimaryTypes>
> >             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
> >           </requiredPrimaryTypes>
> >         </childNodeDefinition>
> >     </nodeType>
> >
> >     <nodeType name="library:Library" isMixin="false"
> > hasOrderableChildNodes="false">
> >         <supertypes>
> >             <supertype>teneo:eobject</supertype>
> >         </supertypes>
> >         <propertyDefinition name="name" requiredType="String"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <childNodeDefinition name="writers"
> > defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> > onParentVersion="COPY" protected="false" sameNameSiblings="true" >
> >           <requiredPrimaryTypes>
> >             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
> >           </requiredPrimaryTypes>
> >           </childNodeDefinition>
> >         <childNodeDefinition name="books"
> > defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> > onParentVersion="COPY" protected="false" sameNameSiblings="true" >
> >           <requiredPrimaryTypes>
> >             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
> >           </requiredPrimaryTypes>
> >           </childNodeDefinition>
> >     </nodeType>
> >
> >     <nodeType name="library:Writer" isMixin="false"
> > hasOrderableChildNodes="false" >
> >         <supertypes>
> >             <supertype>teneo:eobject</supertype>
> >         </supertypes>
> >         <propertyDefinition name="name" requiredType="String"
> > autoCreated="false" mandatory="false" onParentVersion="COPY"
> > protected="false" multiple="false"/>
> >         <childNodeDefinition name="books"
> > defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> > onParentVersion="COPY" protected="false" sameNameSiblings="true" >
> >           <requiredPrimaryTypes>
> >             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
> >           </requiredPrimaryTypes>
> >           </childNodeDefinition>
> >     </nodeType>
> >
> >     <nodeType name="teneo:content" isMixin="false" >
> >      <supertypes>
> >       <supertype>nt:unstructured</supertype>
> >       </supertypes>
> >       <childNodeDefinition name="library:Library"
> > defaultPrimaryType="library:Library" autoCreated="false"
> > mandatory="false" onParentVersion="COPY" protected="false"
> > sameNameSiblings="false" >
> >         <requiredPrimaryTypes>
> >             <requiredPrimaryType>library:Library</requiredPrimaryType>
> >         </requiredPrimaryTypes>
> >       </childNodeDefinition>
> >     <childNodeDefinition name="library:Book"
> > defaultPrimaryType="library:Book" autoCreated="false"
> mandatory="false"
> > onParentVersion="COPY" protected="false" sameNameSiblings="true" >
> >         <requiredPrimaryTypes>
> >             <requiredPrimaryType>library:Book</requiredPrimaryType>
> >         </requiredPrimaryTypes>
> >     </childNodeDefinition>
> >     <childNodeDefinition name="library:Writer"
> > defaultPrimaryType="library:Writer" autoCreated="false"
> > mandatory="false" onParentVersion="COPY" protected="false"
> > sameNameSiblings="true" >
> >         <requiredPrimaryTypes>
> >             <requiredPrimaryType>library:Writer</requiredPrimaryType>
> >         </requiredPrimaryTypes>
> >       </childNodeDefinition>
> >     </nodeType>
> >
> >
> >
>

RE: Session Importer: Question on NodeType matching

Posted by "Kar, Swayambhuba" <sw...@hp.com>.
Guys,

Marking the super type of all the generated custom types to nt:base is
hard coded in the schema converter class and hence the behavior.

Thanks,
-Swayam

-----Original Message-----
From: Kar, Swayambhuba 
Sent: Friday, November 10, 2006 11:18 AM
To: users@jackrabbit.apache.org
Subject: RE: Session Importer: Question on NodeType matching

Hi Dan/Stefen:

I have a similar kind of requirement. Only exception being, I create the
custom node types from a .xsd schema definition. However, after the node
types have been crated, the super type for all the node types are set to
nt:base. How do I tweak the .xsd to create correct node type hierarchy?

Thanks!

-Swayam

-----Original Message-----
From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] 
Sent: Thursday, November 09, 2006 6:23 AM
To: users@jackrabbit.apache.org
Subject: Re: Session Importer: Question on NodeType matching

On 11/9/06, Dan Connelly <ds...@adelphia.net> wrote:
> Stefan Guggisberg wrote:
>
> > On 11/8/06, Dan Connelly <ds...@adelphia.net> wrote:
> >
> >> All:
> >>
> >> This is a follow-up on my questions posted per "ThirdHop for
structured
> >> node types".   I have got most of what I want working, but not all.
> >>
> >> One remaining problem is that a certain child-node stays
unstructured
> >> although I have provided a structured node type for it.   It is
> >> difficult to diagnose why I am not getting jcr:primaryType of
> >> "teneo:proxy" for the "author" child node.
> >>
> >> Details below.   The "library:Book" node is imported (correctly) as
a
> >> structured type.   But its child "author" is not.   It should be a
> >> "teneo:proxy" primary node type.
> >>
> >> Could there be a problem here because the"author" element is in the
> >> un-named namespace, not in the "library" namespace of its parent?
> >
> >
> > no. the problem is the following:
> >
> > [...]
> > <library:Book jcr:primaryType="teneo:eobject"
> > [...]
> >
> > i.e. library:Book is of type teneo:eobject which extends
> > nt:unstructured. that's why "author" ends up being of type
> > nt:unstructured.
> >
> > i guess library:Book should be of type library:Book.
> >
> > btw: the naming of node and type is somewhat confusing...
> >
> > cheers
> > stefan
> >
> <snip>
>
------------------------------------------------------------------------
--------------------------------
>
> Stefan:
>
> Agreed, the jcr:primaryType attribute on element library:Book gets set
> incorrectly.
>
> How can I fix this in my node type specification?
>
> (I assume that I can alter this behavior through the node type defs,
> that this is not a bug in Jackrabbit.)
>
> I made some changes in my custom_nodetype.xml spec trying to make this
> change:
>
>     * I set isMixin="true" for teneo:eobject.

why do you think that this would help?

>     * I set explicit requiredPrimaryType in the childNode defs of
>       teneo:content.
>
> However, the output XML is unchanged.   The element library:Book still
> has attribute jcr:primaryType="teneo:eobject", which is incorrect.

i quickly ran a test with your node type definitions and your
xml data, here's my test code:

            root.addNode("tmp", "teneo:content");
            root.save();

            FileInputStream fis = new
FileInputStream("d:/temp/xml/book.xml");
            wsp.importXML("/tmp", fis,
ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
            fis.close();
            dumpTree(root.getNode("tmp"), System.out);

here's the console output:

[node]   /tmp
	[prop]   jcr:primaryType teneo:content
	[node]   /library:Book
		[prop]   pages 500
		[prop]   jcr:primaryType library:Book
		[prop]   category ScienceFiction
		[prop]   jcr:uuid 41a71535-3749-4e36-9981-47e8c6bcb4da
		[prop]   title The Hobbit
		[node]   /author
			[prop]   href
jcr://proxies.test.writer/#/Content.2
			[prop]   jcr:primaryType teneo:proxy

i guess everything's fine.

i suggest you redo your test with a clean repository.

cheers
stefan
>
> I have listed the relevant portion of my new custom_nodetype.xml
below.
>
>        Thanks,    Dan
>
>  <nodeType name="teneo:eobject" isMixin="true">
>     <supertypes>
>       <supertype>mix:referenceable</supertype>
>       <supertype>nt:unstructured</supertype>
>     </supertypes>
>   </nodeType>
>
>     <nodeType name="teneo:proxy" isMixin="false" >
>      <supertypes>
>       <supertype>nt:base</supertype>
>       </supertypes>
>     <propertyDefinition name="href" requiredType="String"
> autoCreated="false" mandatory="true" onParentVersion="COPY"
> protected="false" multiple="false" />
>     </nodeType>
>
>     <nodeType name="library:Book" isMixin="false"
> hasOrderableChildNodes="false" >
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="title" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <propertyDefinition name="pages" requiredType="Long"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <propertyDefinition name="category" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="author"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="true"
> onParentVersion="COPY" protected="false" sameNameSiblings="false" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>         </childNodeDefinition>
>     </nodeType>
>
>     <nodeType name="library:Library" isMixin="false"
> hasOrderableChildNodes="false">
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="name" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="writers"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>           </childNodeDefinition>
>         <childNodeDefinition name="books"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>           </childNodeDefinition>
>     </nodeType>
>
>     <nodeType name="library:Writer" isMixin="false"
> hasOrderableChildNodes="false" >
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="name" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="books"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>           </childNodeDefinition>
>     </nodeType>
>
>     <nodeType name="teneo:content" isMixin="false" >
>      <supertypes>
>       <supertype>nt:unstructured</supertype>
>       </supertypes>
>       <childNodeDefinition name="library:Library"
> defaultPrimaryType="library:Library" autoCreated="false"
> mandatory="false" onParentVersion="COPY" protected="false"
> sameNameSiblings="false" >
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>library:Library</requiredPrimaryType>
>         </requiredPrimaryTypes>
>       </childNodeDefinition>
>     <childNodeDefinition name="library:Book"
> defaultPrimaryType="library:Book" autoCreated="false"
mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>library:Book</requiredPrimaryType>
>         </requiredPrimaryTypes>
>     </childNodeDefinition>
>     <childNodeDefinition name="library:Writer"
> defaultPrimaryType="library:Writer" autoCreated="false"
> mandatory="false" onParentVersion="COPY" protected="false"
> sameNameSiblings="true" >
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>library:Writer</requiredPrimaryType>
>         </requiredPrimaryTypes>
>       </childNodeDefinition>
>     </nodeType>
>
>
>

RE: Session Importer: Question on NodeType matching

Posted by "Kar, Swayambhuba" <sw...@hp.com>.
Hi Dan/Stefen:

I have a similar kind of requirement. Only exception being, I create the
custom node types from a .xsd schema definition. However, after the node
types have been crated, the super type for all the node types are set to
nt:base. How do I tweak the .xsd to create correct node type hierarchy?

Thanks!

-Swayam

-----Original Message-----
From: Stefan Guggisberg [mailto:stefan.guggisberg@gmail.com] 
Sent: Thursday, November 09, 2006 6:23 AM
To: users@jackrabbit.apache.org
Subject: Re: Session Importer: Question on NodeType matching

On 11/9/06, Dan Connelly <ds...@adelphia.net> wrote:
> Stefan Guggisberg wrote:
>
> > On 11/8/06, Dan Connelly <ds...@adelphia.net> wrote:
> >
> >> All:
> >>
> >> This is a follow-up on my questions posted per "ThirdHop for
structured
> >> node types".   I have got most of what I want working, but not all.
> >>
> >> One remaining problem is that a certain child-node stays
unstructured
> >> although I have provided a structured node type for it.   It is
> >> difficult to diagnose why I am not getting jcr:primaryType of
> >> "teneo:proxy" for the "author" child node.
> >>
> >> Details below.   The "library:Book" node is imported (correctly) as
a
> >> structured type.   But its child "author" is not.   It should be a
> >> "teneo:proxy" primary node type.
> >>
> >> Could there be a problem here because the"author" element is in the
> >> un-named namespace, not in the "library" namespace of its parent?
> >
> >
> > no. the problem is the following:
> >
> > [...]
> > <library:Book jcr:primaryType="teneo:eobject"
> > [...]
> >
> > i.e. library:Book is of type teneo:eobject which extends
> > nt:unstructured. that's why "author" ends up being of type
> > nt:unstructured.
> >
> > i guess library:Book should be of type library:Book.
> >
> > btw: the naming of node and type is somewhat confusing...
> >
> > cheers
> > stefan
> >
> <snip>
>
------------------------------------------------------------------------
--------------------------------
>
> Stefan:
>
> Agreed, the jcr:primaryType attribute on element library:Book gets set
> incorrectly.
>
> How can I fix this in my node type specification?
>
> (I assume that I can alter this behavior through the node type defs,
> that this is not a bug in Jackrabbit.)
>
> I made some changes in my custom_nodetype.xml spec trying to make this
> change:
>
>     * I set isMixin="true" for teneo:eobject.

why do you think that this would help?

>     * I set explicit requiredPrimaryType in the childNode defs of
>       teneo:content.
>
> However, the output XML is unchanged.   The element library:Book still
> has attribute jcr:primaryType="teneo:eobject", which is incorrect.

i quickly ran a test with your node type definitions and your
xml data, here's my test code:

            root.addNode("tmp", "teneo:content");
            root.save();

            FileInputStream fis = new
FileInputStream("d:/temp/xml/book.xml");
            wsp.importXML("/tmp", fis,
ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
            fis.close();
            dumpTree(root.getNode("tmp"), System.out);

here's the console output:

[node]   /tmp
	[prop]   jcr:primaryType teneo:content
	[node]   /library:Book
		[prop]   pages 500
		[prop]   jcr:primaryType library:Book
		[prop]   category ScienceFiction
		[prop]   jcr:uuid 41a71535-3749-4e36-9981-47e8c6bcb4da
		[prop]   title The Hobbit
		[node]   /author
			[prop]   href
jcr://proxies.test.writer/#/Content.2
			[prop]   jcr:primaryType teneo:proxy

i guess everything's fine.

i suggest you redo your test with a clean repository.

cheers
stefan
>
> I have listed the relevant portion of my new custom_nodetype.xml
below.
>
>        Thanks,    Dan
>
>  <nodeType name="teneo:eobject" isMixin="true">
>     <supertypes>
>       <supertype>mix:referenceable</supertype>
>       <supertype>nt:unstructured</supertype>
>     </supertypes>
>   </nodeType>
>
>     <nodeType name="teneo:proxy" isMixin="false" >
>      <supertypes>
>       <supertype>nt:base</supertype>
>       </supertypes>
>     <propertyDefinition name="href" requiredType="String"
> autoCreated="false" mandatory="true" onParentVersion="COPY"
> protected="false" multiple="false" />
>     </nodeType>
>
>     <nodeType name="library:Book" isMixin="false"
> hasOrderableChildNodes="false" >
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="title" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <propertyDefinition name="pages" requiredType="Long"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <propertyDefinition name="category" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="author"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="true"
> onParentVersion="COPY" protected="false" sameNameSiblings="false" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>         </childNodeDefinition>
>     </nodeType>
>
>     <nodeType name="library:Library" isMixin="false"
> hasOrderableChildNodes="false">
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="name" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="writers"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>           </childNodeDefinition>
>         <childNodeDefinition name="books"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>           </childNodeDefinition>
>     </nodeType>
>
>     <nodeType name="library:Writer" isMixin="false"
> hasOrderableChildNodes="false" >
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="name" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="books"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>           </childNodeDefinition>
>     </nodeType>
>
>     <nodeType name="teneo:content" isMixin="false" >
>      <supertypes>
>       <supertype>nt:unstructured</supertype>
>       </supertypes>
>       <childNodeDefinition name="library:Library"
> defaultPrimaryType="library:Library" autoCreated="false"
> mandatory="false" onParentVersion="COPY" protected="false"
> sameNameSiblings="false" >
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>library:Library</requiredPrimaryType>
>         </requiredPrimaryTypes>
>       </childNodeDefinition>
>     <childNodeDefinition name="library:Book"
> defaultPrimaryType="library:Book" autoCreated="false"
mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>library:Book</requiredPrimaryType>
>         </requiredPrimaryTypes>
>     </childNodeDefinition>
>     <childNodeDefinition name="library:Writer"
> defaultPrimaryType="library:Writer" autoCreated="false"
> mandatory="false" onParentVersion="COPY" protected="false"
> sameNameSiblings="true" >
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>library:Writer</requiredPrimaryType>
>         </requiredPrimaryTypes>
>       </childNodeDefinition>
>     </nodeType>
>
>
>

Re: Session Importer: Question on NodeType matching

Posted by Stefan Guggisberg <st...@gmail.com>.
On 11/9/06, Dan Connelly <ds...@adelphia.net> wrote:
> Stefan Guggisberg wrote:
>
> > On 11/8/06, Dan Connelly <ds...@adelphia.net> wrote:
> >
> >> All:
> >>
> >> This is a follow-up on my questions posted per "ThirdHop for structured
> >> node types".   I have got most of what I want working, but not all.
> >>
> >> One remaining problem is that a certain child-node stays unstructured
> >> although I have provided a structured node type for it.   It is
> >> difficult to diagnose why I am not getting jcr:primaryType of
> >> "teneo:proxy" for the "author" child node.
> >>
> >> Details below.   The "library:Book" node is imported (correctly) as a
> >> structured type.   But its child "author" is not.   It should be a
> >> "teneo:proxy" primary node type.
> >>
> >> Could there be a problem here because the"author" element is in the
> >> un-named namespace, not in the "library" namespace of its parent?
> >
> >
> > no. the problem is the following:
> >
> > [...]
> > <library:Book jcr:primaryType="teneo:eobject"
> > [...]
> >
> > i.e. library:Book is of type teneo:eobject which extends
> > nt:unstructured. that's why "author" ends up being of type
> > nt:unstructured.
> >
> > i guess library:Book should be of type library:Book.
> >
> > btw: the naming of node and type is somewhat confusing...
> >
> > cheers
> > stefan
> >
> <snip>
> --------------------------------------------------------------------------------------------------------
>
> Stefan:
>
> Agreed, the jcr:primaryType attribute on element library:Book gets set
> incorrectly.
>
> How can I fix this in my node type specification?
>
> (I assume that I can alter this behavior through the node type defs,
> that this is not a bug in Jackrabbit.)
>
> I made some changes in my custom_nodetype.xml spec trying to make this
> change:
>
>     * I set isMixin="true" for teneo:eobject.

why do you think that this would help?

>     * I set explicit requiredPrimaryType in the childNode defs of
>       teneo:content.
>
> However, the output XML is unchanged.   The element library:Book still
> has attribute jcr:primaryType="teneo:eobject", which is incorrect.

i quickly ran a test with your node type definitions and your
xml data, here's my test code:

            root.addNode("tmp", "teneo:content");
            root.save();

            FileInputStream fis = new FileInputStream("d:/temp/xml/book.xml");
            wsp.importXML("/tmp", fis,
ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
            fis.close();
            dumpTree(root.getNode("tmp"), System.out);

here's the console output:

[node]   /tmp
	[prop]   jcr:primaryType teneo:content
	[node]   /library:Book
		[prop]   pages 500
		[prop]   jcr:primaryType library:Book
		[prop]   category ScienceFiction
		[prop]   jcr:uuid 41a71535-3749-4e36-9981-47e8c6bcb4da
		[prop]   title The Hobbit
		[node]   /author
			[prop]   href jcr://proxies.test.writer/#/Content.2
			[prop]   jcr:primaryType teneo:proxy

i guess everything's fine.

i suggest you redo your test with a clean repository.

cheers
stefan
>
> I have listed the relevant portion of my new custom_nodetype.xml below.
>
>        Thanks,    Dan
>
>  <nodeType name="teneo:eobject" isMixin="true">
>     <supertypes>
>       <supertype>mix:referenceable</supertype>
>       <supertype>nt:unstructured</supertype>
>     </supertypes>
>   </nodeType>
>
>     <nodeType name="teneo:proxy" isMixin="false" >
>      <supertypes>
>       <supertype>nt:base</supertype>
>       </supertypes>
>     <propertyDefinition name="href" requiredType="String"
> autoCreated="false" mandatory="true" onParentVersion="COPY"
> protected="false" multiple="false" />
>     </nodeType>
>
>     <nodeType name="library:Book" isMixin="false"
> hasOrderableChildNodes="false" >
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="title" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <propertyDefinition name="pages" requiredType="Long"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <propertyDefinition name="category" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="author"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="true"
> onParentVersion="COPY" protected="false" sameNameSiblings="false" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>         </childNodeDefinition>
>     </nodeType>
>
>     <nodeType name="library:Library" isMixin="false"
> hasOrderableChildNodes="false">
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="name" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="writers"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>           </childNodeDefinition>
>         <childNodeDefinition name="books"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>           </childNodeDefinition>
>     </nodeType>
>
>     <nodeType name="library:Writer" isMixin="false"
> hasOrderableChildNodes="false" >
>         <supertypes>
>             <supertype>teneo:eobject</supertype>
>         </supertypes>
>         <propertyDefinition name="name" requiredType="String"
> autoCreated="false" mandatory="false" onParentVersion="COPY"
> protected="false" multiple="false"/>
>         <childNodeDefinition name="books"
> defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>           <requiredPrimaryTypes>
>             <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
>           </requiredPrimaryTypes>
>           </childNodeDefinition>
>     </nodeType>
>
>     <nodeType name="teneo:content" isMixin="false" >
>      <supertypes>
>       <supertype>nt:unstructured</supertype>
>       </supertypes>
>       <childNodeDefinition name="library:Library"
> defaultPrimaryType="library:Library" autoCreated="false"
> mandatory="false" onParentVersion="COPY" protected="false"
> sameNameSiblings="false" >
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>library:Library</requiredPrimaryType>
>         </requiredPrimaryTypes>
>       </childNodeDefinition>
>     <childNodeDefinition name="library:Book"
> defaultPrimaryType="library:Book" autoCreated="false" mandatory="false"
> onParentVersion="COPY" protected="false" sameNameSiblings="true" >
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>library:Book</requiredPrimaryType>
>         </requiredPrimaryTypes>
>     </childNodeDefinition>
>     <childNodeDefinition name="library:Writer"
> defaultPrimaryType="library:Writer" autoCreated="false"
> mandatory="false" onParentVersion="COPY" protected="false"
> sameNameSiblings="true" >
>         <requiredPrimaryTypes>
>             <requiredPrimaryType>library:Writer</requiredPrimaryType>
>         </requiredPrimaryTypes>
>       </childNodeDefinition>
>     </nodeType>
>
>
>

Re: Session Importer: Question on NodeType matching

Posted by Dan Connelly <ds...@adelphia.net>.
Stefan Guggisberg wrote:

> On 11/8/06, Dan Connelly <ds...@adelphia.net> wrote:
>
>> All:
>>
>> This is a follow-up on my questions posted per "ThirdHop for structured
>> node types".   I have got most of what I want working, but not all.
>>
>> One remaining problem is that a certain child-node stays unstructured
>> although I have provided a structured node type for it.   It is
>> difficult to diagnose why I am not getting jcr:primaryType of
>> "teneo:proxy" for the "author" child node.
>>
>> Details below.   The "library:Book" node is imported (correctly) as a
>> structured type.   But its child "author" is not.   It should be a
>> "teneo:proxy" primary node type.
>>
>> Could there be a problem here because the"author" element is in the
>> un-named namespace, not in the "library" namespace of its parent?
>
>
> no. the problem is the following:
>
> [...]
> <library:Book jcr:primaryType="teneo:eobject"
> [...]
>
> i.e. library:Book is of type teneo:eobject which extends
> nt:unstructured. that's why "author" ends up being of type
> nt:unstructured.
>
> i guess library:Book should be of type library:Book.
>
> btw: the naming of node and type is somewhat confusing...
>
> cheers
> stefan
>
<snip>
--------------------------------------------------------------------------------------------------------

Stefan:

Agreed, the jcr:primaryType attribute on element library:Book gets set 
incorrectly.  

How can I fix this in my node type specification?  

(I assume that I can alter this behavior through the node type defs, 
that this is not a bug in Jackrabbit.)

I made some changes in my custom_nodetype.xml spec trying to make this 
change:

    * I set isMixin="true" for teneo:eobject.
    * I set explicit requiredPrimaryType in the childNode defs of
      teneo:content.

However, the output XML is unchanged.   The element library:Book still 
has attribute jcr:primaryType="teneo:eobject", which is incorrect.

I have listed the relevant portion of my new custom_nodetype.xml below.

       Thanks,    Dan

 <nodeType name="teneo:eobject" isMixin="true">
    <supertypes>
      <supertype>mix:referenceable</supertype>
      <supertype>nt:unstructured</supertype>
    </supertypes>
  </nodeType>

    <nodeType name="teneo:proxy" isMixin="false" >
     <supertypes>
      <supertype>nt:base</supertype>
      </supertypes> 
    <propertyDefinition name="href" requiredType="String" 
autoCreated="false" mandatory="true" onParentVersion="COPY" 
protected="false" multiple="false" />
    </nodeType>
   
    <nodeType name="library:Book" isMixin="false" 
hasOrderableChildNodes="false" >
        <supertypes>
            <supertype>teneo:eobject</supertype>
        </supertypes>
        <propertyDefinition name="title" requiredType="String" 
autoCreated="false" mandatory="false" onParentVersion="COPY" 
protected="false" multiple="false"/>
        <propertyDefinition name="pages" requiredType="Long" 
autoCreated="false" mandatory="false" onParentVersion="COPY" 
protected="false" multiple="false"/>
        <propertyDefinition name="category" requiredType="String" 
autoCreated="false" mandatory="false" onParentVersion="COPY" 
protected="false" multiple="false"/>
        <childNodeDefinition name="author" 
defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="true" 
onParentVersion="COPY" protected="false" sameNameSiblings="false" >
          <requiredPrimaryTypes>
            <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
          </requiredPrimaryTypes>
        </childNodeDefinition>
    </nodeType>
   
    <nodeType name="library:Library" isMixin="false" 
hasOrderableChildNodes="false">
        <supertypes>
            <supertype>teneo:eobject</supertype>
        </supertypes>
        <propertyDefinition name="name" requiredType="String" 
autoCreated="false" mandatory="false" onParentVersion="COPY" 
protected="false" multiple="false"/>
        <childNodeDefinition name="writers" 
defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false" 
onParentVersion="COPY" protected="false" sameNameSiblings="true" >
          <requiredPrimaryTypes>
            <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
          </requiredPrimaryTypes>
          </childNodeDefinition>
        <childNodeDefinition name="books" 
defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false" 
onParentVersion="COPY" protected="false" sameNameSiblings="true" >
          <requiredPrimaryTypes>
            <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
          </requiredPrimaryTypes>
          </childNodeDefinition>
    </nodeType>

    <nodeType name="library:Writer" isMixin="false" 
hasOrderableChildNodes="false" >
        <supertypes>
            <supertype>teneo:eobject</supertype>
        </supertypes>
        <propertyDefinition name="name" requiredType="String" 
autoCreated="false" mandatory="false" onParentVersion="COPY" 
protected="false" multiple="false"/>
        <childNodeDefinition name="books" 
defaultPrimaryType="teneo:proxy" autoCreated="false" mandatory="false" 
onParentVersion="COPY" protected="false" sameNameSiblings="true" >
          <requiredPrimaryTypes>
            <requiredPrimaryType>teneo:proxy</requiredPrimaryType>
          </requiredPrimaryTypes>
          </childNodeDefinition>
    </nodeType>

    <nodeType name="teneo:content" isMixin="false" >
     <supertypes>
      <supertype>nt:unstructured</supertype>
      </supertypes> 
      <childNodeDefinition name="library:Library" 
defaultPrimaryType="library:Library" autoCreated="false" 
mandatory="false" onParentVersion="COPY" protected="false" 
sameNameSiblings="false" >
        <requiredPrimaryTypes>
            <requiredPrimaryType>library:Library</requiredPrimaryType>
        </requiredPrimaryTypes>
      </childNodeDefinition>
    <childNodeDefinition name="library:Book" 
defaultPrimaryType="library:Book" autoCreated="false" mandatory="false" 
onParentVersion="COPY" protected="false" sameNameSiblings="true" >
        <requiredPrimaryTypes>
            <requiredPrimaryType>library:Book</requiredPrimaryType>
        </requiredPrimaryTypes>
    </childNodeDefinition>
    <childNodeDefinition name="library:Writer" 
defaultPrimaryType="library:Writer" autoCreated="false" 
mandatory="false" onParentVersion="COPY" protected="false" 
sameNameSiblings="true" >
        <requiredPrimaryTypes>
            <requiredPrimaryType>library:Writer</requiredPrimaryType>
        </requiredPrimaryTypes>
      </childNodeDefinition>
    </nodeType>