Skip to content

Commit

Permalink
added agaiin
Browse files Browse the repository at this point in the history
  • Loading branch information
Jumaruba committed Feb 16, 2021
1 parent 9c8acea commit 9dd5000
Show file tree
Hide file tree
Showing 37 changed files with 2,594 additions and 0 deletions.
Binary file added FEUP-BDAD-Proj/Project.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions FEUP-BDAD-Proj/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Belivr
BDAD project - MIEIC 2nd
200 changes: 200 additions & 0 deletions FEUP-BDAD-Proj/data/books.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
The Lord of the Rings by J. R. R. Tolkien
Pride and Prejudice by Jane Austen
His Dark Materials by Philip Pullman
The Hitchhikers Guide to the Galaxy by Douglas Adams
Harry Potter and the Goblet of Fire by J. K. Rowling
To Kill a Mockingbird by Harper Lee
Winnie-the-Pooh by A. A. Milne
Nineteen Eighty-Four by George Orwell
The Lion, the Witch and the Wardrobe by C. S. Lewis
Jane Eyre by Charlotte Brontë
Catch-22 by Joseph Heller
Wuthering Heights by Emily Brontë
Birdsong by Sebastian Faulks
Rebecca by Daphne du Maurier
The Catcher in the Rye by J. D. Salinger
The Wind in the Willows by Kenneth Grahame
Great Expectations by Charles Dickens
Little Women by Louisa May Alcott
Captain Corellis Mandolin by Louis de Bernières
War and Peace by Leo Tolstoy
Gone with the Wind by Margaret Mitchell
Harry Potter and the Philosophers Stone by J. K. Rowling
Harry Potter and the Chamber of Secrets by J. K. Rowling
Harry Potter and the Prisoner of Azkaban by J. K. Rowling
The Hobbit by J. R. R. Tolkien
Tess of the dUrbervilles by Thomas Hardy
Middlemarch by George Eliot
A Prayer for Owen Meany by John Irving
The Grapes of Wrath by John Steinbeck
Alices Adventures in Wonderland by Lewis Carroll
The Story of Tracy Beaker by Jacqueline Wilson
One Hundred Years of Solitude by Gabriel García Márquez
The Pillars of the Earth by Ken Follett
David Copperfield by Charles Dickens
Charlie and the Chocolate Factory by Roald Dahl
Treasure Island by Robert Louis Stevenson
A Town Like Alice by Nevil Shute
Persuasion by Jane Austen
Dune by Frank Herbert
Emma by Jane Austen
Anne of Green Gables by Lucy Maud Montgomery
Watership Down by Richard Adams
The Great Gatsby by F. Scott Fitzgerald
The Count of Monte Cristo by Alexandre Dumas
Brideshead Revisited by Evelyn Waugh
Animal Farm by George Orwell
A Christmas Carol by Charles Dickens
Far from the Madding Crowd by Thomas Hardy
Goodnight Mister Tom by Michelle Magorian
The Shell Seekers by Rosamunde Pilcher
The Secret Garden by Frances Hodgson Burnett
Of Mice and Men by John Steinbeck
The Stand by Stephen King
Anna Karenina by Leo Tolstoy
A Suitable Boy by Vikram Seth
The BFG by Roald Dahl
Swallows and Amazons by Arthur Ransome
Black Beauty by Anna Sewell
Artemis Fowl by Eoin Colfer
Crime and Punishment by Fyodor Dostoyevsky
Noughts & Crosses by Malorie Blackman
Memoirs of a Geisha by Arthur Golden
A Tale of Two Cities by Charles Dickens
The Thorn Birds by Colleen McCullough
Mort by Terry Pratchett
The Magic Faraway Tree by Enid Blyton
The Magus by John Fowles
Good Omens by Neil Gaiman Pratchett & Terry Pratchett
Guards! Guards! by Terry Pratchett
Lord of the Flies by William Golding
Perfume by Patrick Süskind
The Ragged-Trousered Philanthropists by Robert Tressell
Night Watch by Terry Pratchett
Matilda by Roald Dahl
Bridget Joness Diary by Helen Fielding
The Secret History by Donna Tartt
The Woman in White by Wilkie Collins
Ulysses by James Joyce
Bleak House by Charles Dickens
Double Act by Jacqueline Wilson
The Twits by Roald Dahl
I Capture the Castle by Dodie Smith
Holes by Louis Sachar
Gormenghast by Mervyn Peake
The God of Small Things by Arundhati Roy
Vicky Angel by Jacqueline Wilson
Brave New World by Aldous Huxley
Cold Comfort Farm by Stella Gibbons
Magician by Raymond E. Feist
On the Road by Jack Kerouac
The Godfather by Mario Puzo
The Clan of the Cave Bear by Jean M. Auel
The Colour of Magic by Terry Pratchett
The Alchemist by Paulo Coelho
Katherine by Anya Seton
Kane and Abel by Jeffrey Archer
Love in the Time of Cholera by Gabriel García Márquez
Girls in Love by Jacqueline Wilson
The Princess Diaries by Meg Cabot
Midnights Children by Salman Rushdie
Three Men in a Boat by Jerome K. Jerome
Small Gods by Terry Pratchett
The Beach by Alex Garland
Dracula by Bram Stoker
Point Blanc by Anthony Horowitz
The Pickwick Papers by Charles Dickens
Stormbreaker by Anthony Horowitz
The Wasp Factory by Iain Banks
The Day of the Jackal by Frederick Forsyth
The Illustrated Mum by Jacqueline Wilson
Jude the Obscure by Thomas Hardy
The Secret Diary of Adrian Mole, Aged 13¾ by Sue Townsend
The Cruel Sea by Nicholas Monsarrat
Les Misérables by Victor Hugo
The Mayor of Casterbridge by Thomas Hardy
The Dare Game by Jacqueline Wilson
Bad Girls by Jacqueline Wilson
The Picture of Dorian Gray by Oscar Wilde
Shōgun by James Clavell
The Day of the Triffids by John Wyndham
Lola Rose by Jacqueline Wilson
Vanity Fair by William Makepeace Thackeray
The Forsyte Saga by John Galsworthy
House of Leaves by Mark Z. Danielewski
The Poisonwood Bible by Barbara Kingsolver
Reaper Man by Terry Pratchett
Angus, Thongs and Full-Frontal Snogging by Louise Rennison
The Hound of the Baskervilles by Arthur Conan Doyle
Possession: A Romance by A. S. Byatt
The Master and Margarita by Mikhail Bulgakov
The Handmaids Tale by Margaret Atwood
Danny, the Champion of the World by Roald Dahl
East of Eden by John Steinbeck
Georges Marvellous Medicine by Roald Dahl
Wyrd Sisters by Terry Pratchett
The Color Purple by Alice Walker
Hogfather by Terry Pratchett
The Thirty-Nine Steps by John Buchan
Girls in Tears by Jacqueline Wilson
Sleepovers by Jacqueline Wilson
All Quiet on the Western Front by Erich Maria Remarque
Behind the Scenes at the Museum by Kate Atkinson
High Fidelity by Nick Hornby
It by Stephen King
James and the Giant Peach by Roald Dahl
The Green Mile by Stephen King
Papillon by Henri Charrière
Men at Arms by Terry Pratchett
Master and Commander by Patrick OBrian
Skeleton Key by Anthony Horowitz
Soul Music by Terry Pratchett
Thief of Time by Terry Pratchett
The Fifth Elephant by Terry Pratchett
Atonement by Ian McEwan
Secrets by Jacqueline Wilson
The Silver Sword by Ian Serraillier
One Flew Over the Cuckoos Nest by Ken Kesey
Heart of Darkness by Joseph Conrad
Kim by Rudyard Kipling
Cross Stitch by Diana Gabaldon
River God by Wilbur Smith
Sunset Song by Lewis Grassic Gibbon
The Shipping News by E. Annie Proulx
The World According to Garp by John Irving
Lorna Doone by R. D. Blackmore
Girls Out Late by Jacqueline Wilson
The Far Pavilions by M. M. Kaye
The Witches by Roald Dahl
Charlottes Web by E. B. White
Frankenstein by Mary Shelley
They Used to Play on Grass by Terry Venables & Gordon Williams
The Old Man and the Sea by Ernest Hemingway
The Name of the Rose by Umberto Eco
Sophies World by Jostein Gaarder
Dustbin Baby by Jacqueline Wilson
Fantastic Mr Fox by Roald Dahl
Lolita by Vladimir Nabokov
Jonathan Livingston Seagull by Richard Bach
The Little Prince by Antoine de Saint-Exupéry
The Suitcase Kid by Jacqueline Wilson
Oliver Twist by Charles Dickens
The Power of One by Bryce Courtenay
Silas Marner by George Eliot
American Psycho by Bret Easton Ellis
The Diary of a Nobody by George Grossmith & Weedon Grossmith
Trainspotting by Irvine Welsh
Goosebumps by R. L. Stine
Heidi by Johanna Spyri
Sons and Lovers by D. H. Lawrence
The Unbearable Lightness of Being by Milan Kundera
Man and Boy by Tony Parsons
The Truth by Terry Pratchett
The War of the Worlds by H. G. Wells
The Horse Whisperer by Nicholas Evans
A Fine Balance by Rohinton Mistry
Witches Abroad by Terry Pratchett
The Once and Future King by T. H. White
The Very Hungry Caterpillar by Eric Carle
Flowers in the Attic by V. C. Andrews
For Whom the Bell Tolls by Ernest Hemingway
13 changes: 13 additions & 0 deletions FEUP-BDAD-Proj/data/countries.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PT, Portugal
UK, United Kingdom
DE, Germany
ES, Spain
IT, Italy
CZ, Czech Republic
FR, France
RO, Romania
AT, Austria
PL, Poland
HU, Hungary
SE, Sweden
NL, Netherlands
160 changes: 160 additions & 0 deletions FEUP-BDAD-Proj/data/generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
import random

actualUsername = 0


def shuffle(arg):
return random.sample(arg, len(arg))


def create_user():
global actualUsername
contact = random.randint(900000000, 1000000000)
user = users[actualUsername]
actualUsername += 1


paymentMethods = ["credit card", "PayPal", "Mercado Pago", "Western Union", "Bank transfer", "Other"]

with open("countries.txt") as file:
countries = [x.strip().split(", ") for x in file.readlines()]

with open("publishers.txt") as file:
publishers = [x.strip() for x in file.readlines()]

with open("genres.txt") as file:
genres = [x.strip() for x in file.readlines()]

with open("languages.txt") as file:
languages = [x.strip().split(", ") for x in file.readlines()]

with open("localities.txt") as file:
localities = [x.strip().split(", ") for x in file.readlines()]

with open("names.txt") as file:
names = [x.strip() for x in file.readlines()]

with open("roads.txt") as file:
roads = [x.strip() for x in file.readlines()]

with open("usernames.txt") as file:
users = [x.strip() for x in file.readlines()]

with open("books.txt") as file:
books = [x.strip().split(" by ") for x in file.readlines()]
for i in range(len(books)):
books[i][1] = books[i][1].split(" & ")

with open("povoar.sql", "w+") as output:
for code, name in countries:
output.write("INSERT INTO Country VALUES('{}', '{}');\n".format(code, name))
for publisher in publishers:
output.write("INSERT INTO Publisher(name) VALUES('{}');\n".format(publisher))
for paymentMethod in paymentMethods:
output.write("INSERT INTO PaymentMethod(name) VALUES('{}');\n".format(paymentMethod))
for genre in genres:
output.write("INSERT INTO Genre(name) VALUES('{}');\n".format(genre))
for code, name in languages:
output.write("INSERT INTO Language VALUES('{}', '{}');\n".format(code, name))
localityCodes = []
while len(localityCodes) < len(localities):
code = random.randint(1000, 10000)
if code not in localityCodes:
localityCodes.append(code)

for i in range(len(localities)):
name, country = localities[i]
code = localityCodes[i]
output.write("INSERT INTO Locality VALUES({}, '{}', '{}');\n".format(code, name, country))

users = shuffle(users)
userId = 1
for name in names:
birthday = str(random.randint(1920, 2003)) + "-" + str(random.randint(1, 12)) + "-" + str(random.randint(1, 30))
output.write("INSERT INTO Person(name, birth) VALUES('{}', '{}');\n".format(name, birthday))

locality = random.randint(0, len(localities) - 1)
output.write(
"INSERT INTO User(idPerson, contact, email, account, address, streetCode, localityCode) VALUES({}, {}, '{}', {}, '{}', {}, {});\n".format(
userId, random.randint(900000000, 1000000000), users[userId - 1] + "@gmail.com",
random.randint(1000000000000, 100000000000000),
str(random.randint(1, 1000)) + ", " + roads[
random.randint(0, len(roads) - 1)] + ", " +
localities[locality][0] + " " + localities[locality][1],
random.randint(100, 1000), localityCodes[locality]
))
userId += 1

ISBNs = []
while len(ISBNs) < len(books):
ISBN = random.randint(1000000000000, 10000000000000)
if ISBN not in ISBNs:
ISBNs.append(ISBN)
bookNumber = 0
writers = []
for book, writer in books:
publication = str(random.randint(1720, 2020)) + "-" + str(random.randint(1, 12)) + "-" + str(
random.randint(1, 29))
output.write(
"INSERT INTO Book(ISBN, name, publication, edition, idPublisher) VALUES({}, '{}', '{}', {}, {});\n".format(
ISBNs[bookNumber], book, publication, random.randint(1, 15), random.randint(1, len(publishers))
))
for person in writer:
if person not in writers:
writers.append(person)
birthday = str(random.randint(1700, 2003)) + "-" + str(random.randint(1, 12)) + "-" + str(
random.randint(1, 29))
output.write("INSERT INTO Person(name, birth) VALUES('{}', '{}');\n".format(person, birthday))
output.write("INSERT INTO Writer(idPerson) VALUES({});\n".format(userId))
userId += 1
writerId = writers.index(person) + len(names) + 1
output.write("INSERT INTO BookWriter(idWriter, ISBN) VALUES({}, {});\n".format(writerId, ISBNs[bookNumber]))
i = random.randint(0, 20) // 17 + 1
l = []
for _ in range(i):
aux = random.randint(0, len(languages) - 1)
if aux not in l:
l.append(aux)
output.write("INSERT INTO BookLanguage(ISBN, codeLanguage) VALUES({}, '{}');\n".format(ISBNs[bookNumber], languages[aux][0]))
i = random.randint(0, 5) // 4 + 1
g = []
for _ in range(i):
aux = random.randint(1, len(genres))
if aux not in g:
g.append(aux)
output.write("INSERT INTO BookGenre(ISBN, idGenre) VALUES({}, {});\n".format(ISBNs[bookNumber], aux))
bookNumber += 1

for _ in range(20):
p = random.randint(1, len(person))
b = ISBNs[random.randint(0, len(books) - 1)]
output.write(
"INSERT INTO BookEvaluation(idPerson, ISBN, comment, rate) VALUES({}, {}, '{}', {});\n".format(p, b,
"comment",
random.randint(
1, 5)))

for _ in range(30):
description = "description"
price = random.randint(0, 100000) / 100
idUser = random.randint(1, len(person))
ISBN = ISBNs[random.randint(0, len(books) - 1)]
output.write(
"INSERT INTO Publication(description, price, idUser, ISBN) VALUES('{}', {}, {}, {});\n".format(description,
price,
idUser,
ISBN))

for promotionId in range(1, 7):
start = str(random.randint(2010, 2020)) + "-" + str(random.randint(1, 12)) + "-" + str(
random.randint(1, 30))
end = str(random.randint(2020, 2030)) + "-" + str(random.randint(1, 12)) + "-" + str(
random.randint(1, 30))
percentage = random.randint(1, 10000) / 100
output.write(
"INSERT INTO Promotion(start, end, percentage) VALUES('{}', '{}', {});\n".format(start, end, percentage))
output.write("INSERT INTO PromotionPublication(idPublication, idPromotion) VALUES({}, {});\n".format(
random.randint(1, 30), promotionId))

# SellerEvaluation(comment, rate)
# Selling(idPublication, idUser, idPayment, evaluation)
Loading

0 comments on commit 9dd5000

Please sign in to comment.