Removing branches from a tree

I've got a tree and I want to find the value at the root defined as the parent with reltype 4, but I want to exclude any branches that have a reltype of 4 anywhere along them
  1  with rel as
  2  (select 2205 parent
  3         ,2206 child
  4         ,1    reltype
  5   FROM   dual
  6   UNION all
  7   SELECT 2206
  8         ,9559
  9         ,4
10   FROM dual
11   UNION all
12   SELECT 9558
13         ,9559
14         ,1
15   FROM dual
16  )
17  select * from
18  (SELECT parent,reltype
19   FROM   rel
20   CONNECT BY PRIOR parent = child
21   START WITH child = 9559
22  )
23* WHERE reltype = 1
SQL>/
    PARENT    RELTYPE
      2205          1
      9558          1Because the record parent = 2206, child = 9559 has a reltype of 4 I don't want to proceed any further down the tree, I want my final result set just to have parent 9558. Ie. I want the connect by looping to stop when it gets to a 4.
Thanks

I want the connect by looping to stop when it gets to a 4.
CONNECT BY PRIOR parent = child and prior reltype <> 4

Similar Messages

  • Removing Branches from Fur

    Hello Experts,
    I have an image of a lion with distracting branches over part of the lion's fur. I have had little success using my experience with the healing brush and clone stamp in removing the branches from the fur while maintaining realistic detail in the fur. What do you all suggest as the best methods to go about this?
    Thanks in advance for your replies.
    dgavinjb

    For now, you can carefully use the Clone tool or (maybe, but less likely) the Healing brush, with a slightly fuzzy edge (say, 50%).  With the clone tool, do a lot of little edits, repositioning the source point fairly often.  Push the opacity down if it seems like everything you do on a particular spot is too strong.  It's not something you're going to be able to do in a single stroke.
    This is something the new content aware fill in CS5 is supposed to excel at.  Based on what I've seen, the Healing brush in CS5 will almost undoubtedly nail this problem in seconds.  Can't wait for my copy. 
    -Noel

  • How do i Drag and drop From one tree to another and vise versa?

    I have two tree structures and i'm trying to drag a leaf of a branch from one tree to another and vise versa. i'm using flex 3 to code it. I'm also trying to put a prevention on dropping a leaf of one tree from being dropped inside a branch of another tree. Anything that is dragged over to another tree should be placed as a dangling node in that tree. Please share this code and help me find a solution.
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx="
    http://www.adobe.com/2006/mxml" xmlns:comp="
    com.adobe.flex.extras.controls.*" initialize="data2
    new
    ArrayCollection(countries);"layout="
    absolute"verticalAlign="
    middle" backgroundColor="white" height="
    551">
    <mx:Script>
    <![CDATA[
    importmx.events.FlexEvent; 
    importmx.collections.ArrayCollection; 
    importmx.controls.Alert; 
    importmx.events.DragEvent; 
    importmx.managers.DragManager;  
    importmx.core.DragSource;  
    importmx.core.UIComponent;  
    importmx.controls.Tree;  
    // data provider for role name[
    Bindable] private vardata2: ArrayCollection; 
    // variable to store the node that is dragged from a tree 
    private var draggedItemOfAccessTree:XML = null;  
    private var draggedItemOfExclusionTree:XML = null; 
    private var dragItemAccess:DisplayObject =null; 
    private var dragItemExclusion:DisplayObject =null; 
    // Array to store the Role list[
    Bindable]public varcountries: Array = [{id: 0, name:
    "Role 1"},{id: 1, name:
    "Role 2"},{id: 2, name:
    "Role 3"},{id: 3, name:
    "Role 4"},{id: 4, name:
    "Role 5"},{id: 5, name:
    "Role 6"},{id: 6, name:
    "Role 7"},{id: 7, name:
    "Role 8"},{id: 8, name:
    "Role 9"},{id: 9, name:
    "Role 10"},{id: 10,name:
    "Role 11"} 
    // this event is called when we begin dragging a node in a tree 
    private function onAccessListDragEnter( event:DragEvent ) : void{
    event.preventDefault();
    vards1:DragSource = event.dragSource;  
    var items1:Array = ds1.dataForFormat("treeItems") asArray; 
    if (items1 != null && items1.length > 0 && (items1[0] isXML)){
    draggedItemOfAccessTree = items1[0];
    dragItemAccess = items1[0]
    asDisplayObject;}
    DragManager.acceptDragDrop(UIComponent(event.currentTarget));
    private function onExclusionListDragEnter( event:DragEvent ) : void{
    event.preventDefault();
    vards2:DragSource = event.dragSource;  
    var items2:Array = ds2.dataForFormat("treeItems") asArray; 
    if (items2 != null && items2.length > 0 && (items2[0] isXML)){
    draggedItemOfExclusionTree = items2[0];
    dragItemExclusion =items2[0]
    asDisplayObject;}
    DragManager.acceptDragDrop(UIComponent(event.currentTarget));
    private function onAccessListDragOver( event:DragEvent ) : void{
    event.preventDefault();
    varvar1:Number = AccessTree.selectedIndex; 
    varvar2:Number = ExclusionTree.calculateDropIndex(event);  
    var node1:XML = AccessTree.selectedItem asXML;  
    var node2:XML = ExclusionTree.calculateDropIndex(event) asXML;  
    //restrict drag & drop to nodes within same parent  
    if(draggedItemOfAccessTree.parent() == node1.parent() || draggedItemOfAccessTree.parent() != node1.parent()){
    DragManager.showFeedback(DragManager.NONE);
    //return; }
    elseDragManager.showFeedback(DragManager.MOVE);
    private function onExclusionListDragOver( event:DragEvent ) : void{
    event.preventDefault();
    varvar1:Number = ExclusionTree.selectedIndex;  
    varvar2:Number = AccessTree.calculateDropIndex(event); 
    var node1:XML = AccessTree.calculateDropIndex(event) asXML;  
    var node2:XML = ExclusionTree.selectedItem asXML;  
    //restrict drag & drop to nodes within same parent  
    if( draggedItemOfExclusionTree.parent() == node2.parent() || draggedItemOfExclusionTree.parent() != node2.parent()){
    DragManager.showFeedback(DragManager.NONE);
    // return; }
    elseDragManager.showFeedback(DragManager.MOVE);
    private function onAccessListDragDrop( event:DragEvent ) : void{
    event.preventDefault();
    varSindex:Number = AccessTree.selectedIndex; 
    varEindex:Number= ExclusionTree.calculateDropIndex(event);  
    var Enode:XML = ExclusionTree.selectedItem asXML;  
    var Anode:XML = AccessTree.selectedItem asXML; 
    if((draggedItemOfAccessTree.parent() != Anode.parent()) ){
    AccessTree.removeChildAt(Sindex);
    ExclusionTree.addChildAt(dragItemAccess , Eindex);
    // AccessTree.rdataDescriptor.removeChildAt(Anode.parent(),draggedItemOfAccessTree,Sindex);  
    //ExclusionTree.dataDescriptor.addChildAt(Enode.parent(),draggedItemOfAccessTree,Eindex); }
    private function onExclusionListDragDrop( event:DragEvent ) : void{
    event.preventDefault();
    varEindex:Number = ExclusionTree.selectedIndex; 
    varSindex:Number = AccessTree.calculateDropIndex(event);  
    var Anode:XML = AccessTree.selectedItem asXML;  
    var Enode:XML = ExclusionTree.selectedItem asXML; 
    if((draggedItemOfExclusionTree.parent() != Enode.parent()) ){
    ExclusionTree.removeChildAt(Eindex);
    AccessTree.addChildAt(dragItemExclusion, Sindex);
    // ExclusionTree.dataDescriptor.removeChildAt(Enode.parent(),draggedItemOfExclusionTree,Eind ex);  
    // AccessTree.dataDescriptor.addChildAt(Anode.parent(),draggedItemOfExclusionTree,Eindex); }
    private function onDragComplete( event:DragEvent ) : void

    Yes, I have set dragEnabled and dropEnabled to true. I trying to put restriction on dropping the node(aka leaf) of 1st free tree inside the branch(aka folder) of the 2nd tree. If something is dragged from tree1, it should be dropped only on tree2  i.e., dragged node should be appended at the end of tree2 and not inside nay of the branches of tree2. This functionality should work on both the trees. I'll be glad if u can provide the solution.

  • Dynamiclly remove node from JTree

    hi all,
    I want to remove nodes from a tree dynamically. I used "treeModel.removeNodeFromParent(node);". The node was removed from that treeModel, but the tree never updated. I tried to use tree.repaint() method. It doesn't work. Any suggestion?
    thanks a lot in advance.

    try with TreeModel.reload(); This will surely work

  • Can't remove a node from a tree

    I am using the custom tree dataDescriptor provided in Flex live
    doc. It works for creating the tree and add notes, however when I
    try to remove a node from the tree it cant work. Does anyone have
    any idea?
    This is the code for MyCustomeTreeDataDescriptor.as
    package
    import mx.collections.ArrayCollection;
    import mx.collections.CursorBookmark;
    import mx.collections.ICollectionView;
    import mx.collections.IViewCursor;
    import mx.events.CollectionEvent;
    import mx.events.CollectionEventKind;
    import mx.controls.treeClasses.*;
    public class MyCustomTreeDataDescriptor implements
    ITreeDataDescriptor
    // The getChildren method requires the node to be an Object
    // with a children field.
    // If the field contains an ArrayCollection, it returns the
    field
    // Otherwise, it wraps the field in an ArrayCollection.
    public function getChildren(node:Object,
    model:Object=null):ICollectionView
    try
    if (node is Object) {
    if(node.children is ArrayCollection){
    return node.children;
    }else{
    return new ArrayCollection(node.children);
    catch (e:Error) {
    trace("[Descriptor] exception checking for getChildren");
    return null;
    // The isBranch method simply returns true if the node is an
    // Object with a children field.
    // It does not support empty branches, but does support null
    children
    // fields.
    public function isBranch(node:Object,
    model:Object=null):Boolean {
    try {
    if (node is Object) {
    if (node.children != null) {
    return true;
    catch (e:Error) {
    trace("[Descriptor] exception checking for isBranch");
    return false;
    // The hasChildren method Returns true if the node actually
    has children.
    public function hasChildren(node:Object,
    model:Object=null):Boolean {
    if (node == null)
    return false;
    var children:ICollectionView = getChildren(node, model);
    try {
    if (children.length > 0)
    return true;
    catch (e:Error) {
    return false;
    // The getData method simply returns the node as an Object.
    public function getData(node:Object,
    model:Object=null):Object {
    try {
    return node;
    catch (e:Error) {
    return null;
    // The addChildAt method does the following:
    // If the parent parameter is null or undefined, inserts
    // the child parameter as the first child of the model
    parameter.
    // If the parent parameter is an Object and has a children
    field,
    // adds the child parameter to it at the index parameter
    location.
    // It does not add a child to a terminal node if it does not
    have
    // a children field.
    public function addChildAt(parent:Object, child:Object,
    index:int,
    model:Object=null):Boolean {
    var event:CollectionEvent = new
    CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
    event.kind = CollectionEventKind.ADD;
    event.items = [child];
    event.location = index;
    if (!parent) {
    var iterator:IViewCursor = model.createCursor();
    iterator.seek(CursorBookmark.FIRST, index);
    iterator.insert(child);
    else if (parent is Object) {
    if (parent.children != null) {
    if(parent.children is ArrayCollection) {
    parent.children.addItemAt(child, index);
    if (model){
    model.dispatchEvent(event);
    model.itemUpdated(parent);
    return true;
    else {
    parent.children.splice(index, 0, child);
    if (model)
    model.dispatchEvent(event);
    return true;
    return false;
    // The removeChildAt method does the following:
    // If the parent parameter is null or undefined, removes
    // the child at the specified index in the model.
    // If the parent parameter is an Object and has a children
    field,
    // removes the child at the index parameter location in the
    parent.
    public function removeChildAt(parent:Object, child:Object,
    index:int, model:Object=null):Boolean
    var event:CollectionEvent = new
    CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
    event.kind = CollectionEventKind.REMOVE;
    event.items = [child];
    event.location = index;
    //handle top level where there is no parent
    if (!parent)
    var iterator:IViewCursor = model.createCursor();
    iterator.seek(CursorBookmark.FIRST, index);
    iterator.remove();
    if (model)
    model.dispatchEvent(event);
    return true;
    else if (parent is Object)
    if (parent.children != undefined)
    parent.children.splice(index, 1);
    if (model)
    model.dispatchEvent(event);
    return true;
    return false;
    This is my tree definition:
    <mx:Tree width="143" top="0" bottom="0" left="0"
    height="100%"
    id="publicCaseTree"
    dataDescriptor="{new MyCustomTreeDataDescriptor()}"
    dataProvider="{ac}"
    defaultLeafIcon="@Embed('assets/caseIcon.png')"
    change="publicTreeChanged(event)"
    dragEnabled="true"
    dragMoveEnabled="false"/>
    This is how I remove the selected node from the tree. When
    Delete button is clicked, the doDeleteCase function is
    exectuted.
    public function publicTreeChanged(event:Event):void {
    selectedNode =
    publicCaseTree.dataDescriptor.getData(Tree(event.target).selectedItem,
    ac);
    public function doDeleteCase(event:Event):void{
    publicCaseTree.dataDescriptor.removeChildAt(publicCaseTree.firstVisibleItem,
    selectedNode, 0, ac);
    Any help would be appreciated.Thanks.

    Finally I removed nodes from tree, but not sure I did in the
    right way. Anybody encounter the same problem, please
    discuss.

  • How to remove the focus from a tree?

    Hello,
    how can I remove the focus from a tree, so that
    none of the elements in the tree is selected?
    I have tried using the following methods:
    setTreeSelection(null);
    setLeadSelection(IWDNode.NO_SELECTION);
    None of them worked.
    Any help highly appreciated.
    Greetings,
    Tomek.

    Hello,
    it seems I have found a (dirty) workaround to this
    problem. If anyone is interested, details below:
    When the user clicks on a tree node (say A tree),
    I do the following:
    1. request focus on the tree selected by the user
       (say B tree):
      IWDTree foldersTree = 
        (IWDTree)thisView.getElement("TreeFolders");
      foldersTree.requestFocus();
    2. invalidate the A tree (which causes the tree
       to disappear)
      wdThis.wdGetContext().nodeInbox().invalidate();
    3. recreate the A tree (filling the context nodes)
    4. unselect the A tree:
    wdContext.nodeInbox().setLeadSelection(IWDNode.NO_SELECTION);
    Thanks a lot to all of you who have responded.
    Greetings,
    Tomek.

  • 3750x Stack UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree

    A Cisco Stack 3750X switch report the following error message:
    %UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree.
    every minute +-20 sec
    Cisco IOS Software, C3750E Software (C3750E-IPBASEK9-M), Version 15.0(2)SE4, RELEASE SOFTWARE (fc1)
    analog bug: https://tools.cisco.com/bugsearch/bug/CSCsz93221

    WS-C3750G-24PS-E C3750-IPBASEK9-M version 12.2(53)SE2
    After implementing 802.1x with Avaya IP phones
    %UTIL-3-TREE: Data structure error--attempt to remove an unthreaded node from a tree
    Port then fails authentication and goes into vl-err-dis

  • Removing a NetWare 6.5 Sp5 Server from the TREE

    We are currently running 4 NOVELL SERVERS & 3 OES2 LINUX servers in a single partition TREE. We need to remove a server (UNIT4_NW1) from my tree. We have tried to remove the server by using nwconfig - Directory Options - Remove DS from this server, but the screen says "ensure that eDirectory has been informed before removal".
    Please send us the step by step procedure to remove a server (UNIT4_NW1) from the tree. Please find attached the screenshot for your reference.
    Note: All the servers are in sync.
    Please find the server details below:
    UNIT4_NW1 - Novell 6.5 SP5 (No Replica), Time Source : Secondary
    UNIT4_NW2 - NOVELL 6.5 SP5 (RW), Time Source : Secondary
    ASC_NW3 - NOVELL 6.5 SP7 (No Replica), Time Source : Secondary
    ASC_NW4 - NOVELL 6.5 SP7 (Master), Time Source : Single, CA (Ahleia CA)
    ASCNW6OES - OES2LINUX (OES2 SP2+SUSE LINUX SP3) (RW)
    ASCNW9OES - OES2LINUX (OES2 SP2+SUSE LINUX SP3) (RW)
    ASCNW10OES - OES2LINUX (OES2 SP3+SUSE LINUX SP4)

    Hi.
    On 05.05.2014 10:06, ahleia wrote:
    >
    > We are currently running 4 NOVELL SERVERS & 3 OES2 LINUX servers in a
    > single partition TREE. We need to remove a server (UNIT4_NW1) from my
    > tree. We have tried to remove the server by using nwconfig - Directory
    > Options - Remove DS from this server, but the screen says "ensure that
    > eDirectory has been informed before removal".
    You're showing a help screen there. Are you saying the help screen opens
    on its own?
    Anyways, you can ignore and close it. WHen you remove the server, at one
    point it asks you for a reference object. As you want to remove the
    server for good, just skip that without specifying one.
    CU,
    Massimo Rosen
    Novell Knowledge Partner
    No emails please!
    http://www.cfc-it.de

  • Copying data from a tree to another

    Hi all!
    I am in a trouble when I try to copy somedata from one tree to another one.
    The interface allows the user to select one item from the first tree, and then when he clicks on a button, this item is copied to the second tree. The first tree stays in the same way. It is not permitted to the user to do any operation on the first tree.
    It is permitted to the user to remove items from the second tree. But I implemented this without any trouble.
    The problem occurs, after I selected the item that will be copied. Then, when I click on Add button, an unexpected error occurs.
    The vi is attached.
    Thank you in advance
    Attachments:
    Painel Frontal.vi ‏36 KB

    I am using version 8.2, and it doesn´t allow me to sabe in 7.1
    So, I send you the screen shot of blocks diagram.
    Thank you in advance.
    Attachments:
    screenshot.PNG ‏36 KB

  • Error removing data from MDS using WLST

    I'm new at MDS so i want to remove some data which I inserted in the wrong structure....sounds quite easy. After some looking around I should be able to do this using a deployment plan and WLST. I chose the last one as I am not realy familiar yet with deployment plans. I connect with my server and started WLST did the following:
    wls:/offline> connect ('weblogic', 'mypassword' , 't3://localhost:8001')
    Connecting to t3://localhost:8001 with userid weblogic ...
    Successfully connected to managed Server 'soa_server1' that belongs to domain 'MY_DOMAIN'.
    Warning: An insecure protocol was used to connect to the
    server. To ensure on-the-wire security, the SSL port or
    Admin port should be used instead.
    wls:/MY_DOMAIN/serverConfig> deleteMetadata(application='soa-infra', server='soa-server1', docs='/apps/deploy/*')The outcome was:
    Location changed to custom tree. This is a writable tree with No root.
    For more help, use help(custom)
    and after a while it closed the WLST connection. Can anyone tell me how I can remove data from my repository or what is going wrong here?
    Thanks in advance

    Hi,
    I think you were getting this error because you had your server name incorrect : soa-server1 instead of soa_server1. Also it might be possible that soa-infra is installed on the different server.
    Regards,
    Neeraj Sehgal

  • Removing Cycles from Graphs

    Hello,
    is anyone familiar with the problem of removing cycles from a directed graph G? I would like to form a DAG G' where all possible paths that are present in G are still present in G', except that these paths don't have to be infinite (the cycles can be traversed only once).
    Thanks
    sergey

    there are many algorithms
    one of the best is dijkstra s algorithm
    you will find more in graph theory books
    you can also create sink trees
    sink trees are the trees which do not have cycles in them
    dijkstra s algorithm is also used to create sink trees so maybe ur problem will also be solved
    i dont have much info about it
    but i read it in a book by tenenbaum
    i think it was called computer networks
    if u have the book check the network layer chapter

  • One-to-many relationship - remove item from collection problem

    The ArrayCollection keeps folders tree - subtree of folder is kept in children property and is also ArrayCollection. This collection is fed by 'folders' custom assembler defined like this:
    Assembler works with adding and deleting top level objects of collection.
    Also, when I add new object to children property LCDS issues createItem for new object and then updateItem for children property of parent so everything is fine - new object is persisted and relationship is correct.
    When I remove item from children collection ONLY updateItem on assembler is issued, so object is not deleted from repository. Why this managed reletionship works for adding new object to children collection but doesnt work for deleting?

    Hi;
    A simple way may be create a view on referenced tables:
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL>
    SQL> drop table resources;
    Table dropped
    SQL> create table resources(id number, name varchar2(12));
    Table created
    SQL> insert into resources values(1,'Doc....');
    1 row inserted
    SQL> insert into resources values(2,'Img....');
    1 row inserted
    SQL> drop table documents;
    Table dropped
    SQL> create table documents(id number, resource_id number,type varchar2(12));
    Table created
    SQL> insert into documents values(1,1,'txt');
    1 row inserted
    SQL> drop table images;
    Table dropped
    SQL> create table images(id number, resource_id number,path varchar2(24));
    Table created
    SQL> insert into images values(1,2,'/data01/images/img01.jpg');
    1 row inserted
    SQL> create or replace view vw_resource_ref as
      2    select id, resource_id, type, null as path from documents
      3      union
      4     select id, resource_id, null as type, path from images;
    View created
    SQL> select * from resources r inner join vw_resource_ref rv on r.id = rv.resource_id;
            ID NAME                 ID RESOURCE_ID TYPE         PATH
             1 Doc....               1           1 txt         
             2 Img....               1           2              /data01/images/img01.jpg
    SQL> Regards....

  • [svn:bz-] 24024: recreating the branch from BlazeDS4. 6 branch in place of trunk, as per the discussion from stake holders and Rohit's recommendation.

    Revision: 24024
    Revision: 24024
    Author:   [email protected]
    Date:     2012-07-31 03:05:09 -0700 (Tue, 31 Jul 2012)
    Log Message:
    recreating the branch from BlazeDS4.6 branch in place of trunk, as per the discussion from stake holders and Rohit's recommendation.
    Removed Paths:
        blazeds/branches/4.6_Apache/

  • REPLACE statement removing commas from a money convert... I do NOT want it to do this

    I am using a case statement to remove the '-' from a negative number and place a '(' there instead. 
    The negative side of the CASE statement is as follows:
    REPLACE(CONVERT(varchar, CONVERT(money, SUM(Begin_Balance)), 1), '-', '(') + ')'
    The positive side is:
    CONVERT(varchar, CONVERT(money, SUM(Begin_Balance)), 1)
    The data output for the positive portion is 100% correct. Here is an example of the output I receive.
    (18271.15)
    (25000.00)
    82,490.00
    45,000.00
    Why is the replace statement stripping my commas?

    >> I am using a case statement to remove the '-' from a negative number and place a '(' there instead. <<
    So many horrible fundamental errors in one sentence! 
    1.  CASE is an expression, not a statement. An expression returns a scalar value of a known data type, A statement changes the schema. 
    2. In SQL, all display formatting is done in a presentation layer, never in the database.
    3. We use the ANSI/ISO Standard  CAST()  and not the old Sybase/Unix CONVERT today
    4. We use DECIMAL() and not the old Sybase/Unix MONEY. This thing does not work; it fail to do correct math; Google it! Do a data audit and see if you can go to jail for this. 
    5. SQL is not COBOL. The COBOL language treats all data as strings. STOP DOING THAT IN SQL! This language uses abstraction in the database and the presentation does the job that your old PICTURE clause used to do. 
    Can you get a 2-3 week intro course to SQL and modern programming form your company? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How do i remove money from 1 itunes account to another ?

    How Do I Remove Money From One Itunes Account To Another ?

    See:  More Like This    To the right -->

Maybe you are looking for