Sparql query containment result

2019-07-25 14:59发布

问题:

Not familiar with semantic web, under the following context:

// owl in terms of Java-like syntax
Class Person {}
Class GraduateStudent extends Person {reference takesCourse [*] : GraduateCourse}
Class Student intersect Person {reference takesCourse [*] : Course}
Class UndergradStudent extends Student {}

Class Course{}
Class GraduateCourse extends Course{}
Class CsCourse extends Course{}

My question is why Q1 ⊑ Q2 does not hold? In particular, if I understand correctly, Q1 select undergraduate students take CsCourse and graduate students take GraduateCourse, and Q2 select undergraduate students take any Course and graduate students take any Course:

// Q1:
SELECT ?x ?y WHERE 
{ 
  { ?x a :UndergradStudent .
    ?x :takesCourse ?y . 
    ?y a :CsCourse 
  }
    UNION 
  { ?x a :GraduateStudent .
    ?x :takesCourse ?y 
  }
}

// Q2: 
SELECT ?x ?y WHERE 
{ 
  {
    { 
      ?x a :UndergradStudent . 
      ?x :takesCourse ?y 
    }
     UNION 
    { 
      ?x a :GraduateStudent .
      ?x :takesCourse ?y 
    } 
   }
   ?y a :Course .
}

edit: this example can be found at: http://sparql-qc-bench.inrialpes.fr/UCQrdfs.html, Q43b and Q43c in particular.