Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Balajijagadesh
.
Toggle Highlighting
SQL
<?php class SPARQLQueryDispatcher { private $endpointUrl; public function __construct(string $endpointUrl) { $this->endpointUrl = $endpointUrl; } public function query(string $sparqlQuery): array { $opts = [ 'http' => [ 'method' => 'GET', 'header' => [ 'Accept: application/sparql-results+json' ], ], ]; $context = stream_context_create($opts); $url = $this->endpointUrl . '?query=' . urlencode($sparqlQuery); $response = file_get_contents($url, false, $context); return json_decode($response, true); } } $endpointUrl = 'https://query.wikidata.org/sparql'; $sparqlQueryString = <<< 'SPARQL' SELECT ?item ?sitelink WHERE { ?sitelink schema:about ?item . ?sitelink schema:inLanguage "ta" . ?sitelink schema:isPartOf <https://ta.wikipedia.org/> . FILTER(NOT EXISTS { ?item rdfs:label ?lang_label . FILTER(LANG(?lang_label) = "ta") }) } LIMIT 100 SPARQL; $queryDispatcher = new SPARQLQueryDispatcher($endpointUrl); $queryResult = $queryDispatcher->query($sparqlQueryString); var_export($queryResult);
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...