W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2010

Action-195: Project expression test case

From: Olivier Corby <Olivier.Corby@sophia.inria.fr>
Date: Mon, 28 Jun 2010 18:14:04 +0200
Message-ID: <4C28CA4C.1090009@sophia.inria.fr>
To: SPARQL Working Group <public-rdf-dawg@w3.org>


ACTION 195: Project expression test case

data:

a p 1
a q 1
a q 2

query:

select * (?y = ?z) as ?eq where {
  ?x p ?y
  ?x q ?z
}

results:

?x=a; ?y=1; ?z=1; ?eq=true
?x=a; ?y=1; ?z=1; ?eq=false

_______________________________________________

Does an error in project expression withdraw the answer or is the variable just unbound ?


data:

a p 1
a q 2
a q "foobar"

query:

select * (?y + ?z) as ?sum where {
  ?x p ?y
  ?x q ?z
}

results:

?x=a; ?y=1; ?z=2; ?sum=3
?x=a; ?y=1; ?z="foobar"; ?sum=unbound

_________________________________________________

Reuse a variable of a project expression

data:

a p 1
a q 2

query:

select *
  (?y + ?z) as ?sum 
  (2 * ?sum) as ?twice
where {
  ?x p ?y
  ?x q ?z
}

results:

?x=a; ?y=1; ?z=2; ?sum=3; ?twice=6

_________________________________________________


Reuse a variable of a project expression in order by ?


data:

a p 1
a p 2


query:

select *
  (?y + ?y) as ?sum 
where {
  ?x p ?y
}
order by ?sum

results:

?x=a; ?y=1; ?sum=2; 
?x=a; ?y=2; ?sum=4; 


_________________________________________________


data:

a p 1
a p a


query:

select * datatype(?l) as ?dt where {
  ?x p ?l
}

results:

?x=a; ?l=1; ?dt=xsd:integer
?x=a; ?l=a; ?dt=unbound

_________________________________________________


Undefined variable



data:

a p 1


query:

select * datatype(?m) as ?dt where {
  ?x p ?l
}

results:

?x=a; ?l=1; ?dt=unbound

_________________________________________________


Unbound variable


data:

a p 1
a q 2
b p 3


query:

select ?x datatype(?l) as ?dt where {
  ?x p ?y 
  optional {?x q ?l}
}


results:

?x=a; ?dt=xsd:integer
?x=b; ?dt=unbound
Received on Monday, 28 June 2010 16:14:38 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:42 GMT