I am trying to fill my rdf with Spanish city names from Dbpedia But... nothing is extracted. I do it with the ARC2 library
<?php
include_once("./vendor/semsol/arc2/ARC2.php");
$config = array(
/* db */
'db_name' => 'my_db',
'db_user' => 'root',
'db_pwd' => 'root',
/* store name */
'store_name' => 'construct_store',
);
$store = ARC2::getStore($config);
if (!$store->isSetUp()) {
$store->setUp();
}
$store->query ('LOAD <http://localhost:8080/proyecto1/data/myOnto.rdf>');
$q = '
PREFIX myOntology: <http://www.semanticweb.org/myOntology#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbpprop: <http://dbpedia.org/property/>
PREFIX esdbpr: <http://es.dbpedia.org/resource/>
CONSTRUCT {
?l myOntology:hasName ?name.
}
WHERE (?x rdf:resource <http://dbpedia.org/ontology/PopulatedPlace">
?x <http://es.dbpedia.org/ontology/country> <http://es.dbpedia.org/resource/Spain> .
?name rdfs:label ?label.
)
}
LIMIT 5';
$r = '';
if ($rows = $store->query($q, 'rows')) {
foreach ($rows as $row) {
$r .= '<li>' . $row['name'] . '</li>';
}
}
echo $r ? '<ul>' . $r . '</ul>' : 'nothing is found';
?>
Maybe I am looking incorrectly through the DBPedia ontology or the CONSTRUCT structure in incorrect....
THank you in advance
What is rdf:resource
in your opinion for a property? You should only use properties that really exist, in your case it should be rdf:type
.
-> x rdf:type <http://dbpedia.org/ontology/PopulatedPlace">
And what is the quote char in the PopulatedPlace URI used for?
-> x rdf:type <http://dbpedia.org/ontology/PopulatedPlace>
And it's not clear if your local data contains the triples you're asking for. At least from the code I can only see that you load a file and execute the query against that file. By the way, you're mixing up URIs from the English and Spanish DBpedia - is this reflected by your data?