public function determineObjectDatatype($objectString)
    {
        $datatype = null;

        // checks if ^^< is in $objectString
        $arrowPos = strpos($objectString, '"^^<');

        // checks if $objectString starts with " and contains "^^<
        if ('"' === substr($objectString, 0, 1) && false !== $arrowPos) {
            // extract datatype URI
            $datatype = substr($objectString, $arrowPos + 4);

            return substr($datatype, 0, strlen($datatype) - 1);

        // checks for surrounding ", without ^^<
        } elseif ('"' == substr($objectString, 0, 1)
            && '"' == substr($objectString, strlen($objectString) - 1, 1)) {
            // if we land here, there are surrounding quotation marks, but no datatype
            return 'http://www.w3.org/2001/XMLSchema#string';

        // malformed string, return null as datatype
        } else {
            return null;
        }
    }
public function determineObjectDatatype($objectString)
    {
        $datatype = null;

        // checks if ^^< is in $objectString
        $arrowPos = strpos($objectString, '"^^<');

        // checks if $objectString starts with " and contains "^^<
        if ('"' === substr($objectString, 0, 1) && false !== $arrowPos) {
            // extract datatype URI
            $datatype = substr($objectString, $arrowPos + 4);

            return substr($datatype, 0, strlen($datatype) - 1);

        // checks for surrounding ", without ^^<
        } elseif ('"' == substr($objectString, 0, 1)
            && '"' == substr($objectString, strlen($objectString) - 1, 1)) {
            // if we land here, there are surrounding quotation marks, but no datatype
            return 'http://www.w3.org/2001/XMLSchema#string';

        // malformed string, return null as datatype
        } else {
            return null;
        }
    }
public function determineObjectDatatype ( $ objectString ) { $ datatype = null ; // checks if ^^< is in $objectString $ arrowPos = strpos ( $ objectString , '"^^<' ) ; // checks if $objectString starts with " and contains "^^< if ( '"' === substr ( $ objectString , 0 , 1 ) && false !== $ arrowPos ) { // extract datatype URI $ datatype = substr ( $ objectString , $ arrowPos + 4 ) ; return substr ( $ datatype , 0 , strlen ( $ datatype ) - 1 ) ; // checks for surrounding ", without ^^< } elseif ( '"' == substr ( $ objectString , 0 , 1 ) && '"' == substr ( $ objectString , strlen ( $ objectString ) - 1 , 1 ) ) { // if we land here, there are surrounding quotation marks, but no datatype return 'http://www.w3.org/2001/XMLSchema#string' ; // malformed string, return null as datatype } else { return null ; } }
Determines SPARQL datatype of a given string, usually of an object value.

@param string $objectString Object value, incl. datatype information.

@return string|null Returns datatype of object, e.g. http://www.w3.org/2001/XMLSchema#string. Returns
null if datatype couldnt be determined.
Determines SPARQL datatype of a given string usually of an object value .