I am trying to create a valid time variable with xsd:time in SPARQL but I am getting an error message. I am able to do the same for a date with xsd:date however.
select ?eventDate (xsd:date((strbefore(?eventDate, " "))) as ?date) (xsd:time(strafter(?eventDate, " ")) as ?time)
You do not need casting here. For creating typed literals from strings you can use the builtin strdt function as in (strdt(strafter(?eventDate, " "), xsd:time) as ?time).
There is a slight difference: Casting validates the lexical value and strdt doesn't. So using strdt is prone to data corruption. Ex: SELECT ?time (datatype(?time) AS ?dt) { BIND (strdt("2019-0909", xsd:time) as ?time) }