public function createNodeInstanceFromNodeParameter($value, $type, $datatype = null, $language = null)
    {
        switch ($type) {
            case 'uri':
                return $this->createNamedNode($value);

            case 'bnode':
                return $this->createBlankNode($value);

            case 'literal':
                return $this->createLiteral($value, $datatype, $language);

            case 'typed-literal':
                return $this->createLiteral($value, $datatype, $language);

            case 'var':
                return $this->createAnyPattern();

            default:
                throw new \Exception('Unknown $type given: '.$type);
        }
    }
public function createNodeInstanceFromNodeParameter($value, $type, $datatype = null, $language = null)
    {
        switch ($type) {
            case 'uri':
                return $this->createNamedNode($value);

            case 'bnode':
                return $this->createBlankNode($value);

            case 'literal':
                return $this->createLiteral($value, $datatype, $language);

            case 'typed-literal':
                return $this->createLiteral($value, $datatype, $language);

            case 'var':
                return $this->createAnyPattern();

            default:
                throw new \Exception('Unknown $type given: '.$type);
        }
    }
public function createNodeInstanceFromNodeParameter ( $ value , $ type , $ datatype = null , $ language = null ) { switch ( $ type ) { case 'uri' : return $ this -> createNamedNode ( $ value ) ; case 'bnode' : return $ this -> createBlankNode ( $ value ) ; case 'literal' : return $ this -> createLiteral ( $ value , $ datatype , $ language ) ; case 'typed-literal' : return $ this -> createLiteral ( $ value , $ datatype , $ language ) ; case 'var' : return $ this -> createAnyPattern ( ) ; default : throw new \ Exception ( 'Unknown $type given: ' . $ type ) ; } }
Helper function, which is useful, if you have all the meta information about a Node and want to create
the according Node instance.

@param string $value    value of the node
@param string $type     Can be uri, bnode, var or literal
@param string $datatype URI of the datatype (optional)
@param string $language Language tag (optional)

@return Node Node instance, which type is one of: NamedNode, BlankNode, Literal, AnyPattern

@throws \Exception if an unknown type was given
@throws \Exception if something went wrong during Node creation

@api

@since 0.8
Helper function which is useful if you have all the meta information about a Node and want to create the according Node instance .