« Utilisateur:SMW user/Sandbox2 » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 107 : | Ligne 107 : | ||
}} | }} | ||
== Reference == | |||
Possible reference with issue [https://sandbox.semantic-mediawiki.org/wiki/Issue/4965 4988]. | |||
== Description == | |||
Setting subobjects <code>cityN</code> with the property '''Has page'''. | |||
== Property declaration == | |||
<pre>{{#subobject:city1 | |||
| Has page = Athens | |||
}} | |||
... | |||
{{#subobject:city101 | |||
| Has page = Athens | |||
}} | |||
... | |||
</pre> | |||
== Query == | == Query == | ||
=== Query 1 === | |||
<pre> | <pre> | ||
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population}} | {{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}} | ||
</pre> | </pre> | ||
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population| | {{#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> | <pre> | ||
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population| | {{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]] [[Has page::Athens]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}} | ||
</pre> | </pre> | ||
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|sort=Has page}} | {{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]] [[Has page::Athens]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}} | ||
Querying for the city directly it 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 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> | <pre> | ||
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|sort=Has page. | {{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|sort=Has page.Located in}} | ||
</pre> | </pre> | ||
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|sort=Has page.Has population}} | {{#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 à 18:36
Reference
Possible reference with issue 4988.
Description
Setting subobjects cityN
with the property Has page.
Property declaration
{{#subobject:city1 | Has page = Athens }} ... {{#subobject:city101 | Has page = Athens }} ...
Query
Query 1
{{#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.
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]] [[Has page::Athens]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}}
Querying for the city directly it shows all property chain values.
Debug
Debug outputElasticStore{ "smw": { "query": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]]", "sort": { "": "ASC" }, "metrics": { "query size": 2, "query depth": 1 }, "description_log": [ { "SomeProperty": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]]" } ] }, "elastic": [ { "inverse_lookup_query": [ "_SOBJ", "[[:Utilisateur:SMW user/Sandbox2]]" ], "query": { "index": "smw-data-db9910120150926-02100_", "body": { "_source": [ "P:33234.wpgID" ], "query": { "constant_score": { "filter": { "bool": { "must": { "terms": { "_id": [ 256819 ] } } } } } } }, "size": 10000 }, "search_info": { "took": 2, "timed_out": false, "max_score": 1, "total": 0 }, "isFromCache": false }, { "index": "smw-data-db9910120150926-02100_", "body": { "_source": false, "from": 0, "size": 251, "query": { "constant_score": { "filter": { "bool": { "filter": { "exists": { "field": "empty.lookup_query" } } } } } }, "sort": [ { "subject.sortkey.sort": { "order": "asc" }, "subject.title.sort": { "order": "asc" } } ] } }, { "_shards": { "total": 1, "successful": 1, "failed": 0 }, "valid": true, "explanations": [ { "index": "smw-data-db9910120150926-02100_-v1", "valid": true, "explanation": "MatchNoDocsQuery("User requested "match_none" query.")" } ] } ] }
Query 2
{{#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 sort=Has page
is used, in contradiction to the previous query, all property values are displayed.
Debug
Debug outputElasticStore{ "smw": { "query": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]]", "sort": { "Has_page": "ASC" }, "metrics": { "query size": 2, "query depth": 1 }, "description_log": [ { "SomeProperty": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]]" } ] }, "elastic": [ { "inverse_lookup_query": [ "_SOBJ", "[[:Utilisateur:SMW user/Sandbox2]]" ], "query": { "index": "smw-data-db9910120150926-02100_", "body": { "_source": [ "P:33234.wpgID" ], "query": { "constant_score": { "filter": { "bool": { "must": { "terms": { "_id": [ 256819 ] } } } } } } }, "size": 10000 }, "search_info": { "took": 1, "timed_out": false, "max_score": 1, "total": 0 }, "isFromCache": false }, { "index": "smw-data-db9910120150926-02100_", "body": { "_source": false, "from": 0, "size": 251, "query": { "constant_score": { "filter": { "bool": { "filter": { "exists": { "field": "empty.lookup_query" } } } } } }, "sort": [ { "P:32975.wpgField.sort": { "order": "asc" } } ] } }, { "_shards": { "total": 1, "successful": 1, "failed": 0 }, "valid": true, "explanations": [ { "index": "smw-data-db9910120150926-02100_-v1", "valid": true, "explanation": "MatchNoDocsQuery("User requested "match_none" query.")" } ] } ] }
Query 3
{{#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 sort=Has page
and order = rand
is used, again, some property values are missing.
Debug
Debug outputElasticStore{ "smw": { "query": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]]", "sort": { "Has_page": "ASC" }, "metrics": { "query size": 2, "query depth": 1 }, "description_log": [ { "SomeProperty": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]]" } ] }, "elastic": [ { "inverse_lookup_query": [ "_SOBJ", "[[:Utilisateur:SMW user/Sandbox2]]" ], "query": { "index": "smw-data-db9910120150926-02100_", "body": { "_source": [ "P:33234.wpgID" ], "query": { "constant_score": { "filter": { "bool": { "must": { "terms": { "_id": [ 256819 ] } } } } } } }, "size": 10000 }, "search_info": { "took": 1, "timed_out": false, "max_score": 1, "total": 0 }, "isFromCache": false }, { "index": "smw-data-db9910120150926-02100_", "body": { "_source": false, "from": 0, "size": 251, "query": { "constant_score": { "filter": { "bool": { "filter": { "exists": { "field": "empty.lookup_query" } } } } } }, "sort": [ { "P:32975.wpgField.sort": { "order": "asc" } } ] } }, { "_shards": { "total": 1, "successful": 1, "failed": 0 }, "valid": true, "explanations": [ { "index": "smw-data-db9910120150926-02100_-v1", "valid": true, "explanation": "MatchNoDocsQuery("User requested "match_none" query.")" } ] } ] }
Query 4
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|sort=Has page.Located in}}
Offtopic, here trying to use sort=Has page.Located in
. 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 sort=,Has page.Located in
, sort=Has page,Has page.Located in
or sort=Has page
. Not sure about this, but something is fishy here. I know that up to SMW 3.1.6 the sort sort = <property1>.<property2>,<property>
is turned internally into sort = <property>,<property1>.<property2>
, ordering the property chains by length first; but here that it somehow ignores the second property chain part is very wierd.
Debug
Debug outputElasticStore{ "smw": { "query": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]]", "sort": { "Has_page.Located_in": "ASC" }, "metrics": { "query size": 2, "query depth": 1 }, "description_log": [ { "SomeProperty": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]]" } ] }, "elastic": [ { "inverse_lookup_query": [ "_SOBJ", "[[:Utilisateur:SMW user/Sandbox2]]" ], "query": { "index": "smw-data-db9910120150926-02100_", "body": { "_source": [ "P:33234.wpgID" ], "query": { "constant_score": { "filter": { "bool": { "must": { "terms": { "_id": [ 256819 ] } } } } } } }, "size": 10000 }, "search_info": { "took": 2, "timed_out": false, "max_score": 1, "total": 0 }, "isFromCache": false }, { "index": "smw-data-db9910120150926-02100_", "body": { "_source": false, "from": 0, "size": 251, "query": { "constant_score": { "filter": { "bool": { "filter": { "exists": { "field": "empty.lookup_query" } } } } } }, "sort": [ { "P:32975.wpgField.sort": { "order": "asc" }, "P:33211.wpgField.sort": { "order": "asc" } } ] } }, { "_shards": { "total": 1, "successful": 1, "failed": 0 }, "valid": true, "explanations": [ { "index": "smw-data-db9910120150926-02100_-v1", "valid": true, "explanation": "MatchNoDocsQuery("User requested "match_none" query.")" } ] } ] }