%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}% ---+How can I obtain the object datatype? To display the object datatype of a triple in a SPARQL result set, the internal Virtuoso/PL function [[http://docs.openlinksw.com/virtuoso/fn_rdf_datatype_of_obj.html][DB.DBA.RDF_DATATYPE_OF_OBJ]] can be used, invoked as sql:RDF_DATATYPE_OF_OBJ. Assume the following scenario: # Explicit typecast (insert) SQL> sparql insert into { "string 1"^^xsd:string . }; callret-0 VARCHAR _______________________________________________________________________________ Insert into , 1 (or less) triples -- done 1 Rows. -- 94 msec. #Not explicit typecast (insert) SQL> sparql insert into { "string 2". }; callret-0 VARCHAR _______________________________________________________________________________ Insert into , 1 (or less) triples -- done 1 Rows. -- 16 msec. SQL> SPARQL SELECT ?o (iri(sql:RDF_DATATYPE_OF_OBJ(?o, 'untyped!'))) FROM { ?o} ; o callret-1 VARCHAR VARCHAR _______________________________________________________________________________ string 1 http://www.w3.org/2001/XMLSchema#string string 2 untyped! 2 Rows. -- 16 msec. SQL> ---+++Related * [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]