A03: CiteMan: A friendly citation manager

This assignment uses Prolog’s parsing capabilities to keep track of citations in various formats: MLA, APA, Chicago, and Harvard format (as seen on Google Scholar). The Prolog code should be able to parse a line of text in any of these styles, and extract the authors, title, year, etc. into Prolog data structures. Using the same parsing code, the program should also be able to take data structures holding authors, title, year, etc. and produce a citation string in any of the four styles. Additional code is provided that can read citations from a text file (one per line, bogus lines are skipped), search this database of citations by author and/or year, and produce a new list of filtered citations rendered in any of the four styles.

Start with the code on londo in the directory /home/jeckroth/csci431/assignments/A03/. You will modify the file citeman.pl. Look for the TODO and large blank space in the code.

Test cases

A series of test cases are given in citeman_tests.pl. Run the test cases with this command:

swipl -q -s citeman_tests.pl -t run_tests

If the tests pass, you should see only some dots (1 dot per test) and no error or warning messages.


Submit your citeman.pl file. Include the files citeman_tests.pl and citations.txt as well, even though you do not need to modify them.

Grading rubric

  • 5 pts: All tests pass with no warnings (no Singleton warnings, etc.).
  • 4 pts: At least 80% of tests pass with no warnings.
  • 3 pts: At least 60% of tests pass with no warnings.
  • 2 pts: At least 40% of tests pass with no warnings, or more tests pass with warnings.
  • 1 pt: No tests pass, but code has no syntax or logic errors (i.e., the code can be loaded and queried).
  • 0 pts: Code has syntax or logic errors, cannot be loaded and/or queried, or missing submission.

CSCI 431 material by Joshua Eckroth is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.