Module talk:Technique

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Wikidata upload via QuickStatements refinement[edit]

For that it is necessary to filter the items from Module:Technique/WikidataLUT by class in function makeQSstatementCore() (TODO!). A query like

  • SELECT DISTINCT
    ?item ?itemLabel
    ?material ?process ?object
    ?taxon ?taxonLabel
    ?aat
    WHERE {
      VALUES ?item {
        wd:Q239481 wd:Q1121337 wd:Q43533 wd:Q50998618 wd:Q286 wd:Q287 wd:Q14934005 wd:Q1090 wd:Q6642424 wd:Q161
                   wd:Q897 wd:Q207079 wd:Q11607438 wd:Q1514256 wd:Q746026 wd:Q34095 wd:Q1099 wd:Q156 wd:Q774061 wd:Q40089
                   wd:Q194191 wd:Q2916879 wd:Q691189 wd:Q1450533 wd:Q1473346 wd:Q40861 wd:Q337238 wd:Q428352 wd:Q729546 wd:Q183127
                   wd:Q28942722 wd:Q615008 wd:Q291034 wd:Q226697 wd:Q1066536 wd:Q82658 wd:Q125191 wd:Q198779 wd:Q901944 wd:Q219803
                   wd:Q21279007 wd:Q899363 wd:Q133036 wd:Q1169888 wd:Q147690 wd:Q189964 wd:Q43088 wd:Q138979 wd:Q614467 wd:Q213096
    #               wd:Q53754 wd:Q11469 wd:Q865564 wd:Q28942717 wd:Q174219 wd:Q237883 wd:Q165254 wd:Q912435 wd:Q28472 wd:Q1096 wd:Q208021 wd:Q917545 wd:Q3115353 wd:Q203874 wd:Q29000384 wd:Q707896 wd:Q535814 wd:Q1964340 wd:Q572813 wd:Q189085 wd:Q215865 wd:Q209671 wd:Q2167119 wd:Q190727 wd:Q964736 wd:Q1049923 wd:Q1143474 wd:Q22569957 wd:Q860451 wd:Q911380 wd:Q3179385 wd:Q1348059 wd:Q11547758 wd:Q37756 wd:Q146559 wd:Q17443567 wd:Q29838213 wd:Q880 wd:Q551997 wd:Q37681 wd:Q18668582 wd:Q1808397 wd:Q2052367 wd:Q211367 wd:Q40088 wd:Q28823 wd:Q171917 wd:Q663 wd:Q673492 wd:Q156005 wd:Q2288038 wd:Q929186 wd:Q211457 wd:Q1861737 wd:Q646051 wd:Q231250 wd:Q31576 wd:Q325173 wd:Q81683 wd:Q184296 wd:Q243519 wd:Q165447 wd:Q29472910 wd:Q215690 wd:Q942 wd:Q275426 wd:Q39782 wd:Q189720 wd:Q649022 wd:Q146578 wd:Q239788 wd:Q105368 wd:Q175166 wd:Q42302 wd:Q1902763 wd:Q912760 wd:Q909391 wd:Q143447 wd:Q28966302 wd:Q160066 wd:Q830894 wd:Q31029 wd:Q7150699 wd:Q814769 wd:Q216798 wd:Q11427 wd:Q172587 wd:Q2046308 wd:Q252108 wd:Q804070 wd:Q34679 wd:Q11060274 wd:Q731033 wd:Q12981547 wd:Q114675 wd:Q15315 wd:Q1312705 wd:Q12321255 wd:Q13085 wd:Q1053956 wd:Q201175 wd:Q767608 wd:Q66377180 wd:Q25631150 wd:Q14298 wd:Q181908 wd:Q390584 wd:Q677 wd:Q187156 wd:Q1044853 wd:Q392551 wd:Q707896 wd:Q28738320 wd:Q122421 wd:Q145205 wd:Q43010 wd:Q29838581 wd:Q323021 wd:Q378274 wd:Q1251688 wd:Q22657 wd:Q5295538 wd:Q127583 wd:Q1752512 wd:Q1349162 wd:Q127418 wd:Q29838373 wd:Q50769 wd:Q130693 wd:Q5309 wd:Q274988 wd:Q753 wd:Q1503211 wd:Q49465334 wd:Q756712 wd:Q253671 wd:Q166987 wd:Q3387833 wd:Q14674 wd:Q193685 wd:Q1543962 wd:Q2048129 wd:Q3510770 wd:Q1334300 wd:Q43436 wd:Q22731 wd:Q2266509 wd:Q518350 wd:Q17105928 wd:Q899363 wd:Q898735 wd:Q860861 wd:Q324369 wd:Q2141546 wd:Q11474 wd:Q2412125 wd:Q5056949 wd:Q43513 wd:Q1397443 wd:Q1683724 wd:Q1424515 wd:Q175089 wd:Q184453 wd:Q83437 wd:Q1426327 wd:Q2075708 wd:Q912142 wd:Q11032 wd:Q191250 wd:Q3322690 wd:Q14673 wd:Q1971493 wd:Q422173 wd:Q170448 wd:Q5861 wd:Q1377111 wd:Q2118555 wd:Q123314 wd:Q1459304 wd:Q1866550 wd:Q11426 wd:Q429659 wd:Q11224919 wd:Q133833 wd:Q23775 wd:Q161179 wd:Q171446 wd:Q179744 wd:Q580807 wd:Q3374395 wd:Q3342808 wd:Q134985 wd:Q69158 wd:Q60424 wd:Q15123870 wd:Q18704961 wd:Q758 wd:Q1879281 wd:Q708 wd:Q673812 wd:Q998316 wd:Q22915256 wd:Q461714 wd:Q216798 wd:Q7224880 wd:Q5604583 wd:Q1164661 wd:Q213371 wd:Q180884 wd:Q187408 wd:Q104692 wd:Q1572315 wd:Q750197 wd:Q288732 wd:Q622753 wd:Q2269650 wd:Q1513685 wd:Q23757 wd:Q494268 wd:Q11236878 wd:Q11472 wd:Q107211 wd:Q6432723 wd:Q2144394 wd:Q335404 wd:Q82001 wd:Q33526 wd:Q2534695 wd:Q483269 wd:Q1783255 wd:Q25381 wd:Q3291230 wd:Q103223 wd:Q1543091 wd:Q1587663 wd:Q296955 wd:Q2386424 wd:Q79058 wd:Q83087 wd:Q5283 wd:Q402516 wd:Q204330 wd:Q1164918 wd:Q45621 wd:Q3411508 wd:Q43338 wd:Q1001313 wd:Q170593 wd:Q383361 wd:Q18667172 wd:Q124695 wd:Q1900443 wd:Q197204 wd:Q207849 wd:Q725457 wd:Q389782 wd:Q58959 wd:Q273663
      }
      OPTIONAL { ?item wdt:P279* ?sub1. FILTER(!(!(?sub1 = wd:Q214609) && !(?sub1 = wd:Q79529)))}
      BIND(BOUND(?sub1) AS ?material)
      OPTIONAL { ?item wdt:P279* ?sub2. FILTER(?sub2 = wd:Q3249551)}
      BIND(BOUND(?sub2) AS ?process)
      OPTIONAL { ?item wdt:P279* ?sub3. FILTER(?sub3 = wd:Q8205328)}
      BIND(BOUND(?sub3) AS ?object)
      OPTIONAL { ?item wdt:P1582 ?taxon. }
      OPTIONAL { ?item wdt:P1014 ?aatID. 
                BIND(URI(CONCAT('http://vocab.getty.edu/page/aat/', STR(?aatID))) AS ?aat)}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    
    Try it!

can help with putting that information in the LUT, now in adapted form in use in update-module-technique-WikidataLUT.ipynb on PAWS. --Marsupium (talk) 08:14, 13 August 2019 (UTC), 03:32, 14 August 2019 (UTC), 12:47, 7 September 2019 (UTC)[reply]

✓ Done Has been implemented in the workflow. --Marsupium (talk) 16:24, 24 January 2021 (UTC)[reply]

Make use of Wikidata lexicographical data[edit]

To make use of Wikidata lexicographical data an evolved version of this starter query might be useful:

  • SELECT ?sense ?lang ?lemma
    ?gender ?genderLabel
    ?nomSg ?nomSgL
    WHERE 
    {
      ?sense wdt:P5137 wd:Q287 .#wd:Q183670.
      ?lexeme ontolex:sense ?sense.
      ?lexeme dct:language/wdt:P218 ?lang.
      ?lexeme wikibase:lemma ?lemma.
      OPTIONAL {?lexeme wdt:P5185 ?gender.}
      OPTIONAL {?lexeme ontolex:lexicalForm ?nomSg.
                ?nomSg wikibase:grammaticalFeature wd:Q131105, wd:Q110786.
                ?nomSg ontolex:representation ?nomSgL.}
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
    
    Try it!

Enhancements welcome! --Marsupium (talk) 07:38, 23 September 2019 (UTC), 21:06, 27 September 2019 (UTC)[reply]

Is the current approach for Wikidata processing by the module good?[edit]

Jarekt, btw, I'm working on this module since some time as well to make it ready for general use and to make full support of QuickStatements export working. If you like you could take a look at Module:Technique/WikidataLUT and tell me if you think the current approach is a good idea. The LUT contains information on the contained items to let function makeQSstatementCore() decide if a technique on Commons should go to made from material (P186) or fabrication method (P2079) on Wikidata. The table can be updated via SPARQL using https://paws-public.wmflabs.org/paws/user/Marsupium/notebooks/update-module-technique-WikidataLUT.ipynb. If you have ideas for improvement I'll be happy to know. Thanks for any hints, best, --Marsupium (talk) 13:59, 10 September 2019 (UTC)[reply]

I like the idea of splitting stuff into made from material (P186) and fabrication method (P2079). Also {{Technique/WikidataLUT}} was always meant as be replaced by Lua based method. That template is quite conservative and only handles "something on something" type techniques, leaving a lot of others without invisible QS tag and without a chance to upload it to Wikidata. It would be nice to expand it, to handle more cases. Are you working only on {{Technique/WikidataLUT}} or on {{Technique}} in general? --Jarekt (talk) 02:31, 11 September 2019 (UTC)[reply]
Jarekt, thanks for your comments and sorry for my late reply!
Any help is welcome for that work! :-) Tell me if the instruction on that pages are incomprehensible!
Let me know if you have any advice concerning the stuff above, questions or whatever! --Marsupium (talk) 01:24, 14 September 2019 (UTC)[reply]
Marsupium, I did not have time to look through your code, so no advice there at this point. A general point which you probably already figured out is that there might be a lot of challenges in coding which are unique to each language, and which are hard to comprehend unless you speak that language. Moving as much info about each material and technique to wikidata sounds like a great approach. As for Module:Technique/WikidataLUT, I noticed new QS codes for technique in Category:Artworks with Wikidata item: quick statements and some of them do not seem right. The original approach was to only add QS codes if the technique was in the format "something on something" which kind of guaranteed that the somethings were materials. Currently in case of single input to {{Technique}}, many of them things like "lithography", or "panel". Those might lead to problematic transfers. Perhaps activate that option once Module:Technique/WikidataLUT is ready, or monitor QS codes in Category:Artworks with Wikidata item: quick statements and transfer by hand or fix as needed. --Jarekt (talk) 15:29, 16 September 2019 (UTC)[reply]
Jarekt, thank you for your comment and sorry for replying only now! I feel it gets time to announce some of the changes for Template:Technique I've been working on now …
Any newcomers in Category:Artworks with Wikidata item: quick statements shouldn't come from my changes, I haven't switched QID lookup to Module:Technique/WikidataLUT yet, all mappings appearing there still come from Template:Technique/WikidataLUT (but might also be in Module:Technique/WikidataLUT). Which were the items that seemed new to you and especially: which ones didn't seem right?? Then the mappings should definitely get reconsidered before the enabling wider use of Module:Technique/WikidataLUT!
Concerning the export of non-materials: The information if a noun is a material or not is now stored in Module:Technique/WikidataLUT. It is stored as true there if the item for the noun is subclass of (P279)* of material (Q214609) or chemical substance (Q79529) using SPARQL. This is a subset of the values allowed by the value-type constraint (Q21510865) of made from material (P186). And QuickStatements code for transfer to made from material (P186) will only be generated for those items which are stored as materials. So that situation should improve compared to the current export mechanism once activated.
I want to write some more about changes I plan at Template talk:Technique soon. If you have any further thoughts concerning anything mentioned let me know! --Marsupium (talk) 21:20, 4 October 2019 (UTC)[reply]
The newcomers in Category:Artworks with Wikidata item: quick statements were from this edit but that is an ancient history now. The issue was with adding made from material (P186), like "lithography", or "panel", but there were rather few of those and I just added proper made from material (P186) to those items. --Jarekt (talk) 02:27, 5 October 2019 (UTC)[reply]

Open cases concerning terms[edit]

Noted here just to dump them somewhere:

As of … --Marsupium (talk) 17:55, 14 September 2019 (UTC)[reply]

require('strict')[edit]

{{Edit protected}} As per the new lua feature mentioned at m:Tech/News/2022/42, could require('Module:No globals') be replaced with require('strict') -- WOSlinker (talk) 17:17, 25 October 2022 (UTC)[reply]

✓ Done Jonesey95 (talk) 16:10, 26 October 2022 (UTC)[reply]