From: Gunnar A. G. <ggr...@cs...> - 2005-04-25 12:18:25
|
Yes, the missing bit wsa the RDF type triple, you could also have fixed it by adding: $model->add(new Statement($person, $RDF_type, $FOAF_Person)) - gunnar Jonathan Hendler wrote: > Sorry, I guess there was no bug here.... At least this might help some > one who is similarly confused. > > I got the desired output with: > > $person = $model->createOntClass( "$modelURI2". "Person" ); > $sonia = $person->createInstance("$modelURI2". "Sonia"); > > > > Jonathan Hendler wrote: > >> Ok, so I take the res model and use getModel to get the underlying mem >> model, and I can add it to the database >> (sighs with relief) >> >> But, the RDFS generated is : >> >> <rdf:Description >> rdf:about="http://newscup.net/dev/hendler3#PersonInstance"> >> <ns2:hasTeeth>11</ns2:hasTeeth> >> <ns2:hasName>Sonia</ns2:hasName> >> </rdf:Description> >> >> And I want it to be: >> >> <ns2:Person rdf:about="http://newscup.net/dev/hendler3#PersonInstance"> >> <ns2:hasTeeth>11</ns2:hasTeeth> >> <ns2:hasName>Sonia</ns2:hasName> >> </ns2:Person> >> >> This is an important difference, isn't it? >> >> >> hen...@ya... wrote: >> >>> Perhaps I am doing something wrong? >>> >>> I am using php 4.3.10 on windoze. >>> >>> Summary: >>> >>> Can not create a RES model then add it to a DB/MEM model. >>> >>> Error(s): >>> >>> - function fails >>> "Call to undefined function: writeashtml() in..." >>> >>> - adding resource model to a memmodel, or db model fails >>> >>> "Fatal error: RDFAPI error (class: MemModel; method: addModel): Model >>> expected..." >>> >>> Code: >>> >>> $modelURI = "http://somwhere.net/something/" >>> $modelURI2 = $modelURI.'#'; >>> $rdfuri = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; >>> $rdfsuri = 'http://www.w3.org/TR/1999/PR-rdf-schema-19990303#'; >>> >>> >>> >>> // Create an empty Model >>> $model = ModelFactory::getResModel(MEMMODEL, $modelURI); >>> >>> >>> $mammalURI = $modelURI2.'Mammal'; >>> $personURI = $modelURI2.'Person'; >>> $rdfuriAbout = $model->createResource($rdfuri.'about'); >>> >>> $person = $model->createResource($personURI); >>> $mammal = $model->createResource($mammalURI); >>> >>> >>> $hasTeeth = $model->createProperty($modelURI2.'hasTeeth'); >>> $hasName = $model->createProperty($modelURI2.'hasName'); >>> >>> >>> //more code here >>> >>> >>> $model->writeAsHtml(); //fails >>> $model2 = new MemModel($modelURI); $model2->addModel($model); >>> //fails >>> >>> >>> >>> >>> >>> ------------------------------------------------------- >>> SF email is sponsored by - The IT Product Guide >>> Read honest & candid reviews on hundreds of IT Products from real users. >>> Discover which products truly live up to the hype. Start reading now. >>> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >>> _______________________________________________ >>> Rdfapi-php-interest mailing list >>> Rdf...@li... >>> https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest >>> >> >> >> >> >> ------------------------------------------------------- >> SF email is sponsored by - The IT Product Guide >> Read honest & candid reviews on hundreds of IT Products from real users. >> Discover which products truly live up to the hype. Start reading now. >> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> _______________________________________________ >> Rdfapi-php-interest mailing list >> Rdf...@li... >> https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest >> > > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest -- Gunnar AAstrand Grimnes ----------------------- Room 312, Computing Science Dept. University of Aberdeen Aberdeen AB24 3UE Mobile: (+44) (0) 7950 251379 Email: ggr...@cs... WWW: http://www.csd.abdn.ac.uk/~ggrimnes |