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 |
From: Richard C. <ri...@cy...> - 2006-02-28 08:26:51
|
Hi Charles, This seems to be caused by a bug in RAP. Here's a snippet from model/=20 Model.php: function & getOntModel($vocabulary) { require_once( RDFAPI_INCLUDE_DIR . PACKAGE_ONTMODEL); return new OntModel(& $this, $vocab); } The problem is $vocabulary/$vocab, the fix should be obvious. You could fix it in your own copy of RAP, or set up the OntModel =20 directly, without using getOntModel. 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 precise =20 > 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 = OntResource("http://www.w3.org/1999/02/22-rdf-syntax-=20 > ns#type"); > $sup =3D $test->listRDFTypes(); > } > =09 > } > ?> > > produce a "Fatal error: Call to a member function on a non-object =20 > in /var/www/wikisem/rdfapi-php093/api/ontModel/OntResource.php on =20 > 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 > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting =20 > language > that extends applications into web and mobile media. Attend the =20 > live webcast > and join the prime developer group breaking into this new coding =20 > territory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=110944&bid$1720&dat=121642= > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > |
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 |
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 > > |
From: Richard C. <ri...@cy...> - 2006-02-28 23:44:37
|
Charles, a fix is in CVS now. (Tobias gave me CVS commit access, =20 yay!) When you update RAP from CVS, your code below will (hopefully!) =20= work. Richard On 28 Feb 2006, at 23:44, Richard Cyganiak wrote: > 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-=20 >>>> rdf-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 >> >> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting =20 > language > that extends applications into web and mobile media. Attend the =20 > live webcast > and join the prime developer group breaking into this new coding =20 > territory! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=110944&bid$1720&dat=121642= > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > |