Action-195: Project expression test case

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 UTC