|
From: Charles N. <cha...@ne...> - 2006-03-01 22:44:09
|
Richard Cyganiak wrote :
> Hi all,
>=20
> There are two new methods in ModelFactory:
> getOntModelForBaseModel($baseModel, $vocabulary)
> getResModelForBaseModel($baseModel)
>=20
> They create ResModels and OntModels from an already existing model.
>=20
> The first one was necessary to make Model::getOntModel work. For =20
> consistency, I also added the second one.
>=20
> There are a bunch of new unit tests for this in /test/unit/Model/=20
> Model_tests.php and /test/unit/Model/ModelFactory_tests.php.
>=20
> Best,
> Richard
Hi Richard,
I tried the getOntModelForBaseModel method with a fresh CVS. But I still=20
have an error... here is my code for tests :
<?php
define("RDFAPI_INCLUDE_DIR", "/var/www/wikisem/rdfapi-php/api/");
include(RDFAPI_INCLUDE_DIR . "RdfAPI.php");
include("/var/www/wiki-s/config.inc.php");
$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://rn7.net/2006/02/07');
$this->dbModel->writeAsHtmlTable(); // To verify if the model is=20
correctly loaded
$this->ontModel =3D=20
ModelFactory::getOntModelForBaseModel($this->dbModel, RDFS_VOCABULARY);
=09
$test =3D new=20
OntResource("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
$sup =3D $test->listRDFTypes();
}
=09
}
?>
The model is correctly loaded from the base and a HTML table of 329=20
lines is correctly displayed. There are plenty of rdf:type in the model=20
; so listRDFTypes should give an answer... Instead I get a :
Fatal error: Call to a member function on a non-object in=20
/var/www/wikisem/rdfapi-cvs/rdfapi-php/api/ontModel/OntResource.php on=20
line 402
Is my syntax for creating the OntModem correct ?
Charles N=E9pote.
|