예제 #1
0
                m20Connector.insert(M20GenomeTag(tag['tagId'], tag['tag']))

            for link in linksDS.readPercentage():
                #print str(link)
                m20Connector.insert(
                    M20Link(link['movieId'], link['imdbId'], link['tmdbId']))

    else:

        print "Load " + str(
            fractionToRead * 100) + "% of each Dataset into the Database"

        ratingsDS = DatasetReader.initWithFraction("datasets/data/ratings.csv",
                                                   fractionToRead, ',')
        print "ratings loaded"
        for rat in ratingsDS.readPercentage():
            #print str(rat)
            m20Connector.insert(
                M20Rating(rat['userId'], rat['movieId'], rat['rating'],
                          rat['timestamp']))

        tagsDS = DatasetReader.initWithFraction("datasets/data/tags.csv",
                                                fractionToRead, ',')
        print "tags loaded"
        for tag in tagsDS.readPercentage():
            #print str(tag)
            m20Connector.insert(
                M20Tag(tag['userId'], tag['movieId'], tag['tag'],
                       tag['timestamp']))

        gscoresDS = DatasetReader.initWithFraction(
예제 #2
0
                m20Connector.insert(M20GenomeTag(tag['tagId'], tag['tag']))

            for link in linksDS.readPercentage():
                #print str(link)
                m20Connector.insert(
                    M20Link(link['movieId'], link['imdbId'], link['tmdbId']))

    else:

        print "Load " + str(
            fractionToRead * 100) + "% of each Dataset into the Database"

        ratingsDS = DatasetReader.initWithFraction(
            dataset_path + "/ratings.csv", fractionToRead, ',')
        print "ratings loaded"
        for rat in ratingsDS.readPercentage():
            #print str(rat)
            m20Connector.insert(
                M20Rating(rat['userId'], rat['movieId'], rat['rating'],
                          rat['timestamp']))

        tagsDS = DatasetReader.initWithFraction(dataset_path + "/tags.csv",
                                                fractionToRead, ',')
        print "tags loaded"
        for tag in tagsDS.readPercentage():
            #print str(tag)
            m20Connector.insert(
                M20Tag(tag['userId'], tag['movieId'], tag['tag'],
                       tag['timestamp']))

        #gscoresDS = DatasetReader.initWithFraction(dataset_path + "/genome-scores.csv", fractionToRead, ',')