For a Virtuoso server the default SPARQL endpoint will be at the following URL:
http://localhost:8890/sparql
It is likely your code is not working because you are using a non-SPARQL endpoint as the URL
Question
What is the endpoint for Virtuoso?
Solution
For a Virtuoso server the default SPARQL endpoint will be at the following URL:
http://localhost:8890/sparql
It is likely your code is not working because you are using a non-SPARQL endpoint as the URL