query-f9ce2fd588b679b7d86d32e55096bec3
But if I try to combine two mwapi service queries with UNION there is no results. : Works now BROKEN
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?cattitle ?item WHERE
{
VALUES ?cattitle1 {
"category:Parainen"
}
VALUES ?cattitle2 {
"category:Turku"
}
{
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "fi.wikipedia.org" .
bd:serviceParam mwapi:gcmtitle ?cattitle1 .
bd:serviceParam mwapi:generator "categorymembers" .
bd:serviceParam mwapi:gcmprop "ids|title|type" .
bd:serviceParam mwapi:gcmlimit "max" .
bd:serviceParam wikibase:limit 50 .
# out
?subcat wikibase:apiOutput mwapi:title .
?ns wikibase:apiOutput "@ns" .
?item wikibase:apiOutputItem mwapi:item .
}
}
UNION
{
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Generator" .
bd:serviceParam wikibase:endpoint "fi.wikipedia.org" .
bd:serviceParam mwapi:gcmtitle ?cattitle2 .
bd:serviceParam mwapi:generator "categorymembers" .
bd:serviceParam mwapi:gcmprop "ids|title|type" .
bd:serviceParam mwapi:gcmlimit "max" .
bd:serviceParam wikibase:limit 50 .
# out
?subcat wikibase:apiOutput mwapi:title .
?ns wikibase:apiOutput "@ns" .
?item wikibase:apiOutputItem mwapi:item .
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?cattitle1")
v2("?cattitle2")
v5("?item"):::projected
v4("?ns")
v3("?subcat")
c6(["fi.wikipedia.org"]):::literal
c20(["mwapi:item"]):::iri
c13(["max"]):::literal
c18(["@ns"]):::literal
c9(["categorymembers"]):::literal
c2(["bd:serviceParam"]):::iri
c15(["50^^xsd:integer"]):::literal
c17(["mwapi:title"]):::iri
c11(["ids|title|type"]):::literal
c4(["Generator"]):::literal
bind0[/VALUES ?cattitle1/]
bind0-->v1
bind00(["category:Parainen"])
bind00 --> bind0
bind1[/VALUES ?cattitle2/]
bind1-->v2
bind10(["category:Turku"])
bind10 --> bind1
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:api"--> c4
c2 --"mwapi:endpoint"--> c6
c2 --"mwapi:gcmtitle"--> v2
c2 --"mwapi:generator"--> c9
c2 --"mwapi:gcmprop"--> c11
c2 --"mwapi:gcmlimit"--> c13
c2 --"mwapi:limit"--> c15
v3 --"mwapi:apiOutput"--> c17
v4 --"mwapi:apiOutput"--> c18
v5 --"mwapi:apiOutputItem"--> c20
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
subgraph s1["http://wikiba.se/ontology#mwapi"]
style s1 stroke-width:4px;
c2 --"mwapi:api"--> c4
c2 --"mwapi:endpoint"--> c6
c2 --"mwapi:gcmtitle"--> v1
c2 --"mwapi:generator"--> c9
c2 --"mwapi:gcmprop"--> c11
c2 --"mwapi:gcmlimit"--> c13
c2 --"mwapi:limit"--> c15
v3 --"mwapi:apiOutput"--> c17
v4 --"mwapi:apiOutput"--> c18
v5 --"mwapi:apiOutputItem"--> c20
end
end
union0r <== or ==> union0l
end