public function testInitWithLabelAndDatatype() { $literal1 = Erfurt_Rdf_Literal::initWithLabelAndDatatype("true", "http://www.w3.org/2001/XMLSchema#boolean"); $literal2 = Erfurt_Rdf_Literal::initWithLabelAndDatatype("Testliteral2", "http://www.w3.org/2001/XMLSchema#string"); $this->assertSame("true", $literal1->getLabel()); $this->assertSame("Testliteral2", $literal2->getLabel()); $this->assertSame("http://www.w3.org/2001/XMLSchema#boolean", $literal1->getDatatype()); $this->assertSame("http://www.w3.org/2001/XMLSchema#string", $literal2->getDatatype()); }
protected function _parseQNameOrBoolean() { $c = $this->_read(); #if ($c !== ':' && !$this->_isPrefixStartChar($c)) { # $this->_throwException('Expected ":" or letter.'); #} $namespace = null; if ($c === ':') { // QName with default namespace if (isset($this->_namespaces[''])) { $namespace = $this->_namespaces['']; } else { $this->_throwException('Default namespace used, but not defined.'); } } else { $prefix = $c; $c = $this->_read(); while ($c !== -1 && !$this->_isWS($c) && $c !== ':') { $prefix .= $c; $c = $this->_read(); } if ($c !== ':') { // Prefix might be a boolean value. $value = $prefix; if ($prefix === 'true' || $prefix === 'false') { require_once 'Erfurt/Rdf/Literal.php'; return Erfurt_Rdf_Literal::initWithLabelAndDatatype($value, EF_XSD_BOOLEAN); } } $this->_verifyChar($c, ':'); if (isset($this->_namespaces[$prefix])) { $namespace = $this->_namespaces[$prefix]; } else { $this->_throwException("Namespace '{$prefix}' used, but not defined."); } } $localName = ''; $c = $this->_read(); while ($c !== -1 && !$this->_isWS($c) && $c !== ',' && $c !== ';' && $c !== ')') { $localName .= $c; $c = $this->_read(); } $this->_unread(); require_once 'Erfurt/Rdf/Resource.php'; return Erfurt_Rdf_Resource::initWithNamespaceAndLocalName($namespace, $localName); }