DSCI 558 Homework 6: PSL & OWL solution


Original Work ?


5/5 - (4 votes)

This homework spans two topics we recently covered. The tasks in this homework include
utilizing the Probabilistic Soft Logic (PSL) toolkit to perform entity linking and the Protégé
tool to do reasoning over an OWL ontology.
Task 1: PSL (4 points)
Task 1.1 (1 point)
Clone the psl-examples repository (https://github.com/linqs/psl-examples).
Run the tutorial on citation categories by running the script ./run.sh in the directory
citation-categories/cli. Once the script finishes running, it will print an evaluation score
to the terminal and generate the following files:
• a psl file (citation-categories-learned.psl) with the learned weights over some
predefined rules (which were originally defined in file citation-categories.psl).
• a directory called inferred-predicates which includes the target results file
HASCAT.txt (this file shows the score for each classification test of a document to a
specific category).
Include a screenshot of the script’s output in your report and rename the generated files to:
• Firstname_Lastname_hw06_citation-categories-learned.psl
• Firstname_Lastname_hw06_HASCAT.txt
Include them in your submission.
Task 1.2 (3 points)
In this task, you will use PSL to link papers from two different data sources. The datasets
(data_source1/2.json), data model file (model.data) and an initial version of your PSL model
file (model.psl) are provided in the attached folder psl.
1.2.1. Generate the files title_sim_obs.txt and years_sim_obs.txt, rename them and include
them in submission.
• These files should capture the similarity between the paper titles and paper years,
respectively. You are required to write code that uses the data in data_source1.json
and data_source2.json. These files should have the same format and look exactly like
same_paper_truth.txt, but have the similarity score of the title or the year,
accordingly, in the final column (i.e., the first two columns are identical in these three
txt files, the third column varies). Your code should make use of some of the similarity
measures you have learned in past lectures (Tip: you can use and tweak the code you
wrote in Homework 3 Task 1.1).

1.2.2. Write additional PSL rules in your PSL model file (model.psl) and set their weights
manually. Run the model (script ./run_1_2_2.sh) and include its performance (F1 score) in
your report. Rename the model file to Firstname_Lastname_hw06_model-manual.psl and include
in submission.
1.2.3. Run weight learning (script ./run_1_2_3.sh) and include its performance (F1 score) in
your report. Include the learned model file model-learned.psl in your submission (rename it
to Firstname_Lastname_hw06_model-learned.psl).
Task 2: OWL (6 points)
Task 2.1 (1 point)
Download and install Protégé(https://protege.stanford.edu/).
Run the tutorial on pizza ontology in Protégé:
Save the pizza ontology you created in this task as an OWL file (pizza.owl) and include it in
your submission (rename it to Firstname_Lastname_hw06_pizza.owl).
Task 2.2 (5 points)
Load the people ontology (http://owl.man.ac.uk/2006/07/sssw/people.owl) using the “Open
OWL Ontology from URL” option (or copying the file locally, you may want to take a look at
the file itself).
Task 2.2.1 (1 point)
Answer the following questions in your report. What’s the definition of mad_cow?
Give both the formal definition and an explanation in your own words. What constraints does mad_cow inherit from its superclasses? Do you see any problem
with that definition? Why?
Task 2.2.2 (4 point)
Start a reasoner (the default reasoner, Hermit, in the reasoner tab is fine). Answer the
following questions in your report. What happened to the definition of mad_cow? Compare with result when not using
reasoner. (Hint: check also the classhierarchy (inferred) tab) What happened to the giraffe class? Compare with result when not using reasoner. Which classes do Tom and Minnie belong to? Compare with result when not using
reasoner. (Hint: Minnie has_pet Tom). List all the person instances. Compare with result when not using reasoner. Which
ones were added after you executed the reasoner? Describe why each of the additional
instances were added.

3 Give a complete description of the instance Mick. Which classes do Daily Mirror belong
to? Compare with result when not using reasoner. List all the descendant classes of pet owner. How many “pets” must a person have to be considered an animal-lover? Do all the “pets” of an animal-lover need to be animals? Does an “old lady” need to be
a person?
Submission Instructions
You must submit (via Blackboard) the following files/folders in a single .zip archive named
• Firstname_Lastname_hw06_report.pdf: pdf file with your relevant written answers to
tasks 1 and 2
• Firstname_Lastname_hw06_citation-categories-learned.psl: As described in task 1.1
• Firstname_Lastname_hw06_HASCAT.txt: As described in task 1.1
• Firstname_Lastname_hw06_title_sim_obs.txt: As described in task 1.2.1
• Firstname_Lastname_hw06_years_sim_obs.txt: As described in task 1.2.1
• Firstname_Lastname_hw06_model-manual.psl: As described in task 1.2.2
• Firstname_Lastname_hw06_model-learned.psl: As described in task 1.2.3
• Firstname_Lastname_hw06_pizza.owl: The pizza ontology you created in task 2.1
• source: This folder includes the code you wrote to accomplish the tasks