query-d7393fe93d10d0d74f56f3180bda0ae7
17:23, 11 October 2016 (UTC) dosisEpì as in this formulation. Could you help me? --and ... and ... and ... (either ... or ... or ...), not alternativeMy problem is: the three lines which describe what a ?fragment is should be 17:41, 11 October 2016 (UTC) dosisEpì: Could you please rewrite the entire query with your first option? I tried but I evidently made a mistake. --Jura1@ 17:32, 11 October 2016 (UTC) Jura--- ?fragment wdt:P136 ?fragmenttype VALUES ?fragmenttype { wd:Q3906966 wd:Q3164714 } seems generally faster than { } UNION { } UNION { }
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?fragment ?authorLabel ?fragmentLabel ?genreLabel ?dialectLabel ?title
WHERE
{
{ ?fragment wdt:P136/wdt:P279* wd:Q1885775 . }
UNION { ?fragment wdt:P136 wd:Q3906966 . }
UNION { ?fragment wdt:P136 wd:Q3164714 . }
OPTIONAL { ?fragment wdt:P50 ?author .}
OPTIONAL { ?fragment wdt:P136 ?genre .}
OPTIONAL { ?fragment wdt:P364 ?dialect .}
OPTIONAL { ?fragment wdt:P1476 ?title .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,grc" }
}
ORDER BY ?authorLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?author")
v1("?authorLabel"):::projected
v5("?dialect")
v2("?fragment"):::projected
v4("?genre")
v6("?title"):::projected
a1((" "))
c5(["wd:Q3164714"]):::iri
c3(["wd:Q1885775"]):::iri
c10(["bd:serviceParam"]):::iri
c4(["wd:Q3906966"]):::iri
c12(["en,grc"]):::literal
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P136"--> c5
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P136"--> c4
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"wdt:P136"--> a1
a1 --"wdt:P279"--> c3
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P50".-> v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P136".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P364".-> v5
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P1476".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end