From: Richard C. <ri...@cy...> - 2005-05-30 09:15:53
|
Hi Christian, Am 28.05.2005 um 09:13 schrieb Christian Boulanger (Bibliograph Development): > another newbie question. How do I get raw XML from a model via a > method? What do you mean by the "raw XML" of a model? A model is just a bunch of statements. There are different formats for writing a model into a string. RDF/XML and N3 are the most popular, and there are others like NTriples and TriX. I guess you want the statements of your model in RDF/XML format? > There is saveAs() to save it to a file, writeAsHtml() to get it > hmtlentitized, and writeAsHtmlTable to have a table. What if I only > need the XML string to output it later with header("Content-Type: > text/xml")? Did I miss something here? $model->writeRdfToString() might do what you want. Note that RDF/XML has its own MIME type, application/rdf+xml, and using that is usually more appropriate than text/xml. Richard > > Thanks, > > Christian > > Christian Boulanger wrote: > > >> Hallo, >> >> I am new to RDFAPI-PHP but very impressed by the careful design >> and the >> good documentation. I am stuck with a problem, however, and >> thought you >> might be able to help me: >> >> I have a hierarchical folder structure in my database which I want to >> display in a Mozilla XUL Tree Widget that can natively use the RDF >> as a >> datasource. >> >> $db = $rdf->getNewModel($datasource); >> $dbRes = new ResModel($db); >> >> if I create a root sequence like so: >> >> $treeRootSeq = $dbRes->createSeq("urn:bibliograph:folder#root"); >> >> and programmatically add members of the sequence: >> >> $folderRes = >> $dbRes->createResource("urn:bibliograph:folder#(newFolderId goes >> here)"); $treeRootSeq->add( $folderRes ); >> >> the generated RDF looks like this: >> >> <rdf:Description rdf:about="urn:bibliograph:folder#root"> >> <rdf:_2 >> rdf:resource="urn:bibliograph:folder#89e51c22d059c6abde622855aa7f5321 >> "/> >> </rdf:Description> >> >> .... >> >> <rdf:Seq >> rdf:about="urn:bibliograph:folder#828679db024d9dc591676782c63b949d"> >> <rdf:_1 >> rdf:resource="urn:bibliograph:folder#92eb042f602b699051344f1b2e25c12f >> "/> >> <rdf:_2 >> rdf:resource="urn:bibliograph:folder#6c00094831008383d4e1b9cba22bf30f >> "/> >> <rdf:_3 >> rdf:resource="urn:bibliograph:folder#48a124b55bfa09881264c0342d419a50 >> "/> >> </rdf:Seq> >> >> What I would like to have, however, is this: >> >> <rdf:Description rdf:about="urn:bibliograph:folder#root"> >> <rdf:Seq> >> <rdf:li >> rdf:resource="urn:bibliograph:folder#92eb042f602b699051344f1b2e25c12f >> "/> >> <rdf:li >> rdf:resource="urn:bibliograph:folder#6c00094831008383d4e1b9cba22bf30f >> "/> >> <rdf:li >> rdf:resource="urn:bibliograph:folder#48a124b55bfa09881264c0342d419a50 >> "/> >> </rdf:Seq> >> </rdf:Description> >> >> How do I have to code this? >> >> Thanks, >> >> Christian >> >> >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by Yahoo. >> Introducing Yahoo! Search Developer Network - Create apps using >> Yahoo! >> Search APIs Find out how you can build Yahoo! directly into your own >> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn- >> ostg-q22005 >> _______________________________________________ >> Rdfapi-php-interest mailing list >> Rdf...@li... >> https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest >> >> > > -- > Bibliograph: Open Source On-line Reference Management > > http://www.bibliograph.org > Email: in...@bi... > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Yahoo. > Introducing Yahoo! Search Developer Network - Create apps using Yahoo! > Search APIs Find out how you can build Yahoo! directly into your own > Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg- > q22005 > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > > |