Ejemplo n.º 1
0
 /**
  * Creates an instance of Node by given $value and $type.
  *
  * @param  mixed  $value
  * @param  string $type
  * @return Node   Instance of Node interface.
  * @throws \Exception
  */
 protected function createNodeByValueAndType($value, $type)
 {
     /**
      * URI
      */
     if ('uri' == $type) {
         return $this->nodeFactory->createNamedNode($value);
         /**
          * Any Pattern
          */
     } elseif ('var' == $type) {
         return $this->nodeFactory->createAnyPattern();
         /**
          * Typed Literal or Literal
          */
     } elseif ('typed-literal' == $type || 'literal' == $type) {
         return $this->nodeFactory->createLiteral($value);
         /**
          * Unknown type
          */
     } else {
         throw new \Exception('Unknown type given: ' . $type);
     }
 }