コード例 #1
0
ファイル: AgentManager.php プロジェクト: Symbiota/Symbiota
 public function getAsRdfXml()
 {
     $returnvalue = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
     $returnvalue .= "<rdf:RDF \n";
     $returnvalue .= "  xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"\n";
     $returnvalue .= "  xmlns:bio=\"http://purl.org/vocab/bio/0.1/\"\n";
     $returnvalue .= "  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
     $returnvalue .= ">\n";
     $l = new agentlinks();
     $links = $l->loadArrayByagentid($this->model->getagentid());
     $linklist = "";
     foreach ($links as $link) {
         if ($link->getisprimarytopicof() == 1) {
             $linklist .= '    <foaf:isPrimaryTopicOf rdf:resource="' . $link->getlink() . '" />' . "\n";
         }
         if ($link->gettype() == 'homepage') {
             $linklist .= '    <foaf:homepage rdf:resource="' . $link->getlink() . '" />' . "\n";
         }
         if ($link->gettype() == 'image') {
             $linklist .= '    <foaf:depiction rdf:resource="' . $link->getlink() . '" />' . "\n";
         }
     }
     if ($this->model->gettype() == 'Individual') {
         $returnvalue .= ' <foaf:Person rdf:about="urn:uuid:' . $this->model->getUuid() . '">' . "\n";
         $returnvalue .= "    <foaf:name>" . $this->model->getAssembledName() . "</foaf:name>\n";
         if (strlen($this->model->getbiography()) > 0) {
             $returnvalue .= "    <bio:biography>" . $this->model->getbiography() . "</bio:biography>\n";
         }
         $returnvalue .= $linklist;
         $returnvalue .= "  </foaf:Person>\n";
     } elseif ($this->model->gettype() == 'Team') {
         $returnvalue .= ' <foaf:Group rdf:about="urn:uuid:' . $this->model->getUuid() . '">' . "\n";
         $returnvalue .= "    <foaf:name>" . $this->model->getAssembledName() . "</foaf:name>\n";
         $returnvalue .= "  </foaf:Group>\n";
     } elseif ($this->model->gettype() == 'Organization') {
         $returnvalue .= ' <foaf:Organization rdf:about="urn:uuid:' . $this->model->getUuid() . '">' . "\n";
         $returnvalue .= "    <foaf:name>" . $this->model->getAssembledName() . "</foaf:name>\n";
         $returnvalue .= $linklist;
         $returnvalue .= "  </foaf:Agent>\n";
     } else {
         $returnvalue .= ' <foaf:Organization rdf:about="urn:uuid:' . $this->model->getUuid() . '">' . "\n";
         $returnvalue .= "    <foaf:name>" . $this->model->getAssembledName() . "</foaf:name>\n";
         $returnvalue .= $linklist;
         $returnvalue .= "  </foaf:Agent>\n";
     }
     $returnvalue .= "</rdf:RDF>\n";
     return $returnvalue;
 }