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.

Line 2: Line 2:
  
 
== Users ==
 
== Users ==
=== Usernames containing reserved sign `<code>-</code>` ===
+
=== ✅ Speakers  → Username containing reserved sign `<code>-</code>` ===
 +
:''See also [[:phabricator:T297635|T297635]]''
 +
{| style="width:100%"
 +
|- style="vertical-align:top;"
 +
|style="padding: 0 3em;width:60%"|
 +
<syntaxhighlight lang="sparql">
 +
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)
 +
</syntaxhighlight>
 +
||
 +
<query _pagination="5">
 +
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)
 +
</query>
 +
|}
 +
 
 +
{| style="width:100%"
 +
|- style="vertical-align:top;"
 +
|style="padding: 0 3em;width:60%"|
 +
<syntaxhighlight lang="sparql">
 +
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)
 +
</syntaxhighlight>
 +
||
 +
<query _pagination="5">
 +
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)
 +
</query>
 +
|}
  
 
== Recordings ==
 
== Recordings ==

Revision as of 13:14, 18 January 2022


Users

✅ 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)
... Loading ...
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)
... Loading ...

Recordings

✅ Recordings → With ISO-639-3 `zho` to change to `cmn`

... Loading ...

SELECT ?langLabel ?isoLabel (SUBSTR(STR(?audio),32) AS ?Audio) ?audioLabel WHERE {

 ?audio prop:P2 entity:Q2 .   # Filter: P4 language is Q21 French  ;
 {
   ?audio prop:P4 entity:Q130 .   # Filter: P4 language is Q130 zho  ;
 } UNION { 
   ?audio prop:P4 entity:Q113 .   # Filter: P4 language is Q113 cmn  ;
 }
 ?audio prop:P4 ?lang .
 ?lang  prop:P13 ?iso .
 # Add Labels
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . } 

} ORDER BY ASC(?isoLabel)

  1. Helper: Chinese writing zho:Q130/wd:Q7850 ; Chinese mandarin cmn:Q113/wd:Q9192 .

Languages

Lingua Libre technical helps
Template {{Speakers category}} • {{Recommended lists}} • {{To iso 639-2}} • {{To iso 639-3}} • {{Userbox-records}} • {{Bot steps}}
Audio files How to create a frequency list?Convert files formatsDenoise files with SoXRename and mass rename
Bots Help:BotsLinguaLibre:BotHelp:Log in to Lingua Libre with PywikibotLingua Libre Bot (gh) • OlafbotPamputtBotDragons Bot (gh)
MediaWiki MediaWiki: Help:Documentation opérationelle MediawikiHelp:Database structureHelp:CSSHelp:RenameHelp:OAuthLinguaLibre:User rights (rate limit) • Module:Lingua Libre record & {{Lingua Libre record}}JS scripts: MediaWiki:Common.jsLastAudios.jsSoundLibrary.jsItemsSugar.jsLexemeQueriesGenerator.js (pad) • Sparql2data.js (pad) • LanguagesGallery.js (pad) • Gadgets: Gadget-LinguaImporter.jsGadget-Demo.jsGadget-RecentNonAudio.js
Queries Help:APIsHelp:SPARQLSPARQL (intermediate) (stub) • SPARQL for lexemes (stub) • SPARQL for maintenanceLingualibre:Wikidata (stub) • Help:SPARQL (HAL)
Reuses Help:Download datasetsHelp:Embed audio in HTML
Unstable & tests Help:SPARQL/test
Categories Category:Technical reports