11

The data-explorer presents the tags as they were applied to questions, not the effective tags, which are most of the time more important.

And there's only one way tag-synonyms are represented, as a huge table of auto-numbered mappings from some old tagname to some new tagname.
Which is a pita to use, as one must map from tag-id to tag-name beforehand, and there's no guarantee mapping any specific number of times (though two happens to suffice on SO just now) results in a final canonical tag.

Thus, I propose that at a minimum, SE add a user-defined function for mapping any tag (as id or name) to its canonical form for further processing.

Or is there anything I missed and it's actually already easily solved?

1
  • 2
    Should be on meta SE rather than meta SO.
    – AStopher
    Commented Jul 14, 2015 at 8:50

1 Answer 1

2

Well, I finally had the time and patience to search an elegant, though somewhat complicated, solution, using a recursive Common Table Expression (CTE).
As an example use, a summary of synonymization:

with synonyms (target, source, level)
as (
  select targettagname, sourcetagname, 1
  from tagsynonyms
  where approvaldate is not null
  and not targettagname in (select sourcetagname from tagsynonyms)
  union all
  select target, sourcetagname, level+1
  from tagsynonyms
  inner join synonyms on source=targettagname
  where approvaldate is not null
)
select coalesce(level, 0) level,
  coalesce(count(*), 0) count,
  coalesce(sum(case when coalesce(count, 0)!=0 then 1 end), 0) nonempty
from tags
full join synonyms on tagname=source
group by level
order by level

As you see, it's workable as long as we don't actually need the CTE for anything else.

And the results show that the situation isn't nearly as dire as it could be, at least on SO:
Only tags which are directly synonymized to the final target retain tagged questions for now.

level   count   nonempty
0       41791   41798       (These are not synonymized to anything)
1       2390    23
2       15      0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .