Logo Search packages:      
Sourcecode: relational version File versions  Download package

def relational::relation::relation::union (   self,
  other 
)
Union operation. The result will contain items present in first
and second operands.
Will return an empty one if both are empty.
Will not insert tuplicated items.
Will return None if headers are different.
It is possible to use projection and rename to make headers match.

Definition at line 233 of file relation.py.

                         :
        '''Union operation. The result will contain items present in first
        and second operands.
        Will return an empty one if both are empty.
        Will not insert tuplicated items.
        Will return None if headers are different.
        It is possible to use projection and rename to make headers match.'''
        other=self.rearrange(other) #Rearranges attributes' order
        if (self.__class__!=other.__class__)or(self.header!=other.header):
            return None
        newt=relation()
        newt.header=header(list(self.header.attributes))
        
        #Adds element from self, duplicating them all
        for e in self.content:
            newt.content.append(list(e))
        
        for e in other.content:
            if e not in newt.content:
                newt.content.append(list(e))
        return newt

Generated by  Doxygen 1.6.0   Back to index