CS 6795 Semantic Web Techniques

Assignment 3


Syllabus
Assigns
Notes
Labs
Project
Resources

1.     This is a DTD for simple (almost natural-language) 'forward' rules and facts:

 

  <!ELEMENT forward    ((rule | fact)*)>

  <!ELEMENT rule          (if, then)>

  <!ELEMENT fact          (#PCDATA)>

  <!ELEMENT if             (#PCDATA)>

  <!ELEMENT then         (#PCDATA)>

 

  a) Are the following XML elements valid with respect to this DTD (write "yes" or "no" behind them)?

 

  <forward> </forward>

 

  <forward> the weather </forward>

 

  <forward> <fact> it snows </fact> </forward>

 

  <forward> <rule> if it rains then the road gets wet </rule> </forward>

 

  <forward>

    <rule>

      <if> it rains </if> <then> the road gets wet </then>

    </rule>

  </forward>

 

  <forward>

    <fact> it rains </fact>

    <rule>

      <if> it rains </if>

      <then> the road gets wet </then>

    </rule>

  </forward>

 

b) Consider these XML elements for 'forward' (p => c) and 'backward' (c <= p) rules:

 

  <forward> <rule> <if> p </if> <then> c </then> </rule> </forward>

  <backward> <rule> <conc> c </conc> <prem> p </prem> </rule> </backward>

 

  Inductively complete this XML DTD (write into the "..." lines) for 'backward' rules and facts:

 

  <!ELEMENT backward    (..........................)>

  <!ELEMENT rule             (..........................)>

  <!ELEMENT ........           (..........................)>

  <!ELEMENT ........           (..........................)>

  <!ELEMENT ........           (..........................)>



2.     Complete the following XSLT template – by just filling in the "..." versions – for the (XML-to-XML) transformation of 'forward' rules and facts into 'backward' rules and facts:

 

    <xsl:template match="forward">

      <......................>

        <xsl:apply-templates/>

      </......................>

    </xsl:template>

 

    <xsl:template match="rule">

      <..............>

        <..............><xsl:value-of select=".............."/></..............>

        .   .   .

      </..............>

    </xsl:template>

 

    <xsl:template match="fact">

      <..............>

        .   .   .

      </..............>

    </xsl:template>

 

  Could this transformation be 'inverted' – mapping 'backward' rules and facts into 'forward' rules and facts – without information loss (write in "yes" or "no" here)?





3.     Again consider the following Datalog program in Prolog syntax:

human(X) :- philosopher(X).

human(X) :- featherless(X), biped(X).

philosopher(X) :- dualist(X).

dualist(john).

biped(mary).


a)
Give its grounding (consistently replacing variables by constants in each rule):

___________________________________

___________________________________

________________________________________________________

________________________________________________________

_____________________________________________

_____________________________________________

__________________

__________________


b)
Construct its Least Herbrand Model by fixpoint iteration (starting with the set of facts, applying the rules bottom-up to add new facts, etc., until the set no longer changes):













4.     Using a knowledge base with the following facts and rules about fictitious people, employ OO jDREW to query their represented social network. 

knows_from_highschool(Mary, John).

knows_from_highschool(John, Peter).

knows_from_university(Peter, Cora).

knows_from_university(Cora, Gisele).

knows(?X, ?Y) :- knows_from_highschool(?X, ?Y).

knows(?X, ?Y) :- knows_from_university(?X, ?Y).

knows_trans(?X, ?Y) :- knows(?X, ?Y).

knows_trans(?X, ?Y) :-  knows(?X, ?Z),
                                           knows_trans(?Z, ?Y).


Give all results of the following (top-down) queries employing OO jDREW TD:

knows(Mary, John)

_______________________________________

 

knows(Mary, ?Whom)

_______________________________________

 

_______________________________________

 

knows(?Who, ?Whom)

 

 

 

 

 

 

 

knows_trans(Mary, John)

 

 

knows_trans(Mary, ?Whom)

 

 

 

 

knows_trans(?Who, ?Whom)

 

 

 

 

 

 

 

 

 

 

 

 

 

Give all results of the (bottom-up) generation employing OO jDREW BU:

 

 

 

 

 

 

 

 

 

 

 

 

 

To which (top-down) query does the (bottom-up) generation correspond?

 

 

Briefly explain this correspondence.

 

 

 

 

 

5.     Construct a small ontology with a class Public Transport that has four indirect subclasses, Bus, Streetcar, Metro, and Train. Consider Bus and Streetcar value restriction properties “borne Street”; Streetcar, Metro, and Train value restriction properties “borne Rail”; a Metro exists restriction property “level Subsurface”; for all four classes, value restriction properties “carry Person”. Introduce two intermediate classes which abstract shared property restriction classes, give them (meaningful) names, and add their subclass relationships. Introduce all property restriction classes at the highest possible levels. Introduce Metro instances m1 and m2, Train instance t, and Person instance p. Represent the facts that m1 and m2 carry p, and t carries p.

Write all property
restriction classes that can be derived for subclasses, here:







a) Draw a diagram for the ontology.
Hint: Plan to best use the space below.
Hint: Alternatively, you can model everything in the Protégé ontology editor and get the diagram from it
s Jambalaya tab (attach a printout).





















b) Formalize the ontology using Description Logic axioms and instances, specifying its TBox and ABox.






















c) Mention any case(s) of multiple inheritance, here:






List the reasoning tasks that can be performed on the ontology and give an example for each, reporting the results.
Hint:
You can use the tableau algorithm to solve the reasoning tasks.
Hint: Alternatively, y
ou can use the Pellet plug-in in Protégé or Pellet directly to perform the reasoning.














 

 


Maintained by Harold Boley