Examples/Queries/Bubble chart on aggregate numbers

From semantic-mediawiki.org
Jump to: navigation, search
Examples/QueriesExamples/Queries/Bubble chart on aggregate numbers

This examples demonstrates the difference between values collected in a single row (see the described issue) and having values assigned as individuals (known as separate entities, see the solution). Values representing the same knowledge (meaning containing the same value assignments) are only represented once per subject (see Aggregating numbers and Incorrect Sum if more than one property has same numerical value).

bubble chart, subobject query, number aggregation

Issue

I am trying to use d3chart for displaying data prepared with subobject definitions:

{{#subobject:progress|progress month=2011-11|progress count=372}}
{{#subobject:progress|progress month=2011-12|progress count=809}}
{{#subobject:progress|progress month=2012-01|progress count=616}}
{{#subobject:progress|progress month=2012-02|progress count=588}}
{{#subobject:progress|progress month=2012-03|progress count=579}}
{{#subobject:progress|progress month=2012-04|progress count=841}}

The query is:

{{#ask:
 [[progress month::+]]
 |?progress month
 |?progress count
 |mainlabel=-
}}
Progress monthProgress count
2011-11
2011-12
2012-01
2012-02
2012-03
2012-04
372
809
616
588
579
841

If displaying it with format d3chart

{{#ask:
 [[progress month::+]]
 |?progress month
 |?progress count
 |mainlabel=-
 |format=d3chart
 |charttype=bubble
}}

the result is:

Loading...

But that is not what I had expected. How would i get the true distribution? of data on progress month?




Solution

Subobjects need to be unnamed with -

{{#subobject:-|progress month fix=2011-11|progress count=372}}
{{#subobject:-|progress month fix=2011-12|progress count=809}}
{{#subobject:-|progress month fix=2012-01|progress count=616}}
{{#subobject:-|progress month fix=2012-02|progress count=588}}
{{#subobject:-|progress month fix=2012-03|progress count=579}}
{{#subobject:-|progress month fix=2012-04|progress count=841}}

Tabular query

{{#ask:
 [[progress month fix::+]]
 |?progress month fix
 |?progress count
 |mainlabel=-
}}
Progress month fixProgress count
2012-03579
2012-04841
2011-11372
2011-12809
2012-01616
2012-02588

Chart query

{{#ask:
 [[progress month fix::+]]
 |?progress month fix
 |?progress count
 |mainlabel=-
 |format=d3chart
 |charttype=bubble
}}
Loading...