|
From: Charles N. <cha...@ne...> - 2006-02-28 22:04:03
|
Richard Cyganiak wrote :
> Hi Charles,
>=20
> This seems to be caused by a bug in RAP. Here's a snippet from model/=20
> Model.php:
>=20
> function & getOntModel($vocabulary) {
> require_once( RDFAPI_INCLUDE_DIR . PACKAGE_ONTMODEL);
> return new OntModel(& $this, $vocab);
> }
>=20
> The problem is $vocabulary/$vocab, the fix should be obvious.
>=20
> You could fix it in your own copy of RAP,
Ok. I made the fix :
function & getOntModel($vocabulary) {
require_once( RDFAPI_INCLUDE_DIR . PACKAGE_ONTMODEL);
return new OntModel(& $this, $vocabulary);
}
But that doesn't change anything (exactly the same error). Are you sure=20
my code is correct... I won't bet on it...
> or set up the OntModel =20
> directly, without using getOntModel.
How ?
Thanks Richard for your help.
Charles.
> Richard
>=20
>=20
> On 28 Feb 2006, at 01:08, Charles Nepote wrote:
>=20
>> Hi,
>>
>> I'm not very familiar with OOP and I wonder how to use OntModel =20
>> methods on a DbModel. I write here an example in order to precise my=20
>> 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_VOCABULAR=
Y);
>> $test =3D new=20
>> OntResource("http://www.w3.org/1999/02/22-rdf-syntax- ns#type");
>> $sup =3D $test->listRDFTypes();
>> }
>> =20
>> }
>> ?>
>>
>> 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 4=
02"
>>
>> 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
|