Ejemplo n.º 1
0
 /**
  * import xml rdf files into the knowledge base
  *
  * @access public
  * @author firstname and lastname of author, <*****@*****.**>
  * @param  string targetNameSpace
  * @param  string fileLocation
  * @return boolean
  */
 public function importXmlRdf($targetNameSpace, $fileLocation)
 {
     $returnValue = (bool) false;
     if (!file_exists($fileLocation) || !is_readable($fileLocation)) {
         throw new common_Exception("Unable to load ontology : {$fileLocation}");
     }
     if (!preg_match("/#\$/", $targetNameSpace)) {
         $targetNameSpace .= '#';
     }
     $modFactory = new core_kernel_api_ModelFactory();
     $returnValue = $modFactory->createModel($targetNameSpace, file_get_contents($fileLocation));
     return (bool) $returnValue;
 }
Ejemplo n.º 2
0
 /**
  * Insert a model
  * @param string $model the XML data
  * @return boolean true if inserted
  */
 public function insertModel($namespace, $model)
 {
     $returnValue = false;
     if (!preg_match("/#\$/", $namespace)) {
         $namespace .= '#';
     }
     $modFactory = new core_kernel_api_ModelFactory();
     $returnValue = $modFactory->createModel($namespace, $model);
     return $returnValue;
 }