Quantcast

SMW Property Ask - Same property multiple times on same page

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

SMW Property Ask - Same property multiple times on same page

Markus Spika
Hi!


As the following snipped shows SMW seems to expect a property is only
present/set once per page:
Is there a way to achive a list of 30-50 properties beeing added?

{|
!name
!value
|-
|frist
|[[NumberProperty::1]]
|-
|second
|[[NumberProperty::2]]
|-
|third
|[[NumberProperty::1]]
|-
|fourth
|[[NumberProperty::2]]
|-
|total
|
  sum={{#ask: [[SemanticWiki]] | ?NumberProperty | format=sum |
default=none }} <- this should be 6 not 3
  count={{#ask: [[SemanticWiki]] | ?NumberProperty | format=count |
default=none }} <- this should be 4 not 1
  {{#ask: [[SemanticWiki]] | ?NumberProperty | format=debug | default=none
}}
|}


MediaWiki 1.27.1
SMW 2.5.0



thanks for reading,
Markus
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMW Property Ask - Same property multiple times on same page

kghbln
Heiya Markus,

you may want to have a look at subojects [0] and this example [1] which
I slightly expanded adding in the NumberAlpha extension [2].

Cheers Karsten

[0] https://www.semantic-mediawiki.org/wiki/Help:Adding_subobjects
[1]
https://www.semantic-mediawiki.org/wiki/Examples/Queries/Aggregating_numbers
[2] https://sandbox.semantic-mediawiki.org/wiki/Aggregating_numbers

Am 29.03.2017 um 20:41 schrieb Markus Spika:

> Hi!
>
>
> As the following snipped shows SMW seems to expect a property is only
> present/set once per page:
> Is there a way to achive a list of 30-50 properties beeing added?
>
> {|
> !name
> !value
> |-
> |frist
> |[[NumberProperty::1]]
> |-
> |second
> |[[NumberProperty::2]]
> |-
> |third
> |[[NumberProperty::1]]
> |-
> |fourth
> |[[NumberProperty::2]]
> |-
> |total
> |
>    sum={{#ask: [[SemanticWiki]] | ?NumberProperty | format=sum |
> default=none }} <- this should be 6 not 3
>    count={{#ask: [[SemanticWiki]] | ?NumberProperty | format=count |
> default=none }} <- this should be 4 not 1
>    {{#ask: [[SemanticWiki]] | ?NumberProperty | format=debug | default=none
> }}
> |}
>
>
> MediaWiki 1.27.1
> SMW 2.5.0
>
>
>
> thanks for reading,
> Markus
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: SMW Property Ask - Same property multiple times on same page

Stephan Gambke-3
Maybe in addition to what Karsten wrote an explanation of what SMW makes of your wikitext.

> |[[NumberProperty::1]]
> |[[NumberProperty::2]]

> |[[NumberProperty::1]]
> |[[NumberProperty::2]]

This is telling SMW the same thing twice. It already knows that the page has NumberProperty::1 and NumberProperty::2, so it will not store the same facts again. If you tell me two times that your name is Markus, I will not assume that it is in effect "Markus Markus", right?

count={{#ask: [[SemanticWiki]] | ?NumberProperty | format=count |
> default=none }}

This is in effect asking to count all pages that have the name "SemanticWiki". Specifying "NumberProperty" as a printout will not change which pages are selected. In fact, as the count format does not display printouts anyway, it is not useful to put it here. To see what you are actually asking for, try changing that call to {{#ask: [[SemanticWiki]] | ?NumberProperty | format=table | default=none }}

Finally a word of caution: SMW does not have a problem with multiple instances of a property on the same page at all, quite to the contrary. It may however have a problem with a page querying itself. A wikipage does not work like a program, its elements are not necessarily processed in the order in which they appear. So it may well be that your query at the bottom is executed before the properties up at the top are stored.

Cheers
Stephan

-------- Original Message --------
Subject: Re: [Semediawiki-user] SMW Property Ask - Same property multiple times on same page
Local Time: March 29, 2017 10:46 PM
UTC Time: March 29, 2017 8:46 PM
From: [hidden email]
To: [hidden email]

Heiya Markus,

you may want to have a look at subojects [0] and this example [1] which
I slightly expanded adding in the NumberAlpha extension [2].

Cheers Karsten

[0] https://www.semantic-mediawiki.org/wiki/Help:Adding_subobjects
[1]
https://www.semantic-mediawiki.org/wiki/Examples/Queries/Aggregating_numbers
[2] https://sandbox.semantic-mediawiki.org/wiki/Aggregating_numbers

Am 29.03.2017 um 20:41 schrieb Markus Spika:

> Hi!
>
>
> As the following snipped shows SMW seems to expect a property is only
> present/set once per page:
> Is there a way to achive a list of 30-50 properties beeing added?
>
> {|
> !name
> !value
> |-
> |frist
> |[[NumberProperty::1]]
> |-
> |second
> |[[NumberProperty::2]]
> |-
> |third
> |[[NumberProperty::1]]
> |-
> |fourth
> |[[NumberProperty::2]]
> |-
> |total
> |
> sum={{#ask: [[SemanticWiki]] | ?NumberProperty | format=sum |
> default=none }} <- this should be 6 not 3
> count={{#ask: [[SemanticWiki]] | ?NumberProperty | format=count |
> default=none }} <- this should be 4 not 1
> {{#ask: [[SemanticWiki]] | ?NumberProperty | format=debug | default=none
> }}
> |}
>
>
> MediaWiki 1.27.1
> SMW 2.5.0
>
>
>
> thanks for reading,
> Markus
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Loading...