Utilisateur:SMW user/Sandbox2

De Semantic MediaWiki - Sandbox

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_", "type": "data", "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_", "type": "data", "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_-v2", "valid": true, "explanation": "+ConstantScore(#MatchNoDocsQuery("No field "empty.lookup_query" exists in mappings.")) #*:*" } ] } ] }

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_", "type": "data", "body": { "_source": [ "P:33234.wpgID" ], "query": { "constant_score": { "filter": { "bool": { "must": { "terms": { "_id": [ 256819 ] } } } } } } }, "size": 10000 }, "search_info": { "took": 0, "timed_out": false, "max_score": 1, "total": 0 }, "isFromCache": false }, { "index": "smw-data-db9910120150926-02100_", "type": "data", "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_-v2", "valid": true, "explanation": "+ConstantScore(#MatchNoDocsQuery("No field "empty.lookup_query" exists in mappings.")) #*:*" } ] } ] }

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_", "type": "data", "body": { "_source": [ "P:33234.wpgID" ], "query": { "constant_score": { "filter": { "bool": { "must": { "terms": { "_id": [ 256819 ] } } } } } } }, "size": 10000 }, "search_info": { "took": 0, "timed_out": false, "max_score": 1, "total": 0 }, "isFromCache": false }, { "index": "smw-data-db9910120150926-02100_", "type": "data", "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_-v2", "valid": true, "explanation": "+ConstantScore(#MatchNoDocsQuery("No field "empty.lookup_query" exists in mappings.")) #*:*" } ] } ] }

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_", "type": "data", "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_", "type": "data", "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_-v2", "valid": true, "explanation": "+ConstantScore(#MatchNoDocsQuery("No field "empty.lookup_query" exists in mappings.")) #*:*" } ] } ] }
Les cookies nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de cookies.