From: Richard C. <ri...@cy...> - 2006-02-28 22:44:58
|
On 28 Feb 2006, at 23:04, Charles Nepote wrote: > 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). Sorry, you're right ... I assumed that it was just the simple =20 spelling error in the method, but the problem is somewhat more =20 complicated. There's some code missing from the method. I'm working =20 on a fix. > Are you sure my code is correct... I won't bet on it... Looks good to me. >> or set up the OntModel directly, without using getOntModel. > > How ? I meant just put the (fixed) two lines of getOntModel into your own =20 code, but as we know now, that doesn't work. Here's another thing you can try: Create the OntModel with =20 ModelFactory::getOntModel(DBMODEL, RDFS_VOCABULARY) instead of =20 $dbModel->getOntModel(RDFS_VOCABULARY). You'll have to find out how =20 to initialise the database connection in constants.php though. Richard > > Thanks Richard for your help. > Charles. > > >> Richard >> On 28 Feb 2006, at 01:08, Charles Nepote wrote: >>> 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 =20 >>> 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/=20 >>> 2006/02/07'); >>> $this->ontModel =3D $this->dbModel->getOntModel=20 >>> (RDFS_VOCABULARY); >>> $test =3D new OntResource("http://www.w3.org/1999/02/22-rdf-=20= >>> syntax- ns#type"); >>> $sup =3D $test->listRDFTypes(); >>> } >>> } >>> ?> >>> >>> produce a "Fatal error: Call to a member function on a non-=20 >>> object in /var/www/wikisem/rdfapi-php093/api/ontModel/=20 >>> OntResource.php on line 402" >>> >>> To test this example, RDF and RDFS have been loaded in the =20 >>> dbmodel "http://ex.net/2006/02/07". >>> >>> Thanks in advance, >>> Charles N=E9pote > > |