Sparnatural icon indicating copy to clipboard operation
Sparnatural copied to clipboard

TableX URI resolving for sample aggregation

Open ch-sander opened this issue 9 months ago • 2 comments

Can the table plugin resolve any URI with label if aggregated via SAMPLE ? I understand it's difficult for concatenations but shouldn't be for a single URI (maybe also min, max)

ch-sander avatar Apr 16 '25 20:04 ch-sander

Can the table plugin resolve any URI with label if aggregated via SAMPLE ?

No, because this is on the Sparnatural query generation side. A query with URI and label looks like:

SELECT ?person ?person_label

So if we do a SAMPLE, it is either on ?person (the URi variable) ?person_label (the label variable), or on both. But if we do a SAMPLE on both (example SELECT (SAMPLE (?person) AS ?person_sample) (SAMPLE(?person_label) AS ?person_label_sample) then we would not have any garantee that the value sampled for ?person and the value sampled for ?person_label actually correspond to each other.

To achieve this we would require a subquery (which Sparnatural does not support - yet (?) ) :

SELECT ?person_sample ?person_sample_label
WHERE {
  {
    SELECT (SAMPLE(?person) AS ?person_sample)
    WHERE {
      // ....
    }
  }
  ?person_sample rdfs:label ?person_sample_label
}

tfrancart avatar Apr 17 '25 08:04 tfrancart

Makes sense!

ch-sander avatar Apr 17 '25 13:04 ch-sander