Différences entre les versions de « Utilisateur:SMW user/Sandbox2 »

De Semantic MediaWiki - Sandbox
(Page blanchie)
Ligne 1 : Ligne 1 :
{{#if:
 
  
{{#subobject:city1
 
| Has page = Athens
 
| Has text = Unique
 
}}
 
 
{{#subobject:city2
 
| Has page = Bangalore
 
| Has text = Unique
 
}}
 
 
{{#subobject:city3
 
| Has page = Beijing
 
| Has text = Unique
 
}}
 
 
{{#subobject:city4
 
| Has page = Berlin
 
| Has text = Unique
 
}}
 
 
{{#subobject:city5
 
| Has page = Gdańsk
 
| Has text = Unique
 
}}
 
 
{{#subobject:city6
 
| Has page = Katowice
 
| Has text = Unique
 
}}
 
 
{{#subobject:city7
 
| Has page = Kraków
 
| Has text = Unique
 
}}
 
 
{{#subobject:city8
 
| Has page = London
 
| Has text = Unique
 
}}
 
 
{{#subobject:city9
 
| Has page = Lublin
 
| Has text = Unique
 
}}
 
 
{{#subobject:city101
 
| Has page = Athens
 
}}
 
 
{{#subobject:city102
 
| Has page = Bangalore
 
}}
 
 
{{#subobject:city103
 
| Has page = Beijing
 
}}
 
 
{{#subobject:city104
 
| Has page = Berlin
 
}}
 
 
{{#subobject:city105
 
| Has page = Gdańsk
 
}}
 
 
{{#subobject:city106
 
| Has page = Katowice
 
}}
 
 
{{#subobject:city107
 
| Has page = Kraków
 
}}
 
 
{{#subobject:city108
 
| Has page = London
 
}}
 
 
{{#subobject:city109
 
| Has page = Lublin
 
}}
 
 
}}
 
== Reference ==
 
Issue [https://sandbox.semantic-mediawiki.org/wiki/Issue/4988 4988]
 
 
== Description ==
 
Setting subobjects <code>cityN</code> with the property '''Has page''' to various cities and '''Has text''' to ''Unique''. Then, again "duplicating" the subobjects by creating <code>city10N</code> with the property '''Has page''' set to the same cities.
 
 
Afterwards, querying for the subobjects and showing the cities and their area/population/location using property chains.
 
 
In some cases, depending on how the parameters <code>sort</code> and <code>order</code> are used, the query does '''not''' return some property chain values from "duplicate" cities.
 
 
== Property declaration ==
 
<pre>{{#subobject:city1
 
| Has page = Athens
 
| Has text = Unique
 
}}
 
...
 
{{#subobject:city101
 
| Has page = Athens
 
}}
 
...
 
</pre>
 
 
== Query ==
 
=== Query 1 ===
 
<pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}}
 
</pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}}
 
Here no sort is used, i.e. the results are sorted by their subobject name. The problem is that some of the property chain values are '''not''' displayed at all.
 
<pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]] [[Has page::Bangalore]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}}
 
</pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]] [[Has page::Bangalore]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}}
 
Querying for the city directly shows all property chain values.
 
 
==== Debug ====
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|format=debug}}
 
 
=== Query 1b ===
 
<pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]][[Has text::Unique]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}}
 
</pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]][[Has text::Unique]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}}
 
Here querying for the "unique" subobject, i.e. no duplicate properties, everything is displayed properly.
 
 
==== Debug ====
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]][[Has text::Unique]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|format=debug}}
 
 
=== Query 2 ===
 
<pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|sort=Has page}}
 
</pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|sort=Has page}}
 
Here <code>sort=Has page</code> is used, in contradiction to the previous query, all property values are displayed.
 
==== Debug ====
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|sort=Has page|format=debug}}
 
 
=== Query 3 ===
 
<pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|sort=Has page|order=rand}}
 
</pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|sort=Has page|order=rand}}
 
Here <code>sort=Has page</code> and <code>order = rand</code> is used, again, some property values are missing.
 
==== Debug ====
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|sort=Has page|format=debug}}
 
 
=== Query 4 ===
 
<pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|sort=Has page.Located in}}
 
</pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|sort=Has page.Located in}}
 
Offtopic, here trying to use <code>sort=Has page.Located in</code>. While the property chain values are displayed correctly, the sorting doesn't work at all. Something else takes precedence, ruining the intended sort, turning it internally into <code>sort=<!-- subobject name -->,Has page.Located in</code>, <code>sort=Has page,Has page.Located in</code> or <code>sort=Has page</code>. Not sure about this, but something is fishy here. I know that up to SMW 3.1.6 the sort <code>sort = <property1>.<property2>,<property></code> is turned internally into <code>sort = <property>,<property1>.<property2></code>, ordering the property chains by length first; but here that it somehow ignores the second property chain part is very wierd.
 
==== Debug ====
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|sort=Has page.Located in|format=debug}}
 

Version du 19 mai 2021 à 19:06

Les cookies nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de cookies.