You are here

protected function EasyRdf_Parser_RdfXml::endState4 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/RdfXml.php \EasyRdf_Parser_RdfXml::endState4()

@ignore

1 call to EasyRdf_Parser_RdfXml::endState4()
EasyRdf_Parser_RdfXml::endElementHandler in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/RdfXml.php
@ignore

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/RdfXml.php, line 626

Class

EasyRdf_Parser_RdfXml
A pure-php class to parse RDF/XML.

Code

protected function endState4($t) {

  /* empty p | pClose after cdata | pClose after collection */
  if ($s = $this
    ->getParentS()) {
    $b = isset($s['p_x_base']) && $s['p_x_base'] ? $s['p_x_base'] : (isset($s['x_base']) ? $s['x_base'] : '');
    if (isset($s['is_coll']) && $s['is_coll']) {
      $this
        ->add($s['value'], $this->rdf . 'rest', $this->rdf . 'nil', $s['type'], 'uri');

      /* back to collection start */
      while (!isset($s['p']) || $s['p'] != $t) {
        $subS = $s;
        $this
          ->popS();
        $s = $this
          ->getParentS();
      }

      /* reification */
      if (isset($s['p_id']) && $s['p_id']) {
        $this
          ->reify($b
          ->resolve('#' . $s['p_id']), $s['value'], $s['p'], $subS['value'], $s['type'], $subS['type']);
      }
      unset($s['p']);
      $this
        ->updateS($s);
    }
    else {
      $dt = isset($s['o_datatype']) ? $s['o_datatype'] : null;
      $l = isset($s['p_x_lang']) && $s['p_x_lang'] ? $s['p_x_lang'] : (isset($s['x_lang']) ? $s['x_lang'] : null);
      $o = array(
        'type' => 'literal',
        'value' => $s['o_cdata'],
      );
      $this
        ->add($s['value'], $s['p'], $o['value'], $s['type'], $o['type'], $dt, $l);

      /* reification */
      if (isset($s['p_id']) && $s['p_id']) {
        $this
          ->reify($b
          ->resolve('#' . $s['p_id']), $s['value'], $s['p'], $o['value'], $s['type'], $o['type'], $dt, $l);
      }
      unset($s['o_cdata']);
      unset($s['o_datatype']);
      unset($s['p']);
      $this
        ->updateS($s);
    }
    $this->state = 2;
  }
}