Incorrect Sum if more than one property has same numerical value
> Is there any way to avoid needing to manually assign #subobject:n, #subobject:n+1, #subobject:n+2, etc.? It doesn't appear so....
Rather then trying to follow the normal "data hoarding" approach, SMW enforces some conceptional restrictions on how "facts" can and should be modeled (e.g. Help:Classification).
The main object of interest to describe something is the subject (which in most cases is a wikipage) and by assigning a predicate together with a value (e.g. Regimen=1 and Variant=1) one describes this subject though those attributes. If such attributive declaration represents the same "fact" it is handled as the same entity of knowledge (a thing that describes the subject and therefore only appears once).
The same principle about "describing the same thing" is applied to subobjects. If a subobject contains the same declarations then it is being recognized as being the same (technically a hash is produced to compare those entities) unless it describes something different (using an explicit name opposed to the auto-identifier given without an explicit name). Using a different name on a subobject embedded within the same subject creates an independent entity about something that may or may not describe by the same facts.
Doing:
{{#subobject: |Foo=Bar }} {{#subobject: |Foo=Bar }}
represents the same fact while
{{#subobject:Foo |Foo=Bar }} {{#subobject:Bar |Foo=Bar }}
are equal in its declaration to produce the same annotation but are different to the end that it represents Subject X#Foo and the other Subject X#Bar. While it may seem to split hairs nevertheless it creates a clear and explicit distinction between those two subobjects.
The same thing can be achieved by using `@sortkey` (those are not equal hence treated as different entities and therefore can be queried individually):
{{#subobject: |Foo=Bar |@sortkey=Foo }} {{#subobject: |Foo=Bar |@sortkey=Bar }}
PS: Sorry for the lengthy reply and I hope it explains the issue a bit better.
PSS: If you are unsure about how to model your content, it is always recommended to ask on the Semantic MediaWiki mailing lists for suggestions or if you encounter a technical issue to refer to [0].
[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues
Thank you again. I believe I understand the reason for things being structured this way--I just wish there was a slightly easier alternative for my use case.
Regarding:
As a trial, I've put the above data on two separate pages, but I'm confused why the query only returns the sum from a single page (Regimens: 2; Variants: 5) rather than across the entire site (which I thought was the default).
It is now displaying the proper totals Sum Regimen: 4 Sum Variant: 10
So this delayed update was likely due to caching or something else on my side. I had emailed the mailing list--that message is still in the moderation queue.