Copyright ©2011 XBRL International Inc., All Rights Reserved.
Circulation of this Recommendation is unrestricted. This document is normative. Recipients are invited to submit comments to formula-feedback@xbrl.org, and to submit notification of any relevant patent rights of which they are aware and provide supporting documentation.
This specification is an extension of the Concept Filters Specification []. It specifies syntax and semantics for XBRL concept filtering based on effective relationships of the concept in DTS linkbases.
1 Introduction
   1.1 Background
   1.2 Relationship to other work
   1.3 Language independence
   1.4 Terminology
   1.5 Document conventions (non-normative)
   1.6 Namespaces and namespace prefixes
   1.7 XPath usage
2 Syntax
   2.1 Concept relation filter
A Normative schema
B References
C Intellectual property status (non-normative)
D Acknowledgements (non-normative)
E Document history (non-normative)
F Errata corrections in this document
1 Namespaces and namespace prefixes
arcname
arcrole
axis
concept name filter
generations
linkname
linkrole
source
test
This specification is an extension to the Concept Filters Specification []. It defines XML syntax [XML] for filters that condition upon features of XBRL concept effective relationships, including:
The filters defined in this specification can cover the concept aspect.
This specification is a member of a suite of similar specifications that define specific types of criteria that can be used to select facts from input XBRL instance. It enhances the fact selection capabilities of the XBRL Variables Specification [VARIABLES].
This specification depends upon the XBRL Specification [XBRL 2.1], and the XBRL Variables Specification [VARIABLES]. In the event of any conflicts between this specification and the specifications upon which it depends, this specification does not prevail.
The official language of XBRL International's own work products is English and the preferred spelling convention is UK English.
This specification is consistent with the definitions of any of the terms defined in specifications that it depends on.
Documentation conventions follow those set out in the XBRL Variables Specification [VARIABLES].
    Namespace prefixes [XML NAMES] will be used 
    for elements and attributes in
    the form ns:name where ns is the 
    namespace prefix and name is the local name. 
    Throughout this specification, the mappings
    from namespace prefixes to actual namespaces is consistent
    with  Table 1.
  
The prefix column in Table 1 is non normative. The namespace URI column is normative.
| Prefix | Namespace URI | 
|---|---|
| 
                           crf
                         | 
                           http://xbrl.org/2010/filter/concept-relation
                         | 
| 
                           xbrlcrfe
                         | 
                           http://xbrl.org/2010/filter/concept-relation/error
                         | 
| eg | http://example.com/ | 
| fn | http://www.w3.org/2005/xpath-functions | 
| link | http://www.xbrl.org/2003/linkbase | 
| xbrli | http://www.xbrl.org/2003/instance | 
| xfi | http://www.xbrl.org/2008/function/instance | 
| xbrldi | http://xbrl.org/2006/xbrldi | 
| xbrldt | http://xbrl.org/2005/xbrldt | 
| xl | http://www.xbrl.org/2003/XLink | 
| xlink | http://www.w3.org/1999/xlink | 
| xs | http://www.w3.org/2001/XMLSchema | 
| xsi | http://www.w3.org/2001/XMLSchema-instance | 
| gen | http://xbrl.org/2008/generic | 
| variable | http://xbrl.org/2008/variable | 
| iso4217 | http://www.xbrl.org/2003/iso4217 | 
This specification only provides a textual declaration of syntax constraints when those constraints are not expressed by the normative schema supplied with this specification.
Explanations of elements and attributes are only supplied when explanations are not already provided in other specifications.
Unless explicitly stated otherwise, a reference to a specific element MUST be read as a reference to that element or to any element in its substitution group.
          A concept relation filter is declared by a  <crf:conceptRelation> 
          element.
          The syntax for the 
           <cf:conceptRelation>  element 
          is defined by the normative schema supplied with this specification.
        
The concept relation filter matches facts based upon the effective relationships of their concepts to the source concept, in a specified linkroleURI network of effective relationships, of a specified arcroleURI, on a specified axis, inclusive of specified generations, and meeting an optional test expression.
The implied XPath below is meant to be illustrative of an XPath solution, but an actual formula processor may have an efficient solution without repetitive re-iteration.
          The source of the relationships is expressed by term in one of three forms. 
          In the implied XPath expressions below, a value needs to be determined for #source.
          If the  <crf:conceptRelation>  element has a  <crf:qnameExpression>  child element, 
          then #source is the QName returned by evaluating the
          XPath expression contained by the  <crf:qnameExpression>  element.
          If the  <crf:conceptRelation>  element has a child  <crf:qname>  
          element, then that  <crf:qname>  element contains a QName.
          #source is then fn:QName(#namespace,#name) where
          #namespace is the namespace of that QName value
          and #name is the local name of that QName value.
          Otherwise, the  <crf:conceptRelation>  element has a child  <crf:variable>  
          element then #source is the QName of the fact bound to the <crf:variable> 
          element, e.g., fn:node-name(#variable).
          
            The special QName xfi:root is recognized when it is desired 
            to match facts based on relationships to siblings at, or descendants from, the 'root' level
            (whose source concepts have no parents) in the network represented
            by the linkroleURI and arcroleURI.
          
            A linkrole is either the value of the  <crf:linkrole>  child
            element of a  <crf:conceptRelation>  element, or the URI result of evaluating the 
            XPath expression of the  <crf:linkroleExpression>  child
            element of a  <crf:conceptRelation> .
          
            The #linkrole is a URI value that specifies the network of effective
            relationships to determine the selected fact concepts on the specified
            axis from the #source concept used as the origin.
        
            A linkname is either the value of the  <crf:linkname>  child
            element of a  <crf:conceptRelation>  element, or the QName result of evaluating the 
            XPath expression of the  <crf:linknameExpression>  child
            element of a  <crf:conceptRelation> .
          
            The #linkname is an optional QName value that specifies the link element name
            when needed to unambiguously determine the base set network of effective
            relationships to determine the selected fact concepts on the specified
            axis from the #source concept used as the origin.  It may be needed, for example, 
            to unambiguously designate a base set if
            standard arc roles are used in non-standard link elements, or when generic arcs may
            be contained in multiple link elements.
        
            A arcrole is either the value of the  <crf:arcrole>  child
            element of a  <crf:conceptRelation>  element, or the URI result of evaluating the 
            XPath expression of the  <crf:arcroleExpression>  child
            element of a  <crf:conceptRelation> .
          
            A arcname is either the value of the  <crf:arcname>  child
            element of a  <crf:conceptRelation>  element, or the QName result of evaluating the 
            XPath expression of the  <crf:arcnameExpression>  child
            element of a  <crf:conceptRelation> .
          
            The #arcname is an optional QName value that specifies the arc element name
            when needed to unambiguously determine the base set network of effective
            relationships to determine the selected fact concepts on the specified
            axis from the #source concept used as the origin.  It may be needed, for example, 
            to unambiguously designate a base set if
            standard arc roles are used on non-standard arc elements, or when multiple generic arc elements may
            utilize the same arcrole value.
        
            A axis is the value of the  <crf:axis>  child
            element of a  <crf:conceptRelation>  element.
          
        If the #axis value is 'descendant' then the facts to be matched are descendants in relationships from the source concept, in the linkrole network of arcrole effective relationships.  ('child' is the same as descendant with generations = 1.)  For the special source QName xfi:root, descendants are those from the topmost level (those whose source concepts have no parents).
      
        If the #axis value is 'descendant-or-self' then the facts matched include those of the source concept and of 'descendant' per above.
      
        If the #axis value is 'ancestor' then the facts to be matched are ancestors in relationships from the source concept, in the linkrole network of arcrole effective relationships.  ('parent' is the same as ancestor with generations = 1.) (Ancestor of xfi:root will have no matching facts.)
      
        If the #axis value is 'ancestor-or-self' then the facts matched include those of the source concept and of 'ancestor' per above.
      
        If the #axis value is 'sibling' then the facts to be matched are the children of the same parents as the source concept, unless the source concept is at root level, then siblings are other root concepts.  (In the implied XPath expressions below, the sibling of roots situation is handled by a separate or clause where both the source concept and match candidate have no parent relationships.)
      
        If the #axis value is 'sibling-or-self' then the facts matched include those of the source concept and of 'sibling' per above.
      
        If the #axis value is 'sibling-or-descendant' then the facts matched include siblings, per above, plus descendants.  The generations count is that of the number of descendant generations, e.g., 1 means only siblings plus children, 2 means siblings, children, and grandchildren, 0 means siblings and all descendants.
      
            A generations is the value of the  <crf:generations>  child
            element of a  <crf:conceptRelation>  element.
            The  <crf:generations>  element is optional.
          
        The #generations value specifies a limit of number of generations (for descendant or ancestor), or zero (if unlimited generations navigation is desired.  #generations=1 and descendant axis means obtain only children, #generations=2 obtains children and grandchildren, and #generations=0 means all descendants.
      
        If #generations is provided it must be 1 for a sibling, sibling-or-self, child, child-or-self, parent, or parent-or-self axes.
      
        If #generations is omitted, the assumed value is 1 for sibling, child, or parent axes, and 0
        for ancestor, descendant, and sibling-or-descendant axes.
      
        In any case if a descendant or ancestor concept repeats in the path from the source, it is not recursively pursued further for unlimited generations navigation (#generations =0), but it is recursively pursued further for limited generations navigation.  Thus it is not wise to put a high integer on generations count if directed cycles may exist. 
      
            A test is the value of the optional  <crf:test>  attribute
            of a  <crf:conceptRelation>  element.  In the expressions below if no
             <crf:test>  is present then the expression can be obviously simplified, or
            fn:true() substituted for test.
          
           The context node (".") in #test is the effective relationship 
           implementation-defined object or relationship surrogate (as described for outputs of the xfi:concept-relationships
           function).  This object is opaque as it
        may be used only as function arguments, but not for direct XPath navigation or value access.  The
        implementation-defined object or relationship surrogate is intended to be only used as parameters to other functions
        such as xfi:relationship-from-concept, xfi:relationship-to-concept, xfi:relationship-attribute, 
        xfi:relationship-element, xfi:link-attribute, and xfi:link-element.  For example, an effective calculation relationship 
        will have a "weight" attribute, which is accessed by function as xfi:relationship-attribute(.,QName('','weight')).
        An effective presentation relationship in a movement pattern will have
        xfi:relationship-attribute(.,QName('','preferredLabel')) values of
         'http://www.xbrl.org/2003/role/periodStartLabel' or 'http://www.xbrl.org/2003/role/periodEndLabel'.
        
The implied XPath expression is provided only for illustrative purposes, as an implementation may utilize different strategies such as relationship indexing:
    ((some $relationship in 
        xfi:concept-relationships(
            #source,
            #linkrole, 
            #arcrole, 
            fn:replace(#axis,'-or-self',''), 
            #generations) satisfies
        ($relationship[#test] and (node-name() eq
             (if (matches(#axis,'ancestor|parent')) 
              then xfi:relationship-from-concept($relationship)
              else xfi:relationship-to-concept($relationship)))))
      or (fn:starts-with(#axis,'sibling') and
          fn:empty( xfi:concept-relationships(
            #source,
            #linkrole, #arcrole, 'parent', 1)) and
          fn:empty( xfi:concept-relationships(
            node-name(),
            #linkrole, #arcrole, 'parent', 1)) and
          fn:exists( xfi:concept-relationships(
            node-name(),
            #linkrole, #arcrole, 'child', 1)) and
          (node-name() ne #source))
      or (fn:ends-with(#axis,'-or-self') and 
          ( if ( QName('http://www.xbrl.org/2008/function/instance','root') eq #source)
            then (fn:empty( xfi:concept-relationships(
                    node-name(),
                    #linkrole, #arcrole, 'parent', 1)) and
                  fn:exists( xfi:concept-relationships(
                    node-name(),
                    #linkrole, #arcrole, 'child', 1)))
            else  (node-name() eq #source)
          )
     )
          
        where #source is produced as follows:
            
 <crf:conceptRelation>  element contains a  <crf:qname>  element,
                  then the #source term is
                  fn:QName(#source-namespace,#source-name) where #source-namespace 
                  is the namespace for the QName specified as the content of the 
                   <crf:qname>  element and #source-name is the local
                  name for the QName specified as the content of the
                   <crf:qname>  element
                 <crf:conceptRelation>  element contains a  <crf:qnameExpression>  element,
                    then the #source term is the QName
                    result of evaluating the XPath expression of the  <crf:qnameExpression> .
                 <crf:conceptRelation>  element contains a  <crf:variable>  element,
                  then the #source term is
                  fn:node-name(#source-variable) where #source-variable is the content of the 
                   <crf:variable>  element
                
        and where #linkrole is produced as follows:
            
 <crf:conceptRelation>  element contains a  <crf:linkrole>  element,
                  then the #linkrole term is the content of the  <crf:linkrole>  element.
                 <crf:conceptRelation>  element contains a  <crf:linkroleExpression> 
                    element, then the #linkrole term is the anyURI
                    result of evaluating the XPath expression of the  <crf:linkroleExpression> .
                
        and where #arcrole is produced as follows:
            
 <crf:conceptRelation>  element contains a  <crf:arcrole>  element,
                  then the #linkrole term is the content of the  <crf:linkrole>  element.
                 <crf:conceptRelation>  element contains a  <crf:arcroleExpression> 
                    element, then the #arcrole term is the anyURI
                    result of evaluating the XPath expression of the  <crf:arcroleExpression> .
                
        and where #generations is provided as an optional parameter to the
        xfi:concept-relationships function if the  <crf:conceptRelation>  element 
        contains a  <crf:generations>  element, and omitted as a parameter otherwise (as it is
        optional for the xfi:concept-relationships function just as for the
         <crf:conceptRelation>  element).
        
| Filter1 | Selection criteria | 
|---|---|
| <crf:conceptRelation xlink:label="f_children"> <crf:variable> parent</crf:variable> <crf:linkrole> http://abc.com/role/link1</crf:linkrole> <crf:arcrole> http://abc.com/arcrole/def-test</crf:arcrole> <crf:axis></crf:conceptRelation> child</crf:axis> | The factVariables of this filter match the children of the the concept of the variable $parent, in the linkrole and arcrole as noted. | 
| <crf:conceptRelation xlink:label="f_posChildValues" test="xfi:relationship-attribute(.,QName('','weight')) eq 1"> <crf:variable> parent</crf:variable> <crf:linkrole> http://www.xbrl.org/2003/role/link</crf:linkrole> <crf:arcrole> http://www.xbrl.org/2003/arcrole/summation-item</crf:arcrole> <crf:axis></crf:conceptRelation> child</crf:axis> <crf:conceptRelation xlink:label="f_negChildValues" test="xfi:relationship-attribute(.,QName('','weight')) eq -1"> <crf:variable> parent</crf:variable> <crf:linkrole> http://www.xbrl.org/2003/role/link</crf:linkrole> <crf:arcrole> http://www.xbrl.org/2003/arcrole/summation-item</crf:arcrole> <crf:axis></crf:conceptRelation> child</crf:axis> | These two filters match facts whose concepts are, respectively, 
                  +1 weighted and -1 weighted, calculation linkbase
                  children of the concept of fact $parentfor
                  default link role. | 
| <crf:conceptRelation xlink:label="f_roots"> <crf:qname> xfi:root</crf:qname> <crf:linkrole> http://abc.com/role/link2</crf:linkrole> <crf:arcrole> http://www.xbrl.org/2003/arcrole/parent-child</crf:arcrole> <crf:axis></crf:conceptRelation> sibling</crf:axis> | The factVariables of this filter match facts which are root presentation linkbase concepts in the linkrole noted. | 
| <crf:conceptRelation xlink:label="f_endingBalance" test="xfi:relationship-attribute(.,QName('','preferredLabel')) eq 'http://www.xbrl.org/2003/role/periodEndLabel'"> <crf:variable> xfi:root</crf:variable> <crf:linkrole> http://abc.com/role/link1</crf:linkrole> <crf:arcrole> http://www.xbrl.org/2003/arcrole/parent-child</crf:arcrole> <crf:axis></crf:conceptRelation> descendant</crf:axis> | For a movement (roll-forward) filtering example, this (first of 3) filters matches ending balance facts which are of presentation linkbase concepts that have a periodEndLabel in the linkrole noted. (See movement-formula.xml in test case directory tests/60000 Extensions/61100 ConceptRelationsFilter-Processing for full implementation.) These examples are based on the style of us-gaap 2009. | 
| <crf:conceptRelation xlink:label="f_changes" test="empty( xfi:relationship-attribute(.,QName('','preferredLabel')) )"> <crf:variable> endingBalance</crf:variable> <crf:linkrole> http://abc.com/role/link1</crf:linkrole> <crf:arcrole> http://www.xbrl.org/2003/arcrole/parent-child</crf:arcrole> <crf:axis></crf:conceptRelation> sibling-or-descendant</crf:axis> | For a movement (roll-forward) filtering example, this (second of 3) filters matches changes facts which are of $endingBalance's sibling or all descendant concepts that have no preferredLabel attribute in the linkrole noted. Other filters are provided in the above reference to align period to ending balance, ensure duration period, etc. | 
| <crf:conceptRelation xlink:type="resource" xlink:label="f_beginningBalance" test="xfi:relationship-attribute(.,QName('','preferredLabel')) eq 'http://www.xbrl.org/2003/role/periodStartLabel' and xfi:relationship-to-concept(.) eq node-name($endingBalance)"> <crf:variable> endingBalance</crf:variable> <crf:linkrole> http://abc.com/role/link1</crf:linkrole> <crf:arcrole> http://www.xbrl.org/2003/arcrole/parent-child</crf:arcrole> <crf:axis></crf:conceptRelation> sibling</crf:axis> | For a movement (roll-forward) filtering example, this (third of 3) filters matches beginning balance facts which are of $endingBalance's concept and the relationship has a periodStartLabel attribute in the linkrole noted. Other filters are provided in the above reference to align period to start of changes duration period (if any) else to ending balance's preceeding year (or quarter), etc. | 
1. XLink attributes have been omitted.
The following is the XML schema provided as part of this specification. This is normative. Non-normative versions (which should be identical to these except for appropriate comments indicating their non-normative status) are also provided as separate files for convenience of users of the specification.
NOTE: (non-normative) Following the schema maintenance policy of XBRL International, it is the intent (but is not guaranteed) that the location of non-normative versions of these schemas on the web will be as follows:
http://www.xbrl.org/2008/ - during the drafting process for
      this specification this directory should contain a copy of the
      most recent published version of the schema at
      http://www.xbrl.org/2010/concept-relation-filter.xsd.
    http://www.xbrl.org/2008/. During the drafting process for
          this specification this directory should contain a copy of the
          most recent published version of the schema at
          
          http://www.xbrl.org/2008/concept-relation-filter.xsd.
        This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to XBRL International or XBRL organizations, except as required to translate it into languages other than English. Members of XBRL International agree to grant certain licenses under the XBRL International Intellectual Property Policy (www.xbrl.org/legal).
This document and the information contained herein is provided on an "AS IS" basis and XBRL INTERNATIONAL DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
The attention of users of this document is directed to the possibility that compliance with or adoption of XBRL International specifications may require use of an invention covered by patent rights. XBRL International shall not be responsible for identifying patents for which a license may be required by any XBRL International specification, or for conducting legal inquiries into the legal validity or scope of those patents that are brought to its attention. XBRL International specifications are prospective and advisory only. Prospective users are responsible for protecting themselves against liability for infringement of patents. XBRL International takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Members of XBRL International agree to grant certain licenses under the XBRL International Intellectual Property Policy (www.xbrl.org/legal).
This document could not have been written without the contributions of many people including the participants in the Formula Working Group.
| Date | Author | Details | 
|---|---|---|
| 28 October 2009 | Herm Fischer | First internal working draft created, drawing extensively on the previous formula specification drafts. | 
| 01 November 2009 | Herm Fischer | Improved wording, added examples. Changed siblings axis with descendants to sibling-or-descendant. Changed generations to be optional, with defaults as noted, per suggestion from Victor Morilla. | 
| 05 September 2010 | Herm Fischer | Editorial changes per Hitoshi Okumura, fixing typos and obsolete contents. | 
| 16 October 2010 | Herm Fischer | Typos in implied XPath expression and additional term for source of xfi:root when the axis ends with "-or-self", per Hitoshi Okumura, 2010-10-13. | 
| 11 March 2011 | Herm Fischer | Generations changed to nonNegativeInteger per suggestion by Hitoshi Okumura. Typo fixed in table 1. | 
| 17 August 2011 | Herm Fischer | 
           Fixed typo where  | 
This appendix contains a list of the errata that have been incorporated into this document. This represents all those errata corrections that have been approved by the XBRL International Formula Working Group up to and including 24 October 2011. Hyperlinks to relevant e-mail threads may only be followed by those who have access to the relevant mailing lists. Access to internal XBRL mailing lists is restricted to members of XBRL International Inc.
No errata have been incorporated into this document.