Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order clause is not produce an ordered output #133

Open
andrewufrank opened this issue Sep 26, 2015 · 8 comments
Open

order clause is not produce an ordered output #133

andrewufrank opened this issue Sep 26, 2015 · 8 comments

Comments

@andrewufrank
Copy link

i use the query
SELECT ?o (count( ?s) as ?count) WHERE { ?s http://auf.us.to/nlp2015/lemmaPoS ?o } group by ?o ORDER by desc (?count) LIMIT 100

EOQ

in 4s-query (same result in 4s-http) and it produces the correct list, but not ordered:
4store>SELECT ?o (count( ?s) as ?count) WHERE { ?s http://auf.us.to/nlp2015/lemmaPoS ?o } group by ?o ORDER by desc (?count) LIMIT 100

EOQ

?o ?count
"worthy:JJ"@us "2"^^http://www.w3.org/2001/XMLSchema#integer
"store-room:NN"@us "1"^^http://www.w3.org/2001/XMLSchema#integer
"thyself:RB"@us "1"^^http://www.w3.org/2001/XMLSchema#integer
"throughout:IN"@us "4"^^http://www.w3.org/2001/XMLSchema#integer
"wound:VB"@us "9"^^http://www.w3.org/2001/XMLSchema#integer
"cheese:NN"@us "17"^^http://www.w3.org/2001/XMLSchema#integer
"thicker:JJ"@us "1"^^http://www.w3.org/2001/XMLSchema#integer
"leisurely:JJ"@us "1"^^http://www.w3.org/2001/XMLSchema#integer
...

what is wrong wtih the query?
(ps. how do i avoid the clutter and have the result as "1" only?)

thank you
andrew

@swh
Copy link
Collaborator

swh commented Sep 28, 2015

Good question... looks like the query engine isn't treating the numbers as real xsd:integers - sort order for unknown datatypes is undefined, and if it thought they were xsd:integers they would be rendered as bare-word integers.

Can you show a sample of the input data?

@andrewufrank
Copy link
Author

here is a small example (not terribly small).
it imports with 4-import ...

thank you for your efforts!
andrew

Prof. Dr. sc.techn. Dr. h.c. Andrew U. Frank
+43 1 58801 12710 direct
Geoinformation, TU Wien +43 1 58801 12700 office
Gusshausstr. 27-29 +43 1 55801 12799 fax
1040 Wien Austria +43 676 419 25 72 mobil

On 09/28/2015 11:53 AM, Steve Harris wrote:

Good question... looks like the query engine isn't treating the numbers
as real xsd:integers - sort order for unknown datatypes is undefined,
and if it thought they were xsd:integers they would be rendered as
bare-word integers.

Can you show a sample of the input data?


Reply to this email directly or view it on GitHub
#133 (comment).

@swh
Copy link
Collaborator

swh commented Sep 28, 2015

Is the example attached to the ticket? I can't see it.

4s-import will import anything that's legal RDF, and you can write things like "VII"^^my:romanNumerals, though it won't sort properly, and you can't do arithmetic with it.

@andrewufrank
Copy link
Author

thank you for your hint. i prepared a reduced file for attachement and found that the error is gone - it sorts and the number are shown as 1, 34 etc.
any hints for what i should search to find the offending data?
the value for count is not from my data but produced internally, why can there be a confusion (even if my data is wrong. it counted the number of triples apparently correct)?
thank you !

@swh
Copy link
Collaborator

swh commented Sep 28, 2015

I don't know I'm afraid... I would guess that the datatype URI is subtly wrong in the source data - but it looked OK to me.

You could do a search that returned the datatype URI of the objects of that predicate?

@swh
Copy link
Collaborator

swh commented Sep 28, 2015

Ah! Sorry, I've just seen that it's the output of the COUNT() aggregate that not being sorted correctly.

This might be a known bug (I remember there was something in this area), but it should be fixable.

@andrewufrank
Copy link
Author

i was however surprised, that the bug disappeared with less data. i will
check the data, but it does not contain any datatype specification other
than @us in the turtle input.
thank you for your attention to this problem!
andrew

Prof. Dr. sc.techn. Dr. h.c. Andrew U. Frank
+43 1 58801 12710 direct
Geoinformation, TU Wien +43 1 58801 12700 office
Gusshausstr. 27-29 +43 1 55801 12799 fax
1040 Wien Austria +43 676 419 25 72 mobil

On 09/28/2015 04:49 PM, Steve Harris wrote:

Ah! Sorry, I've just seen that it's the output of the COUNT() aggregate
that not being sorted correctly.

This might be a known bug (I remember there was something in this area),
but it should be fixable.


Reply to this email directly or view it on GitHub
#133 (comment).

@swh
Copy link
Collaborator

swh commented Sep 29, 2015

Ah, interesting.

So in that case it's definitely a bug in the engine, not the data.

I can't offhand think of any reason why it might behave differently with more/less data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants