Exemple #1
0
 public function add_row($row, $key_subject = null, $normalize = false)
 {
     if (!empty($key_subject) && array_key_exists($key_subject, $row)) {
         $subject = $row[$key_subject];
     }
     if (!RdfStream::is_uri($subject)) {
         $subject = $this->create_subject();
     }
     foreach ($row as $property => $value) {
         if (!empty($key_subject) && strcmp($property, $key_subject) === 0) {
             continue;
         }
         if ($normalize) {
             $property = RdfStream::normalize_localname($property);
         }
         if ($this->output === RdfStream::RDF_SYNTAX_NT && !strpos($property, ":")) {
             $property = $this->propns . $property;
         }
         if (is_array($value)) {
             //a list of values
             foreach ($value as $object) {
                 $this->add_triple($subject, $property, $object);
             }
         } else {
             $object = $value;
             $this->add_triple($subject, $property, $object);
         }
     }
 }