![]() |
Show 150 posts per page |
.dsy:it. (http://www.dsy.it/forum/)
- Ontologie e web semantico (http://www.dsy.it/forum/forumdisplay.php?forumid=285)
-- dubbio sparql: DISTINCT vs REDUCED (http://www.dsy.it/forum/showthread.php?threadid=34944)
dubbio sparql: DISTINCT vs REDUCED
Ciao,
qualcuno potrebbe spiegare la differenza tra le clausole DISTINCT e REDUCED?
Grazie mille
A.
da quello che ho capito io distinct te li elimina di sicuro, cioè ti ritorna un solo elemento, invece reduced te li riduce nel senso che potrebbe fartene vedere 1 o 2 o tre, una roba random insomma.
Esempio tratto dal reference
9.3.1 DISTINCT
The DISTINCT solution modifier eliminates duplicate solutions. Specifically, each solution that binds the same variables to the same RDF terms as another solution is eliminated from the solution set.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?name WHERE { ?x foaf:name ?name }
name
"Alice"
Note that, per the order of solution sequence modifiers, duplicates are eliminated before either limit or offset is applied.
9.3.2 REDUCED
While the DISTINCT modifier ensures that duplicate solutions are eliminated from the solution set, REDUCED simply permits them to be eliminated. The cardinality of any set of variable bindings in an REDUCED solution set is at least one and not more than the cardinality of the solution set with no DISTINCT or REDUCED modifier . For example, using the data above, the query
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT REDUCED ?name WHERE { ?x foaf:name ?name }
may have one, two (shown here) or three solutions:
name
"Alice"
"Alice"
__________________
------------------------------------------------------------------------
O siamo capaci di sconfiggere le idee contrarie con la discussione, o dobbiamo lasciarle esprimere. Non è possibile sconfiggere le idee con la forza, perchè questo blocca il libero sviluppo dell'intelligenza
(Ernesto Che Guevara)
------------------------------------------------------------------------
Grazie mille
A.
| All times are GMT. The time now is 00:09. | Show all 3 posts from this thread on one page |
Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.