Test cases for disjunction discussion from f2f3 bristol

Test Data
  @prefix ex: <http://example.org/ns#>
  @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
  ex:ABC ex:ABC ex:ABC .
  ex:ABC rdf:type ex:Engineer .

Queries

1.  Disjunction
SELECT *
WHERE
  (?person rdf:type ex:Engineer) OR 
  (?person rdf:type ex:Manager)

=>
  ?person
  <http://example.org/ns#ABC>

2. Using optionals instead
SELECT *
WHERE
  OPTIONAL (?person rdf:type ex:Engineer)
  OPTIONAL (?person rdf:type ex:Manager)

=>
  ?person
  <http://example.org/ns#ABC>

3. Value Disjunction
SELECT *
WHERE
  (?person rdf:type ?person)
AND 
  (?person = ex:Engineer) OR (?person = ex:Manager)

=>
  ?person
  <http://example.org/ns#ABC>

4. Want at least one of them with the constraint

ASK
  OPTIONAL (?person rdf:type ex:Engineer)
  OPTIONAL (?person rdf:type ex:Manager)
  (?person ex:age ?age)
AND
  ?age >20

=>
  YES

5. Re-expression of 4 using value disjunction
ASK
  (?person ex:age ?age)
  (?person rdf:type ?type)
AND
  (?type = ex:Engineer OR ?type = ex:Manager) AND
  ?age > 20

=>
  YES


6. What does this mean?
SELECT ?x
WHERE
  OPTIONAL (?x ?x ?x)

=>
  ?x
  <http://example.org/ns#ABC>
(says AndyS)

Received on Friday, 17 September 2004 09:18:56 UTC