epimorphics / elda

Epimorphics implementation of the Linked Data API
Other
53 stars 27 forks source link

Pagination does not work when blank nodes are in result set #214

Open simonoakesepimorphics opened 6 years ago

simonoakesepimorphics commented 6 years ago

When the _pageSize query parameter is set on a request, if the range of selected nodes contains a blank node, it will not be returned in the result graph (intended). However, in this case the http://www.w3.org/1999/xhtml/vocab#next property is not set on the page resource, even if there are more results in the data set. As a result, the UI does not render the "next page" link, and consumers of the API are not able to determine whether they can query again for more results.

This seems to be caused by the consume method on APIQuery.ResultResourcesReader, which strips blank nodes from its result set. Subsequently the fetchDescriptionOfAllResources method on APIQuery compares the number of remaining nodes to the original _pageSize that was requested and determines that the result set is complete. The createMetadata method on APIEndpointImpl infers that since the result set is complete, the next property should be omitted.

We can replicate this issue in elda-standalone by adding (for example) a blank node whose type is egc:BoardGame to the example-data.ttl data set, and then querying the again/games endpoint.

Related to https://github.com/epimorphics/elda/issues/63 , perhaps they should be fixed at the same time.