CS 6795 Semantic Web Techniques Assignment 2 1) This is RDF metadata about our course, with student numbers and names changed:       University of New Brunswick                   FCS                               Semantic Web Techniques                         Aaron Anders             Brigit Bonmot             Cesar Chalker                                     Harold Boley         Draw, maybe using a tool, the directed labeled graph (DLG) that constitutes the RDF diagram of this XML element (use space below). Hint: URLs, going into ovals or becoming arc labels, and texts, going into rectangles, may be arbitrarily shortened, as long as they remain unique (e.g.: '.../cs/').                                               2) Consider the following Datalog program in Prolog syntax defining a unary predicate or relation artist: artist(X) :- painter(X). artist(X) :- actor(X), improvising(X). painter(X) :- expressionist(X). expressionist(sara). actor(mary).   a) Give, and very briefly explain, the result of the query artist(sara):   _______because____________________________________________________________________   b) Give, and very briefly explain, the result of the query artist(mary):   _______because____________________________________________________________________   c) Give the result(s) of the query artist(Y):               3) Using Prolog or any other logic notation, give clauses that express that (1) path(X,Y) can be proved via connected(X,Y) and (2) path(X,Z) can be proved via (a) connected(X,Y) and (b), recursively, path(Y,Z). Add clauses that express that connected(X,Y) can be proved via directed(X,Y) or undirected(X,Y). Add facts representing directed (arrow pointing from X to Y) or undirected (link between X and Y) arcs in a graph, mentioning at least a node, one of its directed- or undirected-reachable nodes, and one of its further reachable nodes. Show a query that asks for all of the known paths, and a derivation using at least one occurrence of the rule (2). Hint: You can test your program and queries in any Prolog engine (variables are upper-cased) -- e.g. in SWI Prolog or XSB Prolog -- or in the OO jDREW engine, which uses POSL (variables are “?”-prefixed) -- via http://jdrew.org/oojdrew/1.0/oojdrew-1.0.jnlp.                           4) Consider this definition of the predicate adjaceq (i.e., 'adjacent equals’): Prolog syntax: adjaceq([X,X|R]). adjaceq([_|R]) :- adjaceq(R).   POSL syntax: adjaceq([?X,?X|?R]). adjaceq([?|?R]) :- adjaceq(?R).   You can read the two clauses as follows: adjaceq is true of a list whose first two elements are equal. adjaceq is true of a list whose tail (all but the first element) is R if adjaceq is true of R. Hint: As in Part 3), you can test your answers to the below queries in any Prolog engine (named variables are upper-cased) or in the OO jDREW POSL engine (named variables are “?”-prefixed); an anonymous variable is written as a stand-alone “_” (Prolog) or “?” (POSL).   Show the results of checking adjaceq of ground (variable-free) lists thus:   ?- adjaceq([a,b,a,b]).   _____________     ?- adjaceq([b,a,a,b]).   _____________     Show the results of enumerating adjaceqs of a non-ground list thus (where each “;” asks for another solution):   Prolog syntax: ?- adjaceq([a,M,b]).   POSL syntax: ?- adjaceq([a,?M,b]).     _____________ ;   _____________ ;   _____________ Briefly explain here the number of solutions found, e.g. by studying the expanded proof tree under “Solution:” in the GUI of OO jDREW.               Briefly explain what happens when checking adjaceq of a ground list with three adjacent equal elements.

Maintained by Harold Boley