sparql use subquery as result/variable for outer query -
i want use result of nested query variable/sub graph outer query. use-case have one-to-many relation between product , offers, , want all/selected products offers count, minprice , condition offer record. here query
select ?productid ?pricemin ?total ?condition { { select ?productid (count(?cond) ?total) (min(?pr) ?pricemin ) ?condition where{ ?productid ^mod:isofferof ?oid. ?oid dprop:pricemin ?pr. ?oid dprop:total ?cond. bind (if( ?cond = 1, "new", "used") ?condition). } } values ?productid { prod:rl5rvl5r prod:rl5rvl5q prod:rl5rvl5w prod:rl5rvl5y prod:rl5rvl5u } }
and getting data.
productid |pricemin |condition |total product:rl5rvl5r | 3267 | used | 1 product:rl5rvl5r | 3216 | new | 4 product:rl5rvl5y | 327 | new | 1 product:rl5rvl5q | 323 | new | 1 product:rl5rvl5q | 3268 | used | 1 product:rl5rvl5w | 326 | new | 1 product:rl5rvl5w | 3271 | used | 4 product:rl5rvl5u | 325 | new | 2 product:rl5rvl5u | 3270 | used | 1
now want assign value like
product:rl5rvl5u dprop:newtotal ?total product:rl5rvl5u dprop:newmin ?pricemin product:rl5rvl5u dprop:usedtotal ?total product:rl5rvl5u dprop:usedmin ?pricemin
Comments
Post a Comment