예제 #1
0
    def getPublicationByConf(self, jconf_id):
        '''Get all publications of a person'''
        while True:
            try:
                conn = DB.pool().getConnection()
                cursor = conn.cursor()
                cursor.execute(
                    '''select p.id, p.year, p.title, p.pubkey, p.jconf, p.authors, p.startpage,\ 
					p.endpage, p.ncitation, p.u_citation_gen 
					from publication p 
					where p.jconf=%s''', jconf_id)
                data = cursor.fetchall()
                pubs = []
                for id, year, title, pubkey, jconf, authors, startpage, endpage, ncitation, gen in data:
                    pub = Publication(id, year, title, pubkey, jconf, authors,
                                      ncitation)
                    pub.startpage = startpage
                    pub.endpage = endpage
                    pubs.append(pub)
                cursor.close()
                conn.close()
                return pubs
            except MySQLdb.Error, e:
                print "Error %d: %s" % (e.args[0], e.args[1])
#				sys.exit(1)
            return data
예제 #2
0
    def getPublicationByConf(self, jconf_id):
        """Get all publications of a person"""
        while True:
            try:
                conn = DB.pool().getConnection()
                cursor = conn.cursor()
                cursor.execute(
                    """select p.id, p.year, p.title, p.pubkey, p.jconf, p.authors, p.startpage,\ 
					p.endpage, p.ncitation, p.u_citation_gen 
					from publication p 
					where p.jconf=%s""",
                    jconf_id,
                )
                data = cursor.fetchall()
                pubs = []
                for id, year, title, pubkey, jconf, authors, startpage, endpage, ncitation, gen in data:
                    pub = Publication(id, year, title, pubkey, jconf, authors, ncitation)
                    pub.startpage = startpage
                    pub.endpage = endpage
                    pubs.append(pub)
                cursor.close()
                conn.close()
                return pubs
            except MySQLdb.Error, e:
                print "Error %d: %s" % (e.args[0], e.args[1])
            # 				sys.exit(1)
            return data
예제 #3
0
 def walk(self):
     ''' Walkthrough all pubs in db. '''
     try:
         conn = DB.pool().getConnection()
         cursor = conn.cursor()
         if (self.replace_sql):
             if (self.replace_sql_params):
                 cursor.execute(self.replace_sql, self.replace_sql_params)
             else:
                 cursor.execute(self.replace_sql)
         else:
             # id, year, title, pubkey, jconf, authors, startpage, endpage, ncitation
             cursor.execute(
                 "select id, year, title, pubkey, jconf, authors, ncitation from publication where %s",
                 self.sql_condition)
         data = cursor.fetchall()
         print "walk through %s items" % cursor.rowcount
         for id, year, title, pubkey, jconf, authors, ncitation in data:
             pub = Publication(id, year, title, pubkey, jconf, authors,
                               ncitation)
             self.processer(pub)
         cursor.close()
         conn.close()
     except MySQLdb.DoesNotExist, e:
         print "Error %d: %s" % (e.args[0], e.args[1])
         raise
예제 #4
0
    def testpubs(self):
        debug_history = []
        # Bad Reals.
        debug_history.append(
            Publication(
                -1, 2000,
                'OQL[C++]: Extending C++ with an Object Query Capability.',
                "pubkey", -1, "Jose A. Blakeley", -5))

        not_fixed = []
        not_fixed.append(
            Publication(
                -1, 2000,
                'On View Support in Object-Oriented Databases Systems.',
                "pubkey", -1, "Won Kim,William Kelley", -5))
        not_fixed.append(
            Publication(-1, 2000, 'The POSC Solution to Managing EP Data.',
                        "pubkey", -1, "Vincent J. Kowalski", -5))
        not_fixed.append(
            Publication(
                -1, 2000,
                'Query Processing in Object-Oriented Database Systems.',
                "pubkey", -1, "M. Tamer Ozsu,Jose A. Blakeley", -5))

        #		now_test.append(Publication(-1, 2000,
        #			'On sensing capacity of sensor networks for the class of linear observation, fixed SNR models.', "pubkey", -100,
        #			"Shuchin Aeron, Manqi Zhao, Venkatesh Saligrama.", -5))
        #		now_test.append(Publication(-1, 2000,
        #			'Wireless ad-hoc networks: Strategies and Scaling laws for the fixed SNR regime', "pubkey", -100,
        #			"Shuchin Aeron, Manqi Zhao, Venkatesh Saligrama.", -5))

        now_test = []

        now_test.append(
            Publication(
                -1, 2000,
                'The Kuramoto model: A simple paradigm for synchronization phenomena',
                "pubkey", -100, "Alexandre Eudes, Maxime Lhuillier.", -5))

        self.integrate_test_pubs(now_test)
 def test_pin_query(self):
     '''Test pin query'''
     print '-TEST-:', self.test_extractFromPage.__doc__.strip()
     #----------------------------------------------------
     pub_candidates = []
     pub_candidates.append(
         Publication(
             -1, 2000,
             'Language, Cohesion and Form Margaret Masterman (1910-1986) (Edited by Yorick Wilks, University of Sheffield), Cambridge University Press (Studies in natural language processing, edited by Steven Bird and Branimir Boguraev), 2005, x+312 pp; hardbound, ISBN 0-521-45489-1',
             "pubkey", -1, "authors", -5))
     pub_candidates.append(
         Publication(
             -1, 2000,
             'Methodology and technology for virtual component driven hardware/software co-design on the system-level',
             "pubkey", -1, "authors", -5))
     pub_candidates.append(
         Publication(
             -1, 2000,
             'From the Editor: Security Cosmology: Moving from Big Bang to Worlds in Collusion',
             "pubkey", -1, "authors", -5))
     pub_candidates.append(
         Publication(
             -1, 2000,
             'XML for the Exchange of Automation Project Information',
             "pubkey", -1, "authors", -5))
     pub_candidates.append(
         Publication(-1, 2000, 'Editor\'s Notes', "pubkey", -1, "authors",
                     -5))
     pub_candidates.append(
         Publication(
             -1, 2000,
             'Integrating Mathematical and Symbolic Models Through AESOP: An Expert for Stock Options Pricing',
             "pubkey", -1, "authors", -5))
     pub_candidates.append(
         Publication(
             -1, 2000,
             'Von Transaktionen zu Problemlosungszyklen: Erweiterte Verarbeitungsmodelle fur Non-Standard-Datenbanksysteme',
             "pubkey", -1, "authors", -5))
     pub_candidates.append(
         Publication(
             -1, 2000,
             'Schemazusammenfuhrungen mit Vorgaben: Eine Studie uber die STEP-Norm AP214 und Oracle\'s Flexfelder',
             "pubkey", -1, "authors", -5))
     query, pubs = self.extractor.pinMaxQuery(pub_candidates)
     print query
     for pub in pubs:
         print pub
예제 #6
0
    def getPublicationByPerson(self, personId, gen):
        '''Get all publications of a person'''
        while True:
            try:
                conn = DB.pool().getConnection()
                cursor = conn.cursor()
                cursor.execute(
                    '''select p.id, p.year, p.title, p.pubkey, p.jconf, p.authors, p.ncitation, p.u_citation_gen 
				from publication p left join na_author2pub a2p on p.id=a2p.pid 
				where (p.u_citation_gen < %s or p.u_citation_gen is null) and a2p.aid=%s''',
                    (gen, personId))
                data = cursor.fetchall()
                pubs = []
                for id, year, title, pubkey, jconf, authors, ncitation, gen in data:
                    pub = Publication(id, year, title, pubkey, jconf, authors,
                                      ncitation)
                    pubs.append(pub)
                cursor.close()
                conn.close()
                return pubs
            except Exception, e:
                ExceptionHelper.print_exec(e)
    def test_debug_not_found(self):
        '''Debug Errors'''
        print '-TEST-:', self.test_extractFromPage.__doc__.strip()

        pub_candidates = []
        pub_candidates.append(
            Publication(
                -1, 2000,
                'Formalizzazione e Ottimizzazione di Transazioni di modifica in CLP(AD)',
                "pubkey", -1, "authors", -5))
        #----------------------------------------------------
        pub_candidates = []
        pub_candidates.append(
            Publication(
                -1, 2000,
                'On the Use of Spreading Activation Methods in Automatic Information Retrieval',
                "pubkey", -1, "authors", -5))
        pub_candidates.append(
            Publication(-1, 2000, 'Chairman\'s Message', "pubkey", -1,
                        "authors", -5))
        pub_candidates.append(
            Publication(-1, 2000,
                        'Introduction to Modern Information Retrieval',
                        "pubkey", -1, "authors", -5))
        pub_candidates.append(
            Publication(-1, 2000, 'Publications', "pubkey", -1, "authors", -5))
        pub_candidates.append(
            Publication(-1, 2000, 'Die RISC-CISC Debatte', "pubkey", -1,
                        "authors", -5))
        pub_candidates.append(
            Publication(-1, 2000, 'Kryptologie', "pubkey", -1, "authors", -5))
        pub_candidates.append(
            Publication(-1, 2000, 'Approximative Public-Key-Kryptosysteme',
                        "pubkey", -1, "authors", -5))
        pub_candidates.append(
            Publication(-1, 2000, 'Integritat in IT-Systemen', "pubkey", -1,
                        "authors", -5))
        pub_candidates.append(
            Publication(-1, 2000, 'Vollstandige Reduktionssysteme', "pubkey",
                        -1, "authors", -5))
        pub_candidates.append(
            Publication(-1, 2000, 'Approximative Public-Key-Kryptosysteme',
                        "pubkey", -1, "authors", -5))

        matcher = PubMatcher.getInstance()
        extractor = Extractor.getInstance()
        query, used_pubs = Extractor.pinMaxQuery(pub_candidates)
        print '%s pub, query: %s' % (len(used_pubs), query)
        all_models = extractor.getNodesByPubs(used_pubs)
        (pubs_found, pubs_notfound) = PubMatcher.getInstance().matchPub(
            used_pubs, all_models)
        for pub in pubs_found:
            print 'pubs found', pub
        print '-' * 100
        for pub in pubs_notfound:
            print 'not found', pub
        print '- test done -'
예제 #8
0
    def debug_pubs(self):
        '''Debug get by pub'''
        print '-TEST-:', self.debug_pubs.__doc__.strip()
        #----------------------------------------------------
        pub_candidates = []

        # group 1
        #		pub_candidates.append(Publication(-1, 2000, 'Some Reflections on Proof Transformations', "pubkey", -1, "Peter B. Andrews", -5))
        #		pub_candidates.append(Publication(-1, 2000, 'Theorem Proving via General Mappings', "pubkey", -1, "Peter B. Andrews", -5))
        #		pub_candidates.append(Publication(-1, 2000, 'Connections and Higher-Order Logic', "pubkey", -1, "Peter B. Andrews", -5))
        #		pub_candidates.append(Publication(-1, 2000, 'The TPS Theorem Proving System', "pubkey", -1, "Peter B. Andrews,Sunil Issar,Dan Nesmith,Frank Pfenning", -5))

        # group 2
        #		pub_candidates.append(Publication(-1, 2000, 'Linearizable concurrent objects', "pubkey", -1, "MP Herlihy, JM Wing", -5))
        #		pub_candidates.append(Publication(-1, 2000, 'Protein structure prediction using a combination of sequence homology and global energy minimization I. Global energy minimization of surface loops', "pubkey", -1, "MJ Dudek, HA Scheraga", -5))

        # group 3
        #		pub_candidates.append(Publication(-1, 2000, 'Implementation of Prolog databases and database operation builtins in the WAM-Plus model', "pubkey", -1, "Z Chenxi, C Yungui, L Bo", -5))

        # group 4
        pub_candidates.append(
            Publication(
                -1, 2000,
                'Procedural Semantics for Fuzzy Disjunctive Programs on Residuated Lattices',
                "pubkey", -1, "Dusan Guller", -5))

        extractor = Extractor.getInstance()
        query, used_pubs = Extractor.pinMaxQuery(pub_candidates)
        print '%s pub, query: %s' % (len(used_pubs), query)

        #
        # Get WEB PAGE
        #
        use_web = True  # ***************
        if use_web:
            all_models = extractor.getNodesByPubs(used_pubs)
        else:
            f = file('debug_pubs.txt', 'r')
            html = f.read()
            models = self.extractor.extract_from_source(html)
            all_models = self.extractor._Extractor__merge_into_extractedmap(
                None, models)

        print '\n- all_models ----------------------'
        if all_models is not None:
            for key, models in all_models.items():
                print key
                for model in models:
                    print "\t", model
        else:
            print 'all_models is None'
        print '- all_models end ----------------------\n'

        (pubs_found, pubs_notfound) = PubMatcher.getInstance().matchPub(
            used_pubs, all_models)
        for pub in pubs_found:
            print 'pubs found', pub
        print '-' * 100
        for pub in pubs_notfound:
            print 'not found', pub
        print '- test done -'