query-449793089b6818c26ec74c1604abc1a4

rq turtle/ttl

get english wikipedia URL (page) for wikidata Q itemI have a query that needs to be finished. It gets 3 items but the 4th - I don't know how to do. Also, how to make the NCT item optional (e.g., if no NCT property is there, don't require it) Similarly the wikipedia article may not exist. So I want an outer join. (get all trials and some trials will not have wikipedia page and will not have nctid.

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#>
SELECT ?item ?itemLabel ?nctid ?enwikipediaArticleTitle
WHERE 
{
  ?item wdt:P31 wd:Q30612.
  ?item wdt:P3098 ?nctid
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v2("?nctid"):::projected c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal c2(["wd:Q30612"]):::iri v1 --"wdt:P31"--> c2 v1 --"wdt:P3098"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end