Chris Pollett> Old Classses >
CS257

( Print View )

Student Corner:
[Final Exam-PDF]

[Submit Sec1]
[Grades Sec1]

[Lecture Notes]
[Discussion Board]

Course Info:
[Texts & Links]
[Description]
[Course Outcomes]
[Outcomes Matrix]
[Course Schedule]
[Grading]
[Requirements/HW/Quizzes]
[Class Protocols]
[Exam Info]
[Regrades]
[University Policies]
[Announcements]

HW Assignments:
[Hw1] [Hw2] [Hw3]
[Hw4] [Hw5] [Quizzes]

Practice Exams:
[Midterm] [Final]

HW#2 --- last modified October 18 2020 17:47:19.

Solution set.

Due date: Oct 5

Files to be submitted:
  Hw2.zip

Purpose: To gain experience with different kinds of NoSQL databases, in particular, key-value stores and graph databases.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

CLO2 -- Be able to deploy and understand the use cases of a graph-based database.

CLO3 -- Be able to code an application that makes use of a database API to a NoSQL store.

Description:

This homework consists of two part, practicing FLWOR XQueries using with BaseX, writing a simple app to handle genealogy relationships using neo4j.

For the XQuery portion of the homework, I would like you to pick five websites of your choice that have RSS feeds. Download these feeds (include these files in your ZIP file) and load them into a BaseX database named RSSFeeds. Next I would like you to make FLWOR queries for the following (put these in a files flwor1.xq to flwor3.xq):

  1. Return the titles of all news items (in any of your five feeds) from a particular day (you choose the day but have it set in a let expression).
  2. Return all the news items containing the term Covid-19 in descending order of date, modifying the RSS format so that it matches Atom format.
  3. Return the most recent date at which some term appears in a news item (specify the term in a let clause).

Include transcripts of you running your three queries on BaseX in the file xqueries.txt that you include in your ZIP file.

For the neo4j portion of the homework I'd like to create a genealogy project in neo4j which is controlled from a java program on the command line. This program should use memcached to cache query responses as indicated in what follows. You should have a readme.txt file that explains how you want me to set up your neo4j database. Any constants which need to be changed in your java program should clearly be indicated. I will compile your program from the command line using a line like:

javac genealogy.java

Do code your java program in a package, so that the above will work. I will then run your program with one of four lines:

java genealogy add_person name birth_year [death-year] 
java genealogy add_child child_name parent_name
java genealogy relationship name1 name2
java genealogy num_living_descendants name

You can assume I have correctly specified the CLASSPATH environment variable for both neo4j and memcache.

add_person should add a person entity with a given name (a name is a string that contains a full name such as Christopher John Pollett) with a given birth year and optional year of death to the neo4j database. Note: When supplying a command line argument that is a string which may contain spaces, you should double quote it. i.e.,

java genealogy add_person "Christopher John Pollett" 1970
add_child should add a relationship to the database that the person entity with name child_name is the child of the person entity with name parent_name. These two operations should output SUCCESS or FAILURE depending on whether the operation was or was not successfully carried out. relationship should output either RELATED or NOT_RELATED depending on whether the person with name name1 is related (as determined by a CYPHER query) to the person with name2. Finally, num_living_descendents should output the integer number of living (those that don't have a dead property) descendants (as determined by a CYPHER query) of the person entity with the given name.

The relationship and num_living_descendants operations should cache their outputs in memcached for 60 seconds. When these commands are run it should first check memcached for an answer.

Do some kind of reasonable error handling if arguments don't exist for any of the above operations.

Point Breakdown
FLWOR XQueries (1pt each) 3pts
Program compiles and generally works after modified according to readme.txt 2pt
Four operations of genealogy work as described (1pt each) 4pts
Memcache works as described 1pt
Total10pts