public function add_triple($s, $p, $o, $o_type = null) { //skip triple with empty subject, predicate or object if (!isset($s) || !isset($p) || !isset($o)) { return; } $this->number_of_triples++; //detect object type in case it was not provided if (empty($o_type)) { if (RdfStream::is_uri($o)) { $o_type = RdfStream::RDF_URI; } else { if (is_int($o)) { $o_type = RdfStream::RDF_INTEGER; } else { if (stristr($p, "date") >= 0 && ($date = RdfStream::get_xsddatetime($o))) { if (strlen($date) > 10) { $o_type = RdfStream::RDF_DATETIME; } else { $o_type = RdfStream::RDF_DATE; } $o = $date; } else { $o_type = RdfStream::RDF_STRING; } } } } switch ($this->output) { case RdfStream::RDF_SYNTAX_NT: $this->nt_add_triple($s, $p, $o, $o_type); break; case RdfStream::RDF_SYNTAX_RDFXML: default: $this->rdfxml_add_triple($s, $p, $o, $o_type); break; } }