public function determineEntityType($entity)
    {
        // remove braces at the beginning (only if $entity looks like <http://...>)
        if ('<' == substr($entity, 0, 1)) {
            $entity = str_replace(['>', '<'], '', $entity);
        }

        // checks if $entity is an URL
        if (true === $this->rdfHelpers->simpleCheckURI($entity)) {
            return 'uri';

        // checks if ^^< is in $entity OR if $entity is surrounded by quotation marks
        } elseif (false !== strpos($entity, '"^^<')
            || ('"' == substr($entity, 0, 1) && '"' == substr($entity, strlen($entity) - 1, 1))) {
            return 'typed-literal';

        // blank node
        } elseif (false !== strpos($entity, '_:')) {
            return 'blanknode';

        // checks if $entity is an URL, which was written with prefix, such as rdfs:label
        } elseif (false !== strpos($entity, ':')) {
            return 'uri';

        // checks if "@ is in $entity
        } elseif (false !== strpos($entity, '"@')) {
            return 'literal';

        // checks if $entity is a string; only strings can be a variable
        } elseif (true === is_string($entity)) {
            return 'var';

        // unknown type
        } else {
            return null;
        }
    }
public function determineEntityType($entity)
    {
        // remove braces at the beginning (only if $entity looks like <http://...>)
        if ('<' == substr($entity, 0, 1)) {
            $entity = str_replace(['>', '<'], '', $entity);
        }

        // checks if $entity is an URL
        if (true === $this->rdfHelpers->simpleCheckURI($entity)) {
            return 'uri';

        // checks if ^^< is in $entity OR if $entity is surrounded by quotation marks
        } elseif (false !== strpos($entity, '"^^<')
            || ('"' == substr($entity, 0, 1) && '"' == substr($entity, strlen($entity) - 1, 1))) {
            return 'typed-literal';

        // blank node
        } elseif (false !== strpos($entity, '_:')) {
            return 'blanknode';

        // checks if $entity is an URL, which was written with prefix, such as rdfs:label
        } elseif (false !== strpos($entity, ':')) {
            return 'uri';

        // checks if "@ is in $entity
        } elseif (false !== strpos($entity, '"@')) {
            return 'literal';

        // checks if $entity is a string; only strings can be a variable
        } elseif (true === is_string($entity)) {
            return 'var';

        // unknown type
        } else {
            return null;
        }
    }
public function determineEntityType ( $ entity ) { // remove braces at the beginning (only if $entity looks like <http://...>) if ( '<' == substr ( $ entity , 0 , 1 ) ) { $ entity = str_replace ( [ '>' , '<' ] , '' , $ entity ) ; } // checks if $entity is an URL if ( true === $ this -> rdfHelpers -> simpleCheckURI ( $ entity ) ) { return 'uri' ; // checks if ^^< is in $entity OR if $entity is surrounded by quotation marks } elseif ( false !== strpos ( $ entity , '"^^<' ) || ( '"' == substr ( $ entity , 0 , 1 ) && '"' == substr ( $ entity , strlen ( $ entity ) - 1 , 1 ) ) ) { return 'typed-literal' ; // blank node } elseif ( false !== strpos ( $ entity , '_:' ) ) { return 'blanknode' ; // checks if $entity is an URL, which was written with prefix, such as rdfs:label } elseif ( false !== strpos ( $ entity , ':' ) ) { return 'uri' ; // checks if "@ is in $entity } elseif ( false !== strpos ( $ entity , '"@' ) ) { return 'literal' ; // checks if $entity is a string; only strings can be a variable } elseif ( true === is_string ( $ entity ) ) { return 'var' ; // unknown type } else { return null ; } }
Determines type of a entity.

@param string $entity entity string

@return string|null Returns either literal, typed-literal, uri or var. Returns null if it couldnt be
determined.
Determines type of a entity .