[0] [1] [2] [3]

PHP Script


<?php
// For terms of use see LICENSE.txt in this distribution.
include('simplerdf-php5.php');
exampleName('RDF/XML Saving demonstration'"Demonstrating the saving flexibility. Easy to read XML output that is easy to configure.");
// Create new SimpleRDF
$rdf=new SimpleRdf();
$rdf->loadFile('simplerdf-php5-01.in');

// This is the list of all triples we parsed from RDF source... You do not need to give any attention to this...
h1('Saving with compact settings');
$rdf->tidyMaxDepth=4// How many nested sententces?
$rdf->tidyMaxAttrs=32// How many XML attributes in one element?
$rdf->tidyAttrMaxLength=64// How long XML literal stored as XML attribute can be?
echo $rdf->saveXml();

h1('Saving with less compact settings');
$rdf->tidyMaxDepth=1// How many nested sententces?
$rdf->tidyMaxAttrs=0// How many XML attributes in one element?
$rdf->tidyAttrMaxLength=0// How long XML literal stored as XML attribute can be?
echo $rdf->saveXml();

// This is the list of all triples we parsed from RDF source... You do not need to give any attention to this...
h1('All N-Triples');
echo 
$rdf->saveNt();

saveOutput(__FILE__);

?>

Input


<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:lib="http://www.zvon.org/library">

 <rdf:Description about="Matilda" lib:creator="Roald Dahl" lib:pages="240" />
 <rdf:Description about="The BFG" lib:creator="Roald Dahl" lib:pages="208"/>
 <rdf:Description about="Heart of Darkness" lib:creator="Joseph Conrad" lib:pages="110"/>
 <rdf:Description about="Lord Jim" lib:creator="Joseph Conrad" lib:pages="314"/>
 <rdf:Description about="The Secret Agent" lib:creator="Joseph Conrad" lib:pages="249"/>
</rdf:RDF>

Output


::::::::::::::::::::::::RDF/XML Saving demonstration:::::::::::::::::::::::
:: Demonstrating the saving flexibility. Easy to read XML output that is
:: easy to configure.
:::::::::::::::::::::::SimpleRDF v0.2.10 (2004-11-19)::::::::::::::::::::::

----------------------[ Saving with compact settings ]---------------------
<?xml version="1.0"?>
<!-- Generated by SimpleRDF v0.2.10 <http://simplerdf.sourceforge.net> -->
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description xmlns:zvon="http://www.zvon.org/" rdf:about="_:SimpleRDF_id2292842" about="Matilda" zvon:librarycreator="Roald Dahl" zvon:librarypages="240"/>
  <rdf:Description xmlns:zvon="http://www.zvon.org/" rdf:about="_:SimpleRDF_id2288278" about="The BFG" zvon:librarycreator="Roald Dahl" zvon:librarypages="208"/>
  <rdf:Description xmlns:zvon="http://www.zvon.org/" rdf:about="_:SimpleRDF_id2288287" about="Heart of Darkness" zvon:librarycreator="Joseph Conrad" zvon:librarypages="110"/>
  <rdf:Description xmlns:zvon="http://www.zvon.org/" rdf:about="_:SimpleRDF_id2288296" about="Lord Jim" zvon:librarycreator="Joseph Conrad" zvon:librarypages="314"/>
  <rdf:Description xmlns:zvon="http://www.zvon.org/" rdf:about="_:SimpleRDF_id2294614" about="The Secret Agent" zvon:librarycreator="Joseph Conrad" zvon:librarypages="249"/>
</rdf:RDF>
-------------------[ Saving with less compact settings ]-------------------
<?xml version="1.0"?>
<!-- Generated by SimpleRDF v0.2.10 <http://simplerdf.sourceforge.net> -->
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about="_:SimpleRDF_id2292842">
    <about rdf:parseType="Literal">Matilda</about>
    <zvon:librarycreator xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">Roald Dahl</zvon:librarycreator>
    <zvon:librarypages xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">240</zvon:librarypages>
  </rdf:Description>
  <rdf:Description rdf:about="_:SimpleRDF_id2288278">
    <about rdf:parseType="Literal">The BFG</about>
    <zvon:librarycreator xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">Roald Dahl</zvon:librarycreator>
    <zvon:librarypages xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">208</zvon:librarypages>
  </rdf:Description>
  <rdf:Description rdf:about="_:SimpleRDF_id2288287">
    <about rdf:parseType="Literal">Heart of Darkness</about>
    <zvon:librarycreator xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">Joseph Conrad</zvon:librarycreator>
    <zvon:librarypages xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">110</zvon:librarypages>
  </rdf:Description>
  <rdf:Description rdf:about="_:SimpleRDF_id2288296">
    <about rdf:parseType="Literal">Lord Jim</about>
    <zvon:librarycreator xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">Joseph Conrad</zvon:librarycreator>
    <zvon:librarypages xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">314</zvon:librarypages>
  </rdf:Description>
  <rdf:Description rdf:about="_:SimpleRDF_id2294614">
    <about rdf:parseType="Literal">The Secret Agent</about>
    <zvon:librarycreator xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">Joseph Conrad</zvon:librarycreator>
    <zvon:librarypages xmlns:zvon="http://www.zvon.org/" rdf:parseType="Literal">249</zvon:librarypages>
  </rdf:Description>
</rdf:RDF>
-----------------------------[ All N-Triples ]-----------------------------
_:SimpleRDF_id2292842    <about>    "Matilda" .
_:SimpleRDF_id2292842    <http://www.zvon.org/librarycreator>    "Roald Dahl" .
_:SimpleRDF_id2292842    <http://www.zvon.org/librarypages>    "240" .
_:SimpleRDF_id2288278    <about>    "The BFG" .
_:SimpleRDF_id2288278    <http://www.zvon.org/librarycreator>    "Roald Dahl" .
_:SimpleRDF_id2288278    <http://www.zvon.org/librarypages>    "208" .
_:SimpleRDF_id2288287    <about>    "Heart of Darkness" .
_:SimpleRDF_id2288287    <http://www.zvon.org/librarycreator>    "Joseph Conrad" .
_:SimpleRDF_id2288287    <http://www.zvon.org/librarypages>    "110" .
_:SimpleRDF_id2288296    <about>    "Lord Jim" .
_:SimpleRDF_id2288296    <http://www.zvon.org/librarycreator>    "Joseph Conrad" .
_:SimpleRDF_id2288296    <http://www.zvon.org/librarypages>    "314" .
_:SimpleRDF_id2294614    <about>    "The Secret Agent" .
_:SimpleRDF_id2294614    <http://www.zvon.org/librarycreator>    "Joseph Conrad" .
_:SimpleRDF_id2294614    <http://www.zvon.org/librarypages>    "249" .
___________________________________________________________________________
SimpleRDF v0.2.10 <http://simplerdf.sourceforge.net>,RDF/XML parser for PHP5
Generated using PHP 5.0.2 on Fri Nov 19 09:15:48 2004