Пример #1
0
 /**
  * Saves the RDF,N3 or N-Triple serialization of the MemModel to a file.
  * You can decide to which format the model should be serialized by using a
  * corresponding suffix-string as $type parameter. If no $type parameter
  * is placed this method will serialize the model to XML/RDF format.
  * Returns FALSE if the MemModel couldn't be saved to the file.
  *
  * @access	public
  * @param 	string 	$filename
  * @param 	string 	$type
  * @throws   PhpError
  * @return	boolean
  */
 function saveAs($filename, $type = 'rdf')
 {
     // get suffix and create a corresponding serializer
     if ($type == 'rdf') {
         // Import Package Syntax
         include_once RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF;
         $ser = new RdfSerializer();
     } elseif ($type == 'nt') {
         // Import Package Syntax
         include_once RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_N3;
         $ser = new NTripleSerializer();
     } elseif ($type == 'n3') {
         // Import Package Syntax
         include_once RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_N3;
         $ser = new N3Serializer();
     } else {
         print 'Serializer type not properly defined. Use the strings "rdf","n3" or "nt".';
         return false;
     }
     return $ser->saveAs($this, $filename);
 }