384.124 Semantic Web Techniques; 18 Nov 2008 Practice Exam Family Name First Name Student ID Signature 1) Start a diagram on a safari with a class Mammal and two subclasses Camel and Horse. Define properties “nurse Newborn” for Mammal, “carry Person” and “carry Freight” for Camel, “carry Person” for Horse, as well as “inhabit Tent” for both Camel and Horse. Extend the diagram upward with a root class, and complete it with further subclass links. Introduce Camel instances c1 and c2, Horse instance h, Person instance p, and Tent instance t. Represent the facts that h carries p, and that c1, c2, and h inhabit t. Draw a line between the classes and instances. List all properties that can be newly derived. Explain very briefly whether your diagram is independent of any Semantic Web formalism, or is specific to, say, RDF or OWL. Hint: Plan how you will best use the space below. 2) This is simplified RDF metadata about three fictitious people: <rdf:RDF> <rdf:Description about="http://www.home4many/john"> <name>John Smith</name> <spouse rdf:resource="http://www.home4many/mary"/> </rdf:Description> <rdf:Description about="http://www.home4many/mary"> <name>Mary Smith</name> <spouse rdf:resource="http://www.home4many/john"/> </rdf:Description> <rdf:Description about="http://www.home4many/babs"> <name>Barbara Smith</name> <father rdf:resource="http://www.home4many/john"/> <mother rdf:resource="http://www.home4many/mary"/> </rdf:Description> </rdf:RDF> Draw the directed labeled graph (DLG) that constitutes the RDF diagram of this XML element (use space below). Hint: URLs, going into ovals, and texts, going into rectangles, may be arbitrarily shortened, as long as they remain unique (e.g.: '.../john' or just 'john'; 'John S' or just 'JS'). 3) Consider the following RuleML program: <Implies> <head> <Atom> <Rel>own</Rel> <Var>person</Var> <Var>object</Var> </Atom> </head> <body> <And> <Atom> <Rel>buy</Rel> <Var>person</Var> <Var>merchant</Var> <Var>object</Var> </Atom> <Atom> <Rel>keep</Rel> <Var>person</Var> <Var>object</Var> </Atom> </And> </body> </Implies> <Atom> <op><Rel>keep</Rel></op> <Ind>Mary</Ind> <Ind>XMLBible</Ind> </Atom> <Implies> <head> <Atom> <Rel>buy</Rel> <Var>person</Var> <Var>merchant</Var> <Var>object</Var> </Atom> </head> <body> <Atom> <Rel>sell</Rel> <Var>merchant</Var> <Var>person</Var> <Var>object</Var> </Atom> </body> </Implies> <Atom> <op><Rel>sell</Rel></op> <Ind>John</Ind> <Ind>Mary</Ind> <Ind>XMLBible</Ind> </Atom> Write the corresponding Prolog program by just completing the six versions of "___": own(Person,Object) :- _____________________________, ______________________. buy(____________________) :- sell(____________________). ________________________. _____________________________________. What would be implied by the program (write in here, e.g. using Prolog syntax)? Give a sketch of how this solution could be derived. 4) Using Prolog or any other logic notation, give a program that expresses that (1) ancestor(X,Y) can be proved via parent(X,Y) and (2) ancestor(X,Z) can be proved via parent(X,Y) and ancestor(Y,Z). Add facts representing two of the parent relations in your own family or in a fictitious family, mentioning you or a fictitious person, one of their parents, and one of his or her parents. Show a query that asks for all of the known ancestors, and a derivation using at least one occurrence of the rule (2).