PetScan

From Meta, a Wikimedia project coordination wiki
This page is a translated version of the page PetScan and the translation is 70% complete.
Outdated translations are marked like this.
Coolest Tool Award 2022 logo
PetScan

2022 Coolest Tool
Award Winner

in the category
Reusable

PetScan ist ein mächtiges Abfragewerkzeug. Eine Abfrage wird im PetScan-Formular erstellt. Sehen Sie sich auch die Grundgedanken zu diesem Werkzeug an.

Einleitung

PetScan kann Listen von Wikipedia-Seiten (und verwandten Projekten) oder Wikidata-Datenobjekten erzeugen, die bestimmten Kriterien entsprechen, wie beispielsweise: Alle Seiten einer bestimmten Kategorie oder alle Datenobjekte mit einer bestimmten Eigenschaft. PetScan kann auch einige temporäre Listen (hier "Quellen" genannt) auf verschiedene Arten kombinieren, um eine neue zu erzeugen. Quellen sind:

Seiten von Wiki(m/p)edia

Diese werden über die Kategorien-, Seiteneigenschaften- und Vorlagen & Verknüpfungen-Reiter ausgewählt. Sie können Seiten aus Kategoriebäumen, mit bestimmten Vorlagen oder Verknüpfungen von/zu bestimmten Seiten anfragen; Ihre Ergebnisse auf einen bestimmten Namensraum, Bot-/menschliche Bearbeitungen, kürzliche Bearbeitungen/Seitenerstellungen begrenzen, usw. Diese drei Reiter repräsentieren die frühere CatScan2-Funktionalität. Ihr Abfrageergebnis wird nachfolgend als "Kategoriequelle" gespeichert.

Andere Quellen

In diesem Reiter können Sie weitere Quellen hinzufügen, wie Wikidata-SPARQL-(WDQS)-Abfragen oder PagePile-Listen. Sie können auch festlegen, wie die unterschiedlichen Quellen kombiert werden sollen. Standardmäßig wird die Schnittmenge (das sind nur die Seiten, die in allen Quellen auftauchen) im Ergebnis zurückgegeben. Sie können auch angeben, auf welches Wiki Ihre Liste zeigen soll, z.B. wenn Sie Wikipedia- und Wikidata-Ergebnisse kombinieren möchten.

Wikidata

In diesem Reiter können Sie Ihre Ergebnisse weitergehend kommentieren oder "filtern", z.B. nur Wikidata-Datenobjekte zurückgeben lassen, die keine Aussagen enthalten. Die Verwendung eines dieser Filter wird Ihre Liste in Wikidata konvertieren.

Ausgabe

Hier können Sie Einstellungen für Ihre Liste anpassen, z.B. das Format (Web-Seite, Wiki, PagePile, usw.). Sie können Ihre Ergebnisse auch noch weitergehend filtern, z.B. mit regulären Ausdrücken die Seitentitel/Objektbezeichnungen. Sie können auch die Ergebnisliste mit einer sortierten Liste fehlender Themen ("Rote Verweise") ersetzen.

Ihre Abfrage definieren

Die im Abfrageformular ausfüllbaren Felder sind wie folgt:

Feld Bedeutung Voreinstellung Hinweis
Sprache Wählen Sie einen Projekt-Sprachcode aus, z. B. "en" für Englisch oder "de" für Deutsch. Wählen Sie "commons" für Wikimedia Commons aus. "en"
Projekt Das zu durchsuchende Wikimedia-Projekt (wikipedia, wiktionary, wikiversity, usw.) "wikipedia"
Tiefe Suchtiefe im Kategoerienbaum. 0 bedeutet, dass keine Unterkategorien berücksichtigt werden. "0"
Kategorien Liste der Kategorien, eine pro Zeile ohne den "Kategorie:"-Teil Leer Das Anhängen von '|' und einer Zahl setzt die Suchtiefe für diesen Kategoriebaum und überschreibt, was im Feld Tiefe ausgewählt wurde
Auzuschließende Kategorien Liste von Kategorien wie oben. Nur Artikel, die nicht zu diesen Kategorien gehören, werden berücksichtigt. Leer
Kombination Wie zuvor aufgeführte Kategorien zu verwenden sind:
  • Kategorienliste: Listet Unterkategorien
  • Schnittmenge: Alle Seiten, die in allen Kategoriebäumen vorkommen
  • Vereinigung: Alle Seiten, die mindestens in einem Kategoriebaum vorkommen
  • Differenz: Alle Seiten, die nur in einem der Kategoriebäume vorkommen
  • Mindestens (N): Alle Seiten, die in mindestens N Kategoriebäumen vorkommen

Gegenwärtig verfügbare Optionen sind "Schnittmenge" oder "Vereinigung".

"Teilmenge"
Namensräume Die Namensräume, die als potentielle Seiten in Betracht kommen Artikel
Weiterleitungen Beides
Vorlagen Verwende nur Seiten, die
  • Feld 1: alle genannten Vorlagen verwenden
  • Feld 2: eine der genannten Vorlagen verwenden
  • Feld 3: keine der genannten Vorlagen verwenden

Gibt eine Vorlage pro Zeile ohne den "Vorlage:"-Teil ein. Jedes Feld kann durch die Auswahl von "Verwende Diskussionsseite stattdessen" qualifiziert werden

Leer This option seems only compatible with templates defined in "template:" namespace. It cannot be used with templates defined in "User:" namespace. It cannot be used in the "Creator:" or "Institution:" namespaces that are used at Wikimedia Commons
Verknüpft von:
Letzte Bearbeitung Zeigt Seiten, deren letzte Beabeitung von einem Bot oder anonymen Benutzer vorgenommen oder nicht vorgenommen wurde oder markiert ist Beides, beides, beides
Letzte Änderung Datum oder Zeitraum der letzten Änderung der Seite im Format YYYYMMDDHHMMSS (kürzeres erlaubt) "Only pages created during the above time window" allows you to look for first change instead
Größe Dateigröße oder Größenbereich in Bytes Leer Erlaubt die Auswahl von Artikeln, deren Dateien größer als ein Grenzwert und/oder kleiner als ein anderer Grenzwert sind
Verknüpfungen Anzahl oder -bereich der internen Verweise auf der Seite Leer Erlaubt die Auswahl von Artikeln mit vielen oder wenigen Verknüpfungen
Rote Verweise
Top categories Funktion, die bisher nicht verfügbar ist.
Sortieren Funktion, die bisher nicht verfügbar ist und die Sortierregeln für die Ausgabe bestimmt.
Manuelle Liste Erlaubt es, eine Liste von Seitennamen oder Wikidata-Datenobjekten (mit vorangestelltem Namensraum) von einem bestimmten Projekt anzugeben

Der knifflige Teil ist es, die Projekte richtig anzugeben:

  • Englische Wikipedia: "enwiki"
  • Deutsche Wikisource: "dewikisource" oder "dewikisourcewiki"
  • Englische Wikinews: "enwikinews"
  • Wikidata: "wikidatawiki"
Wikidata Hole Wikidata-Daten, falls möglich.
Format Ausgabeformate der Suchergebnisse:
HTML : Web-Seiten
CSV  : Werte ​​in Anführungszeichen, getrennt durch Kommata
TSV : Tabulator-getrennte Werte
WIKI : als Wikitabelle
PHP : als PHP-Datei
XML : als XML-Datei
Los geht's! Klicken Sie hier, um die von Ihnen definierte Abfrage zu starten.

Hintergrundwissen

PetScan-ID (PSID)

As of 2016-04-04, every query that gets run in PetScan is recorded (anonymously!) and assigned a unique, stable, numeric identifier called PSID. You can use the PSID to

  • run this PetScan query as an input in tools that support PSID (such as WD-FIST)
  • fill in a "short URL": https://petscan.wmflabs.org/?psid=PSID will run the query with PSID, with all its settings
  • expand programmatically on a previous query, by "overwriting" parameters: https://petscan.wmflabs.org/?format=wiki&psid=PSID will run the same query as before, but the output format will be wiki (instead of default HTML, or whatever was chosen originally).

Notes:

  • Only the query will be stored, not its results!
  • Large queries (e.g. with many manual items) will not be stored. In that case, no PSID will be shown.
  • Results with an empty checkbox have possible matches within the Wikidata set.
  • the interwiki link petscan: can be used to generate shortcuts for permanent queries, eg. [[petscan:PSID]]
  • queries recorded are not deduplicated, so a new PSID will be generated each time unless an existing PSID is called without modification.

Create Wikidata items for Wikipedia articles that don't have one yet (Creator functionality)

  • Set up a query that returns a list of Wikipedia (or other, non-Wikidata project) pages, or paste a list into "Other sources/Manual list"
  • Under the "Page properties" tab, you should select "Redirects=No" This is done automatically now; you can change it back if you really want redirects in your list!
  • Under the "Wikidata" tab, select "Only pages without item" for the "Wikidata" option
  • Run query
  • Your results will have additional elements next to the "results" header (unless you are not logged into WiDaR, in which case you will see an appropriate link instead)
  • All pages for which there is no exact match in any label or alias on Wikidata are checked by default.
  • You can check/uncheck boxes manually now, if required.
  • You can add default statements into the statements box, which will be added to all your new items. So, if you only create items for people, add P31:Q5. You can add multiple statements this way (one per line). Do note that the case of P/Q needs to be in upper case – otherwise it will fail quietly.
  • You can add default descriptions to new items, such as Dde:"some description" for a German description.
  • Click the green "Start QS" button. This will open a new page.
  • You can click "Run" to run a batch in your browser, or "Run in background" to run them from a Wikimedia server. See Help:QuickStatements for more information.


Hinzufügen/Entfernen von Aussagen zu Wikidata-Datenobjekten

It is possible to add or remove statements for Wikidata items with PetScan. For this it is crucial that you choose "Wikidata" in "Other sources -> Use Wiki". Then you will see the command box next to the number and can continue as described in the previous section.

Referrer

(V2 only) If you open PetScan from another tool to let the user create a query, you can pass the referrer_url and referrer_name (defaults to referrer_url) parameters. referrer_url should have a {PSID} string which will be replaced with the PSID the user sees. Once a query was run, a box at the top of the page will prompt the user to return to the original tool, using the PSID-modified referrer_url.

Beispiele

Artikel in einem Wiki-Projekt

A request on the Talk page of this Manual: Find all mainspace articles within "WikiProject UK geography". Starting with a default PetScan submission form, just add "WikiProject UK geography" to the first box of the Templates row, and, just below, select "Use talk pages instead". Here is the query filled out. Hit "Do it!" at bottom. When run on 16 August 2015, the query required 1.5 seconds to run, and yielded a list of 21,408 articles. The list appears BELOW the submission form (which remains on your screen), so you have to scroll down to see the results.

Dablinks innerhalb eines Wiki-Projekts

Editors working on disambiguation seek to enlist members of a content area WikiProject, specifically WikiProject Canada, to help. A PetScan report is designed to find all articles having ambiguous links that are within the given WikiProject. Criteria applied:

  1. Articles having ambiguous links are within "Category:All articles with links needing disambiguation", so paste "All articles with links needing disambiguation" into the PetScan Categories field.
  2. Depth is set arbitrarily to 9, meaning that articles as far as 9 subcategories down from the "needing disambiguation" parent category will be found. (Searching to that depth is not necessary in this case but doesn't hurt.)
  3. Articles within WikiProject Canada have "Template:WikiProject Canada" on their talk pages, so paste "WikiProject Canada" into PetScan's "Has any of these templates" field, and just below select "Use talk pages instead" as a qualifier.
  4. Only regular articles, not disambiguation pages, are wanted, and disambiguation pages are distinguished by having template:disambiguation, so paste "Disambiguation" into PetScan's "Has none of these templates" field, and make sure "Use talk pages instead" is not selected.
  • These criteria are implemented by this PetScan submission form, filled out. To submit the query, select "Do it!" at the bottom.
  • When submitted on 16 August 2015, the query took 31 seconds to run, and results were a list of 255 articles. The results show BELOW the PetScan submission form, which remains in place, so you may see no change on your screen. You have to know to scroll down to find the results! That request was run with default Output format "HTML".
  • To obtain the results in a Wikitable, in order to share them at a subpage of the WikiProject, the request could be revised to select Format "WIKI". This time the results, in wikitable markup, replace the PetScan submission form on your screen.
  • To make a more useful list for disambiguators, set up so that DabSolver will open up on any item clicked, a several step process can be followed. Here the results were saved to Tab-Separated format instead, then brought into Excel, then a column was composed which concatenated simple text strings with the results, then that resulting column was copy-pasted. The results were pasted over to the English language Wikipedia page w:Wikipedia:Canadian Wikipedians' notice board/ArticlesNeedingDisambiguation2015-08-17 and were posted also within a scrolling window in discussion at the WikiProject Canada talk page. --Doncram (talk) 19:50, 24 August 2015 (UTC) link adjusted. DexDor (talk) 06:58, 29 March 2016 (UTC)[reply]

Seiten erkennen, die eine ungewöhnliche Kombination von Namensraum und Kategorie/n ausweisen

PetScan can be used to find pages that are in a category (or combination of categories) that is not appropriate for pages in a particular namespace - e.g. Wikipedia administration pages that are in a category that should only contain encyclopedic articles. This can then be fixed (e.g. by moving an article to the correct namespace or by editing a discussion to insert a missing ":" where a category is being referred to). The first step in this process is to identify (using PetScan) categories that cause incorrect categorization (e.g. Wikipedia administration categories that are in article categories).

Unkategorisierte Fotobeiträge in Commons in einer bestimmten Sprache finden

(Based on Grants:Learning patterns/Treasures or landmines: detecting uncategorized, language-specific uploads in Commons. See the motivation and full explanation there! Thank you to wikimedia user User:Spiritia and other contributors/commenters there for contributing this! )

Starten Sie eine PetScan-Abfrage mit den folgenden Einstellungen:

Language = commons
Project = wikimedia
Depth = 1
Categories = Media needing categories
Combination = ☑ Subset
Namespaces = ☑ File
Templates : Has all of these templates = <your language code> 
Format:  ☑ Extended data for files     ☑ File usage data

The English language code is "en"; the Romanian language code is "ro". To find uncategorized photos uploaded by users using Romanian language, a version of the query (with html output, and without autorun) is:

https://petscan.wmflabs.org/?language=commons&project=wikimedia&depth=1&categories=Media+needing+categories&ns%5B6%5D=1&templates_yes=ro&ext_image_data=1&file_usage_data=1

As of 15 March 2016, after hitting "run" the query requires about 105 seconds to finish, and yields 1748 uncategorized photos.

Notes:

  1. The "Language =" field is not used to select the desired language; the desired language code is set in the "Template" field instead.
  2. The language code is case-sensitive in the query! So for example use "ro" not "RO".
  3. To generate the results there, Format: ☑ Wiki was chosen, instead of the default output of Html.

Enjoy! Thanks again to User:Spiritia especially!

Datenobjekte ohne Aussagen

The option "Has no statements" can be used to find:

Steps to import the template, some with PetScan.

Die Sitelinks für ein bestimmtes Projekt aus einer SPARQL-Abfrage erhalten

  • Indicate the project on the 'Categories' tab. E.g. de for Language and wikipedia in Project to use the German language edition of Wikipedia.
  • In Other sources enter your SPARQL query
  • Make sure to select From categories from the Use wiki options
  • Press Do it

This could be useful to get the pageviews of a specific set of pages, based on a SPARQL query. You can save this to a Pagepile (check the Output tab), then enter that Pagepile ID in Massviews Analysis (select 'Page Pile' from the Source dropdown).

Get a list of Wikidata items with exclusions based on a SPARQL query

Let's say you got a list of people with Wikidata ID's (QIDs) that you want to add an occupation (P106) of 'jewellery designer' (Q2519376) to, maybe with a tool like QuickStatements. However, you don't want to add this occupation to items that already have that occupation. Here's how to do that with PetScan:

  • Have your list of QIDs in a text file, with each QID on a new line
  • In the tab 'Other sources', paste this text into the field called 'Manual list'
  • In the form 'Wiki' enter the string wikidatawiki
  • In the field 'SPARQL' enter your SPARQL query. In this example, this query will give all humans with an occupation of 'jewellery designer':
  • select ?item where { ?item wdt:P31 wd:Q5; wdt:P106 wd:Q2519376. }
  • Finally, you want to make an exclusion, so in the field 'Combination' add the string manual NOT sparql to get all the QIDs from the 'manual list', but without the items from the SPARQL query.
  • Hit 'Do it!'

Fügen Sie hier Ihr Beispiel hinzu...

Bug reports, feature requests, code base

See also