query-f2d879586033746a2dd74c6a0564599f
WSJ articles contains a subject in title that is not set as a subject SELECT DISTINCT ?item ?itemLabel WHERE { ?item wdt:P1433 wd:Q164746. hint:Prior hint:runFirst "true"^^xsd:boolean. ?item (wdt:P31/(wdt:P279*)) wd:Q191067; p:P1433 ?publishedIn; rdfs:label ?label .
OPTIONAL { ?publishedIn pq:P2322 ?articleId. } OPTIONAL { ?item wdt:P953 ?url. } OPTIONAL { ?item wdt:P577 ?date. } OPTIONAL { ?item wdt:P921 ?currentSubjects. }
FILTER(CONTAINS(?label, "Iran")) . BIND( wd:Q794 as ?subject ) FILTER NOT EXISTS { ?item wdt:P921 $subject . } .
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". } } GROUP BY ?item ?itemLabel
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# WSJ articles contains a subject in title that is not set as a subject
SELECT DISTINCT ?item ?itemLabel WHERE {
?item wdt:P1433 wd:Q164746.
?item (wdt:P31/(wdt:P279*)) wd:Q191067;
p:P1433 ?publishedIn;
rdfs:label ?label .
OPTIONAL { ?publishedIn pq:P2322 ?articleId. }
OPTIONAL { ?item wdt:P953 ?url. }
OPTIONAL { ?item wdt:P577 ?date. }
OPTIONAL { ?item wdt:P921 ?currentSubjects. }
FILTER(CONTAINS(?label, "Iran")) .
BIND( wd:Q794 as ?subject )
FILTER NOT EXISTS {
?item wdt:P921 $subject .
} .
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". }
}
GROUP BY ?item ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?articleId")
v8("?currentSubjects")
v7("?date")
v1("?item"):::projected
v3("?label")
v4("?publishedIn")
v9("?subject")
v6("?url")
a1((" "))
c14(["bd:serviceParam"]):::iri
c4(["wd:Q164746"]):::iri
c16(["fr,en"]):::literal
c7(["wd:Q191067"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:direct/P921"--> e0v2
e0v1("?item"):::projected
e0v2("?subject"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> v9
v1 --"p:direct/P921"--> v9
f1[["contains(?label,'Iran')"]]
f1 --> v3
v1 --"p:direct/P1433"--> c4
v1 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c7
v1 --"p:P1433"--> v4
v1 --"rdfs:label"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P2322".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P953".-> v6
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P577".-> v7
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P921".-> v8
end
bind2[/"'wd:Q794'"/]
bind2 --as--o v9
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end