CS 6795 Semantic Web Techniques

Lab 2


Syllabus
Assigns
Notes
Labs
Project
Resources

1.     This lab assumes you have installed Java on your computer (see http://www.cs.unb.ca/courses/gen) or are using any FCS lab or (almost) any ITS lab, where Java is probably installed, or perhaps using a different Java environment with which you are already familiar. 

2.     Create a new project directory and populate it with the contents of this zip file: j-DREW.zip.  Note that j-DREW is a prototype in a very early stage of development – no purpose or warranty is stated or implied. Copyright is maintained by UNB.

3.     Compile the file PrologTopLevel.java.  Depending on your system this means invoking something like javac PrologTopLevel.java  which should invoke java’s compiler on all Java files in the directory.

4.     Try running the class PrologTopLevel (something like java PrologTopLevel). Note that one of the lines in the PrologTopLevel.java file is  dt.parseDCFile("examples.dc"); This means that the file examples.dc, which contains the examples discussed in class during the Prolog Tutorial, will be read into the discrimination tree data structure. To find out who is holding a party, your interaction should look something like this, where your input is in red:
Enter a query
hold_party(Who).
$top:-hold_party(helen).
more? (y/n) [y] y
No (more) answers

5.     Answer these questions – you may need to be creative in your use of j-DREW, and may need to recompile various parts.

1.     Prolog assumes the order of clauses is important.  Does j-DREW?

2.     Does j-DREW assume that the order of goals in a clause is important?  How can you tell?

3.    Recompile PrologTopLevel.java with SHOW_TREE set to TRUE.  What effect does that have?  Try out the on_route example with the query on_route(Where).

4.     Change the on_route example so that the second clause reads
on_route(Place):-
    on_route(NewPlace),
    move(Place,Method,NewPlace).

Since “,” means “and” and since A and B is the same as B and A, it should have no effect, right? Check it out with the query
on_route(Where).

5.    Change the dfsolver from a depthFirstSolutionIterator to an iterativeDepthFirstSolutionIterator.  What effect does that have on the modified on_route example using the same query?  Revert the literals in the second clause back to their original order.  What is the order of solutions now?  What criteria does the iterativeDepthFirstSolutionIterator use to order its solutions?

6.     Look into the DCTree.java and find the INTERNAL_TRACE variable, and set it to TRUE.  Recompile and run a small query and also the on_route(Where) query. Can you make sense of some of the voluminous information?  It is probably easier to make sense of the output from the depthFirstIterator than it is from the iterativeDepthFirstIterator.

 

 


Maintained by Bruce Spencer