If you just want the lexical form — the "2"
in "2"^^xsd:integer
— use str()
:
SELECT ?class (str(count(distinct ?subClass)) AS ?noci)
but note when talking about "2"^^xsd:integer
, that is due to the surface appearance only — in Turtle, it can be 2
(with no ""
). It's just syntax.
All literals (in RDF 1.1) have a lexical part and a datatype URI (and some have a lang tag in which case the datatype is rdf:langString
). In RDF-2004 (AKA RDF 1.0), there are plain literals and datatype literals.