-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Example implementation in php
// Enhancing
$query = '
PREFIX schema: <http://schema.org/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX bise: <http://akwi.de/ns/bise#>
PREFIX dbpedia-de: <http://de.dbpedia.org/resource/>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
INSERT {
GRAPH <'.$url.'> {
?placeURI schema:url ?wikipediaURL;
foaf:depiction ?depiction;
bise:desc ?comment.
?universityURI a schema:CollegeOrUniversity.
}
}
WHERE {
{
SELECT * WHERE {
GRAPH <'.$url.'> {
{
SELECT * WHERE {
?universityURI a schema:CollegeOrUniversity.
?placeURI a schema:Place.
}
LIMIT 1
}
}
SERVICE <http://de.dbpedia.org/sparql/> {
?placeURI rdfs:comment ?comment_lang;
foaf:isPrimaryTopicOf ?wikipediaURL;
foaf:depiction ?depiction.
FILTER (LANG(?comment_lang) = "de")
BIND (str(?comment_lang) AS ?comment)
}
}
}
}
';
$response = sparqlUpdate($query);https://github.com/EduGraph/EduGraph-Preview/blob/dev-php-implementation/extract.php
and
function sparqlUpdate($query){
$service = 'http://fbwsvcdev.fh-brandenburg.de:8080/fuseki/EduGraph-ESWC-extract/update';
$client = new GuzzleHttp\Client(['base_uri' => $service]);
try {
$response = $client->request('POST', '', [
'headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Accept' => 'application/sparql-results+json; charset=utf-8application/sparql-results+json; charset=utf-8'
],
'body' => 'update='.$query
]);
return $response;
}
catch(Exception $e) {
$responseBody = $e->getResponse()->getBody(true);
echo '<pre>';
print_r ($e->getMessage());
echo $responseBody;
echo '</pre>';
}
}https://github.com/EduGraph/EduGraph-Preview/blob/dev-php-implementation/function.php
Metadata
Metadata
Assignees
Labels
No labels