Allow sorting based on triples with integer values

Description

Sorting of search results are currently based on various labels as well as dates. A requirement is that these fields are single-valued. The nature of RDF though is to allow repeated properties and limitations requires knowledge of the schema level which EntryStore is totally oblivious to.

The effect is that the majority of Solr fields are multi-valued and cannot be used for sorting. But even if they were single-valued, the values must have a natural order to be useful for sorting.
E.g. a status flag could be single-valued but the range would probably be literals or URIs that does not necessarily have an order that corresponds to the order needed by a specific use-case.

One exception is direct properties of the resource with integer values:

  1. They can be assumed to be single-valued, the use-cases where you would want to have multiple integers values for an individual property for the same resource are hard to find and can safely be ignored.

  2. There is an inherent ordering that cannot be mistaken, exactly what is meant is determined by the semantics of the predicate, there is no room for interpretation of alternative sorting orders the way it would be for arbitrary literals or URIs.

Hence, a suggestion is to introduce two new solr scheme:
metadata.predicate.integer.<md5>
entry.predicate.integer.<md5>
(Alternatively the entry.predicate information could be fit into the metadata.predicate.)
They will only contain triples that have the resourceURI as subject and a literal with one of the numeric datatypes:

  • xsd:byte

  • xsd:int

  • xsd:integer

  • xsd:long

  • xsd:negativeInteger

  • xsd:nonNegativeInteger

  • xsd:nonPositiveInteger

  • xsdositiveInteger

  • xsd:short

  • xsd:unsignedLong

  • xsd:unsignedInt

  • xsd:unsignedShort

  • xsd:unsignedByte

See http://www.w3schools.com/xml/schema_dtypes_numeric.asp for a brief overview of the numeric datatypes.

Environment

None

Activity

Show:
Hannes Ebner
August 23, 2016, 9:59 AM

Introduced new predicate integer field for sortable indexing of integer values in Solr

Fixed

Assignee

Hannes Ebner

Reporter

Matthias Palmér

Labels

None

Components

Fix versions

Priority

Normal