示例#1
0
def test_merge2(db1='test1', db2='test2'):
    '''
    Load test assertions into the two DBs:
    DB1: No assertions
    DB2: No assertions
    '''
    print "Running test 2: "

    conceptdb.create_mongodb(db1)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()

    conceptdb.create_mongodb(db2)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()

    #testmerge_display(db1, db2)
    '''
    Merge the two dbs
    '''
    merge(db1, db2)
    '''
    Check post-merge elements, make sure they match
    '''

    testmerge_check(db1, db2)

    print "Finished test 2."
示例#2
0
def test_merge1(db1='test1', db2='test2'):
    '''
    Load test assertions into the two DBs:
    DB1: No assertions
    DB2: Assertions 0-9
    '''
    print "Running test 1: "

    conceptdb.create_mongodb(db1)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()

    conceptdb.create_mongodb(db2)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()
    for i in xrange(10):
        a1 = Assertion.make(
            '/data/test', '/rel/IsA',
            ['/test/assertion', 'test/test%d' % i])
        a1.add_support(['/data/test/contributor/nholm'])

    #testmerge_display(db1, db2)
    '''
    Merge the two dbs
    '''
    merge(db1, db2)
    '''
    Check post-merge elements, make sure they match
    '''

    testmerge_check(db1, db2)

    print "Finished test 1. "
示例#3
0
def test_merge2(db1='test1', db2='test2'):
    '''
    Load test assertions into the two DBs:
    DB1: No assertions
    DB2: No assertions
    '''
    print "Running test 2: "
    
    conceptdb.create_mongodb(db1)
    Assertion.drop_collection()
    Dataset.drop_collection()  
    ReasonConjunction.drop_collection()

    
    conceptdb.create_mongodb(db2)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()

    
    #testmerge_display(db1, db2)
    
    '''
    Merge the two dbs
    '''
    merge(db1, db2)
    
    '''
    Check post-merge elements, make sure they match
    '''
    
    testmerge_check(db1, db2)
    
    print "Finished test 2."
示例#4
0
def testmerge_make(db1='test1', db2='test2'):
    '''
    Load test assertions into the two DBs:
    DB1: Assertions 0-9
    DB2: Assertions 0-4
    '''
    conceptdb.create_mongodb(db1)
    Assertion.drop_collection()
    Dataset.drop_collection()  
    ReasonConjunction.drop_collection()
    for i in xrange(10):
        a = Assertion.make('/data/test','/rel/IsA',['/test/assertion','test/test%d'%i])
        a.add_support(['/data/test/contributor/nholm'])    
        a0 = Assertion.make('/data/test1','/rel/IsA',['/test/assertion','test/test%d'%i]) 
        a0.add_support(['/data/test1/contributor/nholm'])    

    
    conceptdb.create_mongodb(db2)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()
    for i in xrange(5):
        a1 = Assertion.make('/data/test','/rel/IsA',['/test/assertion','test/test%d'%i])  
        a1.add_support(['/data/test/contributor/nholm'])
        a2 = Assertion.make('/data/test','/rel/HasA',['/test/assertion','test/test%d'%i])  
        a2.add_support(['/data/test/contributor/nholm'])  
        a3 = Assertion.make('/data/test1','/rel/CausesDesire',['/test/assertion','test/test%d'%i])  
        a3.add_support(['/data/test1/contributor/nholm'])
示例#5
0
def test_merge6(db1='test1', db2='test2'):
    '''
    Load test assertions into the two DBs:
    DB1: Assertions 0-9
    DB2: Assertions 0-4
    '''
    print "Running test 6: "
    
    conceptdb.create_mongodb(db1)
    Assertion.drop_collection()
    Dataset.drop_collection()  
    ReasonConjunction.drop_collection()
    for i in xrange(10):
        a = Assertion.make('/data/test','/rel/IsA',['/test/assertion','test/test%d'%i])
        a.add_support(['/data/test/contributor/nholm'])    
        a0 = Assertion.make('/data/test1','/rel/IsA',['/test/assertion','test/test%d'%i]) 
        a0.add_support(['/data/test1/contributor/nholm'])    

    
    conceptdb.create_mongodb(db2)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()
    for i in xrange(5):
        a1 = Assertion.make('/data/test','/rel/IsA',['/test/assertion','test/test%d'%i])  
        a1.add_support(['/data/test/contributor/nholm'])
        a2 = Assertion.make('/data/test','/rel/HasA',['/test/assertion','test/test%d'%i])  
        a2.add_support(['/data/test/contributor/nholm'])  
        a3 = Assertion.make('/data/test1','/rel/CausesDesire',['/test/assertion','test/test%d'%i])  
        a3.add_support(['/data/test1/contributor/nholm'])
        
        
    #testmerge_display(db1, db2, '/data/test')
    
    '''
    Merge the two dbs
    '''
    merge(db1, db2, '/data/test')
    
    '''
    Check post-merge elements, make sure they match
    '''
    testmerge_check(db1, db2, '/data/test')
    
    print "Finished test 6."
示例#6
0
def test_merge3(db1='test1', db2='test2'):
    '''
    Load test assertions into the two DBs:
    DB1: assertions in one dataset
    DB2: assertions in another dataset
    '''
    print "Running test 3: "
    
    conceptdb.create_mongodb(db1)
    Assertion.drop_collection()
    Dataset.drop_collection()  
    ReasonConjunction.drop_collection()
    for i in xrange(10):
        a = Assertion.make('/data/test1','/rel/IsA',['/test/assertion','test/test%d'%i])
        a.add_support(['/data/test/contributor/nholm'])  

    
    conceptdb.create_mongodb(db2)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()
    for i in xrange(10):
        a1 = Assertion.make('/data/test2','/rel/IsA',['/test/assertion','test/test%d'%i])  
        a1.add_support(['/data/test/contributor/nholm'])
    
    
    #testmerge_display(db1, db2)
    
    '''
    Merge the two dbs
    '''
    merge(db1, db2)
    
    '''
    Check post-merge elements, make sure they match
    '''
    testmerge_check(db1, db2)
    
    print "Finished test 3."
示例#7
0
def testmerge_make(db1='test1', db2='test2'):
    '''
    Load test assertions into the two DBs:
    DB1: Assertions 0-9
    DB2: Assertions 0-4
    '''
    conceptdb.create_mongodb(db1)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()
    for i in xrange(10):
        a = Assertion.make(
            '/data/test', '/rel/IsA',
            ['/test/assertion', 'test/test%d' % i])
        a.add_support(['/data/test/contributor/nholm'])
        a0 = Assertion.make(
            '/data/test1', '/rel/IsA',
            ['/test/assertion', 'test/test%d' % i])
        a0.add_support(['/data/test1/contributor/nholm'])

    conceptdb.create_mongodb(db2)
    Assertion.drop_collection()
    Dataset.drop_collection()
    ReasonConjunction.drop_collection()
    for i in xrange(5):
        a1 = Assertion.make(
            '/data/test', '/rel/IsA',
            ['/test/assertion', 'test/test%d' % i])
        a1.add_support(['/data/test/contributor/nholm'])
        a2 = Assertion.make(
            '/data/test', '/rel/HasA',
            ['/test/assertion', 'test/test%d' % i])
        a2.add_support(['/data/test/contributor/nholm'])
        a3 = Assertion.make(
            '/data/test1', '/rel/CausesDesire',
            ['/test/assertion', 'test/test%d' % i])
        a3.add_support(['/data/test1/contributor/nholm'])