ADB Lab Bismita
ADB Lab Bismita
INFORMATION TECHNOLOGY
IOST, TRIBHUVAN UNIVERSITY
Chardobato, Bhaktapur
Affiliated to Tribhuvan University
Lab Report
Advanced Database
SUBMITTED BY SUBMITTED TO
NAME: Bismita Shrestha. Sumit Bidari
SYMBOL NO/ROLL NO: 24369
PROGRAM: CSIT
8th Semester
Table of Contents
Conver'ng EER model to Rela'onal Model ............................................................................. 3
Object Oriented Database Management System ..................................................................... 6
Map Reduce ............................................................................................................................ 8
Ac've Database Concept ...................................................................................................... 11
Deduc've Database Concepts ............................................................................................... 14
LAB 1
Now, write the SQL code to convert EMPLOYEE, DEPARTMENT and PROJECT into
relational model. (Just use CREATE statement)
SOURCE QUERIES FOR EACH TABLE:
1) Employee:
2) Department:
3) Project:
OUTPUT:
LAB 2
SOURCE CODE
from ZODB import DB, FileStorage
import transaction
from persistent import Persistent
def __str__(self):
return f"{self.sid}, {self.name}"
OUTPUT
LAB 3
Map Reduce
QUESTION:
In the MapReduce framework, a job reads the text from a set of text files
distributed across a cluster's nodes via the distributed file system. A "mapper"
process converts the input to a set of <key, value> pairs. A "shuffle/sorter"
process sorts these pairs by their key values. A "reducer" process then combines
these sorted pairs in a way that solves a problem, and typically produces a
different set of <key, value> pairs, which is the output of the job.
Create a class MapReduce and perform all the tasks as described above for the
corpus you will be provided by the instructor.
SOURCE CODE:
class MapReduce:
def __init__(self, input_content):
self.input_content = input_content
def split_and_map(self):
# Split input content into lines and words
lines = self.input_content.split("\n")
word_pairs = []
for line in lines:
words = line.split()
for word in words:
word_pairs.append((word, 1))
return word_pairs
return result
if __name__ == "__main__":
input_content = """Deer Bear River
Car Car River
Deer Car Bear"""
mr = MapReduce(input_content)
word_pairs = mr.split_and_map()
word_counts = mr.shuffle_and_reduce(word_pairs)
# Print the final word counts
for word, count in word_counts.items():
print(f"{word}: {count}")
print("interpreted by Bismita Shrestha 24369")
OUTPUT:
LAB 4
QUESTION:
SOURCE QUERY:
OUTPUT:
Before >gger
QUESTION:
§ Premises
§ Goal
o Is Ram naughty?
SOURCE CODE:
# Facts
oversmart_people = ["hari"]
# Rules
child_of = {"ram": "hari"}
# Query
def is_ram_naughty():
ram = "ram"
return is_naughty(ram)
# Check if Ram is naughty
if is_ram_naughty():
print("Ram is naughty!")
else:
print("Ram is not naughty.")
OUTPUT: