M1-Arborator-NaijaSUD/arborator/lib/database.py
def nrDifferent(self, atid, btid, attribute, dbcrsr):
		"""
		counts the number of differnt attributes "attribute" of the tree id atid and the tree btid
		"""
		db,cursor=dbcrsr
		if attribute:
			cursor.execute('select count(*) from (select nr,attr,value from features where treeid=? and attr=?)  t1, (select nr,attr,value from features where treeid=? and attr=?)  t2 where t1.nr=t2.nr and t1.value<>t2.value;', (atid,attribute,btid,attribute,))
		else: # link compare
			cursor.execute('select count(distinct  t1.depid ) from  (select depid,govid,function from links where treeid=? )  t1, (select depid,govid,function from links where  treeid=? )  t2 where t1.depid=t2.depid and (t1.govid<>t2.govid or t1.function<>t2.function );', (atid,btid,))
			
		return cursor.fetchone()[0]

		counts the number of differnt attributes "attribute" of the tree id atid and the tree btid
		
counts the number of differnt attributes "attribute" of the tree id atid and the tree btid
counts the number of differnt attributes " attribute " of the tree id atid and the tree btid
def nrDifferent(self, atid, btid, attribute, dbcrsr):
		db,cursor=dbcrsr
		if attribute:
			cursor.execute('select count(*) from (select nr,attr,value from features where treeid=? and attr=?)  t1, (select nr,attr,value from features where treeid=? and attr=?)  t2 where t1.nr=t2.nr and t1.value<>t2.value;', (atid,attribute,btid,attribute,))
		else: 
			cursor.execute('select count(distinct  t1.depid ) from  (select depid,govid,function from links where treeid=? )  t1, (select depid,govid,function from links where  treeid=? )  t2 where t1.depid=t2.depid and (t1.govid<>t2.govid or t1.function<>t2.function );', (atid,btid,))
		return cursor.fetchone()[0]
def nrDifferent ( self , atid , btid , attribute , dbcrsr ) : db , cursor = dbcrsr if attribute : cursor . execute ( 'select count(*) from (select nr,attr,value from features where treeid=? and attr=?)  t1, (select nr,attr,value from features where treeid=? and attr=?)  t2 where t1.nr=t2.nr and t1.value<>t2.value;' , ( atid , attribute , btid , attribute , ) ) else : cursor . execute ( 'select count(distinct  t1.depid ) from  (select depid,govid,function from links where treeid=? )  t1, (select depid,govid,function from links where  treeid=? )  t2 where t1.depid=t2.depid and (t1.govid<>t2.govid or t1.function<>t2.function );' , ( atid , btid , ) ) return cursor . fetchone ( ) [ 0 ]
counts the number of differnt attributes "attribute" of the tree id atid and the tree btid
counts the number of differnt attributes " attribute " of the tree id atid and the tree btid
"""
		counts the number of differnt attributes "attribute" of the tree id atid and the tree btid
		""" # link compare
self
atid
btid
attribute
dbcrsr