Get label of a given dbpedia resource

584 Views Asked by At

For a given Dbpedia Resource, I want to get its Rdfs: label. For example, from http://fr.dbpedia.org/resource/Automobile, I should get Automobile,

I tried with easy RDF:

$label= new \EasyRdf\Graph;
$re= $label->label('http://fr.dbpedia.org/resource/Automobile');
var_dump($re)

but it gives me null as a result

I tried also with this Sparql request but it gives me null too:

SELECT ?label WHERE 
{ 
  <http://fr.dbpedia.org/resource/Automobile> rdfs:label ?label.
}
1

There are 1 best solutions below

0
M.Sarmini On

Just eliminate the (fr.) from your query:

SELECT ?label WHERE 
{ 
  <http://dbpedia.org/resource/Automobile> rdfs:label ?label.
}