OK, if it works as you have it elsewhere, then this indeed could be an RDFLib 
SPARQL implementation issue.

Please do check the specs and let us know!

------- Original Message -------
On Wednesday, June 22nd, 2022 at 16:20, Richard Dijkstra 
<richarddijkstra1...@gmail.com> wrote:

> Nicholas,
>
> Thank you for the reply. I did state the question here because other sparql 
> engines do give the answer to the first query form.
>
> So I have to check the sparql spec’s.
>
> Regards, Richard
>
>> Op 22 jun. 2022 om 04:44 heeft Nicholas Car <n...@kurrawong.net> het 
>> volgende geschreven:
>
>> 
>> This is a SPARQL problem (well understanding issue) not an RDFLib thing. 
>> I'll give you the answer here but please ask these sort of issues on 
>> stackoverflow (tagged with 'rdflib') not on this development mailing list!
>>
>> You need this query so that the indicator variable can be calculated on the 
>> back of variables with known values:
>>
>> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>>
>> SELECT (?nominator / ?denominator AS ?indicator)
>>
>> WHERE {
>>
>> SELECT (SUM(?value1) AS ?nominator) (COUNT(?s1) AS ?denominator)
>>
>> WHERE {
>>
>> ?s1 <http://purl.org#val1> ?value1 .
>>
>> }
>>
>> }
>>
>> Then you get:
>>
>> (rdflib.term.Literal('233.3333333333333333333333333', 
>> datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#decimal')),)
>>
>> Cheers, Nick
>>
>> --
>> Dr Nicholas Car
>> Data Architect & Semantic Web Specialist
>> Kurrawong AI
>> n...@kurrawong.net
>> 0477 560 177
>> https://kurrawong.net
>>
>> Honorary Lecturer
>> College of Engineering & Computer Science
>> Australian National University
>> https://cecs.anu.edu.au/people/nicholas-car
>> --
>>
>> ------- Original Message -------
>> On Wednesday, June 22nd, 2022 at 03:41, richarddi...@gmail.com 
>> <richarddijkstra1...@gmail.com> wrote:
>>
>>> What is wrong with the following? I would expect 233.33 in the last 
>>> variable.
>>>
>>> Thank you.
>>>
>>> d = Graph().parse(data = """
>>> <http://www.aa.nl/data#l1> <http://purl.org#val1> 
>>> "100"^^<http://www.w3.org/2001/XMLSchema#decimal>.
>>> <http://www.aa.nl/data#l2> <http://purl.org#val1> 
>>> "200"^^<http://www.w3.org/2001/XMLSchema#decimal>.
>>> <http://www.aa.nl/data#l3> <http://purl.org#val1> 
>>> "400"^^<http://www.w3.org/2001/XMLSchema#decimal>.
>>> """)
>>>
>>> q = """
>>> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
>>>
>>> SELECT (SUM(?value1) AS ?nominator) (COUNT(?s1) AS ?denominator) 
>>> (?nominator / ?denominator AS ?indicator)
>>>
>>> WHERE
>>> {
>>> ?s1 <http://purl.org#val1> ?value1 .
>>> }
>>>
>>> """
>>> for r in d.query(q):
>>> print(r)
>>>
>>> (rdflib.term.Literal('700', 
>>> datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#decimal')), 
>>> rdflib.term.Literal('3', 
>>> datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#integer')), 
>>> None)
>>>
>>> --
>>> http://github.com/RDFLib
>>> ---
>>> You received this message because you are subscribed to the Google Groups 
>>> "rdflib-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to rdflib-dev+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> [https://groups.google.com/d/msgid/rdflib-dev/fa626618-35e3-48fa-936b-e8ee2a79997en%40googlegroups.com](https://groups.google.com/d/msgid/rdflib-dev/fa626618-35e3-48fa-936b-e8ee2a79997en%40googlegroups.com?utm_medium=email&utm_source=footer).
>>
>> --
>> http://github.com/RDFLib
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "rdflib-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to rdflib-dev+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> [https://groups.google.com/d/msgid/rdflib-dev/2P37ZhKteKe1ZtqMeEkl9clP7AaPTjvwXpxHr5JlON-yHbpHwoBNo7Sy9FmtL2BWiXbzFQG95foDV9V36MlkQ6asTs0K67dZUJTeUrnwk2w%3D%40kurrawong.net](https://groups.google.com/d/msgid/rdflib-dev/2P37ZhKteKe1ZtqMeEkl9clP7AaPTjvwXpxHr5JlON-yHbpHwoBNo7Sy9FmtL2BWiXbzFQG95foDV9V36MlkQ6asTs0K67dZUJTeUrnwk2w%3D%40kurrawong.net?utm_medium=email&utm_source=footer).
>
> --
> http://github.com/RDFLib
> ---
> You received this message because you are subscribed to the Google Groups 
> "rdflib-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to rdflib-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> [https://groups.google.com/d/msgid/rdflib-dev/54D3A511-2EDB-4B6F-9873-E5E86FFF53C1%40gmail.com](https://groups.google.com/d/msgid/rdflib-dev/54D3A511-2EDB-4B6F-9873-E5E86FFF53C1%40gmail.com?utm_medium=email&utm_source=footer).

-- 
http://github.com/RDFLib
--- 
You received this message because you are subscribed to the Google Groups 
"rdflib-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rdflib-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rdflib-dev/u4SOs9s_YUnJjegXuI482yt5OIxtN70ptsao5jx8xHUuziKqzTYZqGVfspG-MqJRgiT-r2g2JpgyCGXwIRY4_4bDI-t7mSr3iZIyQDneHPY%3D%40kurrawong.net.

Reply via email to