You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Alexandru Popescu <th...@gmail.com> on 2006/02/10 01:35:12 UTC

polymorphic queries

Hi!

Considering the following hierarchy of node types: nt:parentType, nt:childType1 extends 
nt:parentType and nt:childType2 extends nt:parentType, than I am wondering if a query in the form:

//element(*, nt:parentType) is gonna return both types of children (or is it strict, meaning that 
the query will look only for nt:parentType nodes and no children of nt:parentType; Than to retrieve 
both children types nodes you should use //element(*, nt:childType1) or //element(*, nt:childType2)).

Thanks in advance,

./alex
--
.w( the_mindstorm )p.




Re: polymorphic queries

Posted by Alexandru Popescu <th...@gmail.com>.
#: Marcel Reutegger changed the world a bit at a time by saying (astral date: 2/10/2006 1:28 PM) :#
> Alexandru Popescu wrote:
>> Considering the following hierarchy of node types: nt:parentType, 
>> nt:childType1 extends nt:parentType and nt:childType2 extends 
>> nt:parentType, than I am wondering if a query in the form:
>> 
>> //element(*, nt:parentType) is gonna return both types of children (or 
>> is it strict, meaning that the query will look only for nt:parentType 
>> nodes and no children of nt:parentType; Than to retrieve both children 
>> types nodes you should use //element(*, nt:childType1) or //element(*, 
>> nt:childType2)).
> 
> this is described in section 6.6.3.2 of the JCR spec:
> 
> A type constraint specifies the common primary node type of the returned 
> nodes, plus, possibly, additional mixin types that they also must have. 
> Type constraints are inheritance-sensitive in that specifying a 
> constraint of node type X will include all nodes explicitly declared to 
> be type X, as well as all nodes of subtypes of X.
> 
> 
> regards
>   marcel
> 

I am starting to feel ashamed :-( ... I've miss the info right in front of my eyes. Marcel thanks a 
lot and sorry for wasting your time. Your help is highly appreciated.

./alex
--
.w( the_mindstorm )p.


Re: polymorphic queries

Posted by Marcel Reutegger <ma...@gmx.net>.
Alexandru Popescu wrote:
> Considering the following hierarchy of node types: nt:parentType, 
> nt:childType1 extends nt:parentType and nt:childType2 extends 
> nt:parentType, than I am wondering if a query in the form:
> 
> //element(*, nt:parentType) is gonna return both types of children (or 
> is it strict, meaning that the query will look only for nt:parentType 
> nodes and no children of nt:parentType; Than to retrieve both children 
> types nodes you should use //element(*, nt:childType1) or //element(*, 
> nt:childType2)).

this is described in section 6.6.3.2 of the JCR spec:

A type constraint specifies the common primary node type of the returned 
nodes, plus, possibly, additional mixin types that they also must have. 
Type constraints are inheritance-sensitive in that specifying a 
constraint of node type X will include all nodes explicitly declared to 
be type X, as well as all nodes of subtypes of X.


regards
  marcel