Feature:SampleAggregate

From SPARQL Working Group
Revision as of 02:33, 9 March 2009 by Imikhail (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Feature: SAMPLE Aggregate

An aggregate that returns any single member of a group except unbound, or unbound if the group is empty or consists of solely unbound values.

Feature description

Sometimes a group of values of a property consists of almost equal values, or the client is unable to use more than one value even if they differ significally. Say, a car rent application that should display models of cars available for rent can illustrate the list with photos, displaying a photo of some car for every model. Or, a query that gather together physical properties of a reagent from multiple data sources may return only one freesing point temperature in hope that values in different sources differ only in least significant digits. Or, a business card app should display name of a person and expects that correct records about people contain no more than one "name", but do not want produce bad results if there are many names.

In all cases, SAMPLE() can be replaced with MAX(), but MAX() will require calculation of all values of the potentionally big group so it can be less efficient.

Example

select ?f, (SAMPLE (?name))
where {
    <winnie-the-pooh> <friend> ?f .
    optional { ?f foaf:name ?name }
  } group by ?f
    

Existing Implementation(s)

Virtuoso will probably be extended with it.

Existing Specification / Documentation

List any existing text that attempts a formal definition of this extension. This could be a draft specification, API or syntax documentation, etc.

Compatibility

A new keyword will make the syntax unambiguous.

Links to postponed Issues

Related Features

List and possibly link to other use cases or extensions that relate to that use case. That will help us grouping them together in the end.

Champions

  • OpenLink

Use cases

A description of one or more use cases, the solution of which requires this feature. Multiple use cases can be added to each feature.

References