query-10d4add5e2cd8cc76fbef7576562b07c
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?extract ?link ?wikipedia
WHERE
{
?link schema:about wd:Q541180 ; schema:name ?title ; schema:isPartOf ?wikimedia_site .
?wikimedia_site wikibase:wikiGroup "wikipedia" . # Use only Wikipedias
BIND (STRBEFORE(STRAFTER(STR(?wikimedia_site), "https://"), "/") AS ?wikipedia)
OPTIONAL
# The OPTIONAL keyword is used here to force the SPARQL engine to order the query so ?wikipedia (the endpoint) is bound before calling MWAPI
{
SERVICE wikibase:mwapi
{
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint ?wikipedia .
bd:serviceParam mwapi:generator "allpages" .
bd:serviceParam mwapi:gapfrom ?title .
bd:serviceParam mwapi:gapto ?title .
bd:serviceParam mwapi:prop "pageprops|extracts" .
bd:serviceParam mwapi:exsentences "3" . # number of sententences to extract (1-10)
# bd:serviceParam mwapi:exchars "100" . # number of characters to extract (1-1200)
bd:serviceParam mwapi:explaintext "true" .
?item wikibase:apiOutputItem mwapi:item .
?extract wikibase:apiOutput "extract/text()".
}
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fi". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?extract"):::projected
v5("?item"):::projected
v1("?link"):::projected
v2("?title")
v3("?wikimedia_site")
v4("?wikipedia"):::projected
c23(["mwapi:item"]):::iri
c8(["bd:serviceParam"]):::iri
c2(["wd:Q541180"]):::iri
c13(["allpages"]):::literal
c6(["wikipedia"]):::literal
c17(["pageprops|extracts"]):::literal
c28(["#91;AUTO_LANGUAGE#93;,fi"]):::literal
c25(["extract/text()"]):::literal
c19(["3"]):::literal
c21(["true"]):::literal
c10(["Generator"]):::literal
v1 --"schema:about"--> c2
v1 --"schema:name"--> v2
v1 --"schema:isPartOf"--> v3
v3 --"mwapi:wikiGroup"--> c6
bind0[/"substring-before(substring-after(str(?wikimedia_site),'https://'),'/')"/]
v3 --o bind0
bind0 --as--o v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c8 -."mwapi:api".-> c10
c8 --"mwapi:endpoint"--> v4
c8 --"mwapi:generator"--> c13
c8 --"mwapi:gapfrom"--> v2
c8 --"mwapi:gapto"--> v2
c8 --"mwapi:prop"--> c17
c8 --"mwapi:exsentences"--> c19
c8 --"mwapi:explaintext"--> c21
v5 --"mwapi:apiOutputItem"--> c23
v6 --"mwapi:apiOutput"--> c25
end
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c8 --"mwapi:language"--> c28
end