Hi,
I'm trying to aggregate up some particular values within the quad store and
insert these totals as triples.

Using the following statement I get the error - Message: SQ074: Line 18:
SP030: SPARQL compiler, line 4: syntax error at 'sum' before '('

SPARQL
PREFIX INT: <http://localhost:8890/schemas/OE/>
INSERT IN GRAPH <http://demo.clearbluewater.com.au/wsf/datasets/9/>
{   ?order_id INT:order_cost ?order_cost .
    ?order_id INT:order_list_price ?order_list_price .
    ?order_id INT:order_price ?order_price .
}
where {{
SELECT ?order_id, sum(?quantity*?cost_price) as ?order_cost,
sum(?quantity*?list_price) as ?order_list_price, sum(?quantity*?unit_price)
as ?order_price
FROM <http://demo.clearbluewater.com.au/wsf/datasets/9/>
WHERE
{ ?order_uri a INT:ORDERS .
?order_uri INT:order_id ?order_id .
?order_uri INT:order_of_order_items ?order_items_uri .
?order_items_uri INT:quantity ?quantity .
?order_items_uri INT:unit_price ?unit_price .
?order_items_uri INT:order_items_has_product_information ?product_uri .
?product_uri INT:cost_price ?cost_price .
?product_uri INT:list_price ?list_price .
}
group by ?order_id
}};

The statement works when replacing the INSERT statement with another select.
Which seems to indicate the nested select statement syntax is correct. Any
suggestions?

Cheers
Mark

Reply via email to