|
From: Charles N. <cha...@ne...> - 2006-02-28 00:07:53
|
Hi,
I'm not very familiar with OOP and I wonder how to use OntModel methods=20
on a DbModel. I write here an example in order to precise my context.
<?php
define("RDFAPI_INCLUDE_DIR", "/var/www/wikisem/rdfapi-php/api/");
include(RDFAPI_INCLUDE_DIR . "RdfAPI.php");
include("/var/www/wikisem/config.inc.php"); // Define $config array
$wiki =3D new Wiki($config);
Class Wiki
{
function Wiki($config)
{
$store =3D ModelFactory::getDbStore(
$config['db_engine'],
$config['db_server'],
$config['db_database'],
$config['db_user'],
$config['db_password']);
$this->dbModel =3D $store->getModel('http://ex.net/2006/02/07');
$this->ontModel =3D $this->dbModel->getOntModel(RDFS_VOCABULARY);
$test =3D new=20
OntResource("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
$sup =3D $test->listRDFTypes();
}
=09
}
?>
produce a "Fatal error: Call to a member function on a non-object in=20
/var/www/wikisem/rdfapi-php093/api/ontModel/OntResource.php on line 402"
To test this example, RDF and RDFS have been loaded in the dbmodel=20
"http://ex.net/2006/02/07".
Thanks in advance,
Charles N=E9pote
|