Help
Difference between revisions of "SPARQL for maintenance"
SPARQL for maintenance gather some SPARQL queries which help to monitors errors and bring fix to our resources.
m |
|||
Line 2: | Line 2: | ||
== Speakers == | == Speakers == | ||
− | === ✅ Speakers | + | === ✅ Speakers → Username containing reserved sign `<code>-</code>` === |
:''See also [[:phabricator:T297635|T297635]]'' | :''See also [[:phabricator:T297635|T297635]]'' | ||
{| style="width:100%" | {| style="width:100%" | ||
Line 67: | Line 67: | ||
#ORDER BY DESC (?has_separator) | #ORDER BY DESC (?has_separator) | ||
GROUP BY (?has_separator) | GROUP BY (?has_separator) | ||
+ | </query> | ||
+ | |} | ||
+ | |||
+ | === ✅ Speakers → Speakers of `<code>zho</code>` to change to `<code>cmn</code>` === | ||
+ | :''Should be maintained to 0.'' | ||
+ | {| style="width:100%" | ||
+ | |- style="vertical-align:top;" | ||
+ | |style="padding: 0 3em;width:60%"| | ||
+ | <syntaxhighlight lang="sparql"> | ||
+ | SELECT ?langLabel ?isoLabel (SUBSTR(STR(?speaker),32) AS ?speaker) ?speakerLabel | ||
+ | WHERE { | ||
+ | ?speaker prop:P4 entity:Q130 . # Filter: P4 language is Q130 zho ; | ||
+ | ?speaker prop:P2 entity:Q3 . # Filter: speakers | ||
+ | ?speaker prop:P4 ?lang . | ||
+ | ?lang prop:P13 ?iso . | ||
+ | # Add Labels | ||
+ | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } | ||
+ | } ORDER BY ASC(?isoLabel) | ||
+ | # Helper: Chinese writing zho:Q130/wd:Q7850 ; Chinese mandarin cmn:Q113/wd:Q9192 . | ||
+ | </syntaxhighlight> | ||
+ | || | ||
+ | <query _pagination="5"> | ||
+ | SELECT ?langLabel ?isoLabel (SUBSTR(STR(?speaker),32) AS ?Speaker) ?speakerLabel | ||
+ | WHERE { | ||
+ | ?speaker prop:P4 entity:Q130 . # Filter: P4 language is Q130 zho ; | ||
+ | ?speaker prop:P2 entity:Q3 . # Filter: speakers | ||
+ | ?speaker prop:P4 ?lang . | ||
+ | ?lang prop:P13 ?iso . | ||
+ | # Add Labels | ||
+ | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } | ||
+ | } ORDER BY ASC(?isoLabel) | ||
+ | # Helper: Chinese writing zho:Q130/wd:Q7850 ; Chinese mandarin cmn:Q113/wd:Q9192 . | ||
</query> | </query> | ||
|} | |} |
Revision as of 13:56, 18 January 2022
Speakers
✅ Speakers → Username containing reserved sign `-
`
- See also T297635
SELECT *
WHERE {
?id prop:P2 entity:Q3 .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
?id rdfs:label ?name .
}
BIND (regex(STR(?name),"-") AS ?has_separator)
}
ORDER BY DESC (?has_separator)
|
|
SELECT ?has_separator (COUNT(?has_separator) AS ?found)
WHERE {
?id prop:P2 entity:Q3 .
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
?id rdfs:label ?name .
}
BIND (regex(STR(?name),"-") AS ?has_separator)
# filter( regex(?name, "-" ))
}
#ORDER BY DESC (?has_separator)
GROUP BY (?has_separator)
|
|
✅ Speakers → Speakers of `zho
` to change to `cmn
`
- Should be maintained to 0.
SELECT ?langLabel ?isoLabel (SUBSTR(STR(?speaker),32) AS ?speaker) ?speakerLabel
WHERE {
?speaker prop:P4 entity:Q130 . # Filter: P4 language is Q130 zho ;
?speaker prop:P2 entity:Q3 . # Filter: speakers
?speaker prop:P4 ?lang .
?lang prop:P13 ?iso .
# Add Labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
} ORDER BY ASC(?isoLabel)
# Helper: Chinese writing zho:Q130/wd:Q7850 ; Chinese mandarin cmn:Q113/wd:Q9192 .
|
|
Recordings
✅ Recordings → With ISO-639-3 `zho
` to change to `cmn
`
SELECT ?langLabel ?isoLabel (SUBSTR(STR(?audio),32) AS ?Audio) ?audioLabel
WHERE {
?audio prop:P4 entity:Q130 . # Filter: P4 language is Q130 zho ;
?audio prop:P2 entity:Q2 . # Filter: audios
?audio prop:P4 ?lang .
?lang prop:P13 ?iso .
# Add Labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
} ORDER BY ASC(?isoLabel)
# Helper: Chinese writing zho:Q130/wd:Q7850 ; Chinese mandarin cmn:Q113/wd:Q9192 .
|
|
SELECT ?isoLabel (COUNT(?iso) AS ?found)
WHERE {
?audio prop:P4 entity:Q130 . # Filter: P4 language is Q130 zho ;
?audio prop:P2 entity:Q2 . # Filter: audios
?audio prop:P4 ?lang .
?lang prop:P13 ?iso .
# Add Labels
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
} GROUP BY ?isoLabel
# Helper: Chinese writing zho:Q130/wd:Q7850 ; Chinese mandarin cmn:Q113/wd:Q9192
|
|