query-8c84e420ee16be76cb307e207c02681b

rq turtle/ttl

TEMPLATE={"template":"Identifiers present on ?comparewith , but not on the item for Sean Connery","variables":{"?comparewith":{"query":"SELECT DISTINCT ?id WHERE { VALUES ?id { wd:Q81520 wd:Q181917 wd:Q4547 wd:Q134333 wd:Q41233 wd:Q205599 wd:Q37459 wd:Q7374 } } " } } } SELECT ?p ?pLabel ?comparewithLabel (SAMPLE(?url) AS ?url_comp2) WHERE { BIND(wd:Q39666 as ?comparewith) hint:Query hint:optimizer "None". { ?comparewith ?wdt ?v. ?p wikibase:directClaim ?wdt; wikibase:propertyType wikibase:ExternalId. FILTER NOT EXISTS { wd:Q4573 ?wdt [] } FILTER NOT EXISTS { ?p wdt:P31 wd:Q66712599 } FILTER NOT EXISTS { ?p wdt:P31 wd:Q27525351 } FILTER NOT EXISTS { ?p wdt:P31 wd:Q66118402 }
OPTIONAL { ?p wdt:P1630 ?f. } BIND(URI(REPLACE(?f, "\$1", ?v)) AS ?url) } UNION { BIND( wd:Q4573 as ?p) } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en"} } GROUP BY ?p ?pLabel ?comparewithLabel ORDER BY (?url_comp2)

Use at

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#>
#TEMPLATE={"template":"Identifiers present on ?comparewith , but not on the item for Sean Connery","variables":{"?comparewith":{"query":"SELECT DISTINCT ?id WHERE { VALUES ?id { wd:Q81520 wd:Q181917 wd:Q4547 wd:Q134333 wd:Q41233 wd:Q205599 wd:Q37459 wd:Q7374 }  } " } } }
SELECT
  ?p ?pLabel ?comparewithLabel
  (SAMPLE(?url) AS ?url_comp2) 
WHERE 
{
  BIND(wd:Q39666 as ?comparewith)

  {  ?comparewith ?wdt ?v.
     ?p wikibase:directClaim ?wdt; wikibase:propertyType wikibase:ExternalId.
     FILTER NOT EXISTS { wd:Q4573 ?wdt [] }
        FILTER NOT EXISTS { ?p wdt:P31 wd:Q66712599 }
        FILTER NOT EXISTS { ?p wdt:P31 wd:Q27525351 }
        FILTER NOT EXISTS { ?p wdt:P31 wd:Q66118402 }   
     OPTIONAL { ?p wdt:P1630 ?f. } BIND(URI(REPLACE(?f, "\\$1", ?v)) AS ?url)
  } UNION { BIND( wd:Q4573 as ?p) }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en"}
}
GROUP BY ?p ?pLabel ?comparewithLabel
ORDER BY (?url_comp2)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?comparewith") v6("?f") v8("?p"):::projected v7("?url"):::projected v8("?url_comp2") v5("?v") v4("?wdt") a1((" ")) c8(["wikibase:ExternalId"]):::iri c2(["wd:Q66118402"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal c4(["wd:Q66712599"]):::iri c5(["wd:Q4573"]):::iri c3(["wd:Q27525351"]):::iri bind0[/"'wd:Q39666'"/] bind0 --as--o v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; bind1[/"'wd:Q4573'"/] bind1 --as--o v8 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f2[["not "]] subgraph f2e0["Exists Clause"] e0v1 --"wdt:P31"--> e0c2 e0v1("?p"):::projected e0c2(["wd:Q66118402"]):::iri end f2--EXISTS--> f2e0 f2 --> v8 f2 --> c1 f2 --> c2 v8 --"wdt:P31"--> c2 f3[["not "]] subgraph f3e1["Exists Clause"] e1v1 --"wdt:P31"--> e1c2 e1v1("?p"):::projected e1c2(["wd:Q27525351"]):::iri end f3--EXISTS--> f3e1 f3 --> v8 f3 --> c1 f3 --> c3 v8 --"wdt:P31"--> c3 f4[["not "]] subgraph f4e2["Exists Clause"] e2v1 --"wdt:P31"--> e2c2 e2v1("?p"):::projected e2c2(["wd:Q66712599"]):::iri end f4--EXISTS--> f4e2 f4 --> v8 f4 --> c1 f4 --> c4 v8 --"wdt:P31"--> c4 f5[["not "]] subgraph f5e3["Exists Clause"] e3c1 -->e3v1--> e3a1 e3v1("?wdt"):::projected e3a1((" ")):::projected e3c1(["wd:Q4573"]):::iri end f5--EXISTS--> f5e3 f5 --> c5 f5 --> v4 f5 --> a1 c5 -->v4--> a1 v2 -->v4--> v5 v8 --"wikibase:directClaim"--> v4 v8 --"wikibase:propertyType"--> c8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v8 -."wdt:P1630".-> v6 end bind6[/"replace(?f,'\$1',?v)"/] v6 --o bind6 v5 --o bind6 bind6 --as--o v7 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind8[/"sample(?url)"/] v7 --o bind8 bind8 --as--o v8