I have had trouble like that too. Seems like it should just work.
But, something like this seems to work for me:
$mem_model = new MemModel(MODEL_URI);
$mem_model->addModel($infmodel->getModel());
I take the inf model and pass it to a new, general mem model using getModel.
Lars Weber wrote:
>Greetings all,
>
>playing around with RAP (V0.9.2) I try to merge two models read from
>different files. If I do this with with addModel() on Models created by
>getMemModel() everything seems to work as expected. However, the code
>below, where I create the models with getOntModel(), gives the following
>error:
>
> Fatal error: RDFAPI error (class: Statement; method: new):
> Resource expected as subject.
> in /usr/local/include/rdfapi-php/api/model/Statement.php on line
> 61
>
>Here is the code:
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <title>Event-Overview</title>
> </head>
> <body>
> <?php
> define ("RDFAPI_INCLUDE_DIR",
> "/usr/local/include/rdfapi-php/api/");
> include (RDFAPI_INCLUDE_DIR . "RdfAPI.php");
>
> $ZInfoOntologyModel =
> ModelFactory::getOntModel(INFMODELF,RDFS_VOCABULARY);
> $ZInfoOntologyModel->load ("../schemas/zinfo.rdf");
>
> $ZInfoModel =
> ModelFactory::getOntModel(INFMODELF,RDFS_VOCABULARY);
> $ZInfoModel->load ("zinfo.rdf");
>
> $ZInfoModel->addModel ($ZInfoOntologyModel);
>
> echo $ZInfoModel->writeAsHTMLTable();
> ?>
> </body>
> </html>
>
>Since getOntModel() is supoosed to be returning a MemModel as well,
>shouldn't I just be able to exchange one for the other? Am i missing
>something?
>
>Thanks for any help!
>
>Regards,
>Lars
>
>
>
>-------------------------------------------------------
>SF.Net email is Sponsored by the Better Software Conference & EXPO
>September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
>Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
>Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
>_______________________________________________
>Rdfapi-php-interest mailing list
>Rdf...@li...
>https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest
>
>
>
|