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

De Semantic MediaWiki - Sandbox
Ligne 3 : Ligne 3 :
 
{{#subobject:city1
 
{{#subobject:city1
 
  | Has page = Athens
 
  | Has page = Athens
 +
| Has text = Unique
 
}}
 
}}
  
 
{{#subobject:city2
 
{{#subobject:city2
 
  | Has page = Bangalore
 
  | Has page = Bangalore
 +
| Has text = Unique
 
}}
 
}}
  
 
{{#subobject:city3
 
{{#subobject:city3
 
  | Has page = Beijing
 
  | Has page = Beijing
 +
| Has text = Unique
 
}}
 
}}
  
 
{{#subobject:city4
 
{{#subobject:city4
 
  | Has page = Berlin
 
  | Has page = Berlin
 +
| Has text = Unique
 
}}
 
}}
  
 
{{#subobject:city5
 
{{#subobject:city5
 
  | Has page = Gdańsk
 
  | Has page = Gdańsk
 +
| Has text = Unique
 
}}
 
}}
  
 
{{#subobject:city6
 
{{#subobject:city6
 
  | Has page = Katowice
 
  | Has page = Katowice
 +
| Has text = Unique
 
}}
 
}}
  
 
{{#subobject:city7
 
{{#subobject:city7
 
  | Has page = Kraków
 
  | Has page = Kraków
 +
| Has text = Unique
 
}}
 
}}
  
 
{{#subobject:city8
 
{{#subobject:city8
 
  | Has page = London
 
  | Has page = London
 +
| Has text = Unique
 
}}
 
}}
  
 
{{#subobject:city9
 
{{#subobject:city9
 
  | Has page = Lublin
 
  | Has page = Lublin
 +
| Has text = Unique
 
}}
 
}}
 
{{#subobject:city10
 
| Has page = Sacramento (CA)
 
}}
 
 
{{#subobject:city11
 
| Has page = Shanghai
 
}}
 
 
{{#subobject:city12
 
| Has page = Warszawa
 
}}
 
 
{{#subobject:city13
 
| Has page = Wrocław
 
}}
 
 
  
 
{{#subobject:city101
 
{{#subobject:city101
Ligne 88 : Ligne 80 :
 
{{#subobject:city109
 
{{#subobject:city109
 
  | Has page = Lublin
 
  | Has page = Lublin
}}
 
 
{{#subobject:city110
 
| Has page = Sacramento (CA)
 
}}
 
 
{{#subobject:city111
 
| Has page = Shanghai
 
}}
 
 
{{#subobject:city112
 
| Has page = Warszawa
 
}}
 
 
{{#subobject:city113
 
| Has page = Wrocław
 
 
}}
 
}}
  
Ligne 111 : Ligne 87 :
  
 
== Description ==
 
== Description ==
Setting subobjects <code>cityN</code> with the property '''Has page'''.
+
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.
  
 
== Property declaration ==
 
== Property declaration ==
 
<pre>{{#subobject:city1
 
<pre>{{#subobject:city1
 
  | Has page = Athens
 
  | Has page = Athens
 +
| Has text = Unique
 
}}
 
}}
 
...
 
...
Ligne 135 : Ligne 112 :
 
</pre>
 
</pre>
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]] [[Has page::Athens]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in}}
 
{{#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.
+
Querying for the city directly shows all property chain values.
  
 
==== Debug ====
 
==== Debug ====
 
{{#ask: [[-Has subobject::Utilisateur:SMW user/Sandbox2]]|?Has page|?Has page.Has area|?Has page.Has population|?Has page.Located in|format=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 ===
 
=== Query 2 ===

Version du 19 mai 2021 à 18:45

Reference

Possible reference with issue 4988.

Description

Setting subobjects cityN with the property Has page to various cities and Has text to Unique. Then, again "duplicating" the subobjects by creating city10N with the property Has page set to the same cities. Afterwards, querying for the subobjects and showing the cities and their area/population/location.

Property declaration

{{#subobject:city1
 | Has page = Athens
 | Has text = Unique
}}
...
{{#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 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": 8, "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 1b

{{#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

Debug outputElasticStore
{ "smw": { "query": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]][[Has text::Unique]]", "sort": { "": "ASC" }, "metrics": { "query size": 4, "query depth": 1 }, "description_log": [ { "Conjunction": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]] [[Has text::Unique]]" }, [ { "SomeProperty": "[[-Has subobject::Utilisateur:SMW user/Sandbox2]]" } ], [ { "SomeProperty": "[[Has text::Unique]]" } ] ] }, "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": 2, "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": { "must": [ { "bool": { "filter": { "exists": { "field": "empty.lookup_query" } } } }, { "bool": { "filter": { "term": { "P:32994.txtField.keyword": "Unique" } } } } ] } } } }, "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.")) +(#P:32994.txtField.keyword:Unique)) #*:*" } ] } ] }

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": 2, "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": 2, "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.