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

issue with ordering of /resource endpoint not returning some predicates #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jyucsiro
Copy link
Contributor

@jyucsiro jyucsiro commented Apr 7, 2020

This reorders the union query to get around the issue of missing predicates for Locality.

@jyucsiro
Copy link
Contributor Author

jyucsiro commented Apr 7, 2020

Screenshot of change applied to the API. Additional properties returned:
image

@jyucsiro
Copy link
Contributor Author

jyucsiro commented Apr 7, 2020

Copy link
Contributor

@benjaminleighton benjaminleighton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I'm wondering why this failed in the first place. I've been reading https://www.w3.org/TR/2013/REC-sparql11-query-20130321/ and my interpretation of that is that a UNION operation should return the same result if the right and left sides are swapped. The only thing I can think of is that this is something to do with using variables ?p ?o in both sides of the union. Possibly this should be rewritten so variables aren't recycled on both sides?

@jyucsiro
Copy link
Contributor Author

jyucsiro commented Apr 7, 2020

Could be the way the query engine is implemented? i didn't think it would make a difference but swapping it around did make a difference!

@benjaminleighton
Copy link
Contributor

I've had a bit more of a look into it and I think swapping it and getting the right answer possibly isn't addressing some underlying bugs. One of which is that they original query which I think is http://3.104.29.122/sparql?name=&infer=true&sameAs=true&query=PREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0ASELECT+DISTINCT+%3Fp+%3Fo+%3Fp1+%3Fo1+%3Fp2+%3Fo2%0AWHERE+%7B%0A++++%7B%0A++++++++++++++++%3Fs+rdf%3Asubject+%3Chttp%3A%2F%2Flinked.data.gov.au%2Fdataset%2Fgnaf-2016-05%2Flocality%2FVIC1736%3E+%3B%0A+++++++++++rdf%3Apredicate+%3Fp%3B%0A+++++++++++rdf%3Aobject+%3Fo+.%0A++++++++OPTIONAL+%7B+FILTER+(isBlank(%3Fo))%0A++++++++++++%7B%0A++++++++++++++++%3Fs2+rdf%3Asubject+%3Fo+%3B%0A++++++++++++++++rdf%3Apredicate+%3Fp1%3B%0A++++++++++++++++rdf%3Aobject+%3Fo1+.%0A++++++++++++%7D%0A++++++++++++UNION%0A++++++++++++%7B+%3Fo+%3Fp1+%3Fo1+.+%7D%0A++++++++++++OPTIONAL+%7B+FILTER+(isBlank(%3Fo1))%0A++++++++++++++++%3Fo1+%3Fp2+%3Fo2+.%0A++++++++++++%7D%0A++++++++%7D%0A++++++++%0A++++++%0A++++%7D%0A++++UNION%0A++++%7B%0A++%0A++++++++%3Chttp%3A%2F%2Flinked.data.gov.au%2Fdataset%2Fgnaf-2016-05%2Flocality%2FVIC1736%3E+%3Fp+%3Fo+.%0A++++++++OPTIONAL+%7B+FILTER+(isBlank(%3Fo))%0A++++++++++++%7B%0A++++++++++++++++%3Fs3+rdf%3Asubject+%3Fo+%3B%0A++++++++++++++++rdf%3Apredicate+%3Fp1%3B%0A++++++++++++++++rdf%3Aobject+%3Fo1+.%0A++++++++++++%7D%0A++++++++++++UNION%0A++++++++++++%7B+%3Fo+%3Fp1+%3Fo1+.+%7D%0A++++++++++++OPTIONAL+%7B+FILTER+(isBlank(%3Fo1))%0A++++++++++++++++%3Fo1+%3Fp2+%3Fo2+.%0A++++++++++++%7D%0A++++++++%7D%0A++++%7D%0A%7D does actually return the resource information, eventually, on page 9 right near the end of ~8000 results. Another confusing thing is why only one result is returned. I think part of the issue is that query_graphdb_endpoint is called without a count argument and it defaults to 1000 so this result will never be seen.

@jyucsiro
Copy link
Contributor Author

jyucsiro commented Apr 7, 2020

ah i see. it's at the end.

@jyucsiro
Copy link
Contributor Author

jyucsiro commented Apr 7, 2020

regardless, it does make sense for this content to be ordered first before the reified triples.

@benjaminleighton
Copy link
Contributor

Perhaps, I'm not sure how safe it is to depend on UNION structure providing a consistent ordering, maybe that is in the spec I haven't checked. Nevertheless there are at least two other bugs in the code, why is only one result returned and paging issues.

@dr-shorthair
Copy link

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

Successfully merging this pull request may close these issues.

3 participants