Problem with simple access to XML/RDF elements

26 views
Skip to first unread message

Go S

unread,
Sep 25, 2018, 5:20:46 AM9/25/18
to EasyRdf Discussion
Hello EasyRdf people!

I have discovered EasyRdf recently and it is really cool, but I am stuck with a simple access to a couple of XML/RDF elements in my LOD data. Or I just do not understand well the documentation. Can you help me to find out why it does not work? Many thanks in advance!

1) Problem with Wikidata
$uri = 'http://www.wikidata.org/entity/Q2751';
$wikidata = EasyRdf_Graph::newAndLoad($uri);
// Just checking the data
$wikidatadump = $wikidata->dump();
echo $wikidatadump;
// The following does not work...why?
$wikidatauri = $wikidata->__get('http://www.wikidata.org/prop/direct-normalized/P214');
echo "P214:".$wikidatauri."\n";

2) Problem with DBpedia
$uri2 = 'http://dbpedia.org/resource/Siena';
$dbpedia = EasyRdf_Graph::newAndLoad($uri2);
// Just checking the data
$dbpediadump = $dbpedia->dump();
echo $dbpediadump;
// The following works
$dbpediauri = $dbpedia->__get('foaf:homepage');
echo $dbpediauri;
// The following does not work...why??
$dbpediauri1 = $dbpedia->all('owl:sameAs')[15];
echo "owl:sameAs:".$dbpediauri1."\n";

3) Problem with VIAF
$uri3 = 'http://viaf.org/viaf/239842096';
$viaf = EasyRdf_Graph::newAndLoad($uri3.'.rdf' );
// Just checking the data
$viafdump = $viaf->dump();
echo $viafdump;
// Trying primaryTopic
$viaf1 = $viaf->primaryTopic();
echo $viaf1;
// How do I specify http://id.worldcat.org/fast/1204409 in http://viaf.org/viaf/239842096 (EasyRdf_Resource)?
$viafuri = $viaf->all('schema:sameAs')[0];
echo "schema:sameAs:".$viafuri."\n";

Cheers,
Go S
Reply all
Reply to author
Forward
0 new messages