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);
        }
    }