Virtuoso 37000 Error SP030: SPARQL compiler


#1

I have upload a .ttl file to a SPARQL Execution in a virtuoso server and whene run that question:

 SELECT DISTINCT ?studentName
	WHERE{
		?student rdf:type ?Class .
		?Class rdfs:subClassOf ms:Student .
		?student ms:Name_Student ?studentName .
		}

I have that error:

Virtuoso 37000 Error SP030: SPARQL compiler, line 6: Undefined namespace prefix at ‘ms’ before ‘.’

SPARQL query:
define sql:big-data-const 0
#output-format:text/html
define input:default-graph-uri SELECT DISTINCT ?studentName
WHERE{
?student rdf:type ?Class .
?Class rdfs:subClassOf ms:Student .
?student ms:Name_Student ?studentName .
}

How can i fix the problem with the prefix?


#2

@consof: The PREFIX keyword describes prefix declarations for abbreviating URIs. Without a prefix, you would have to use the entire URI in the query. Thus the ms prefix on your query needs to be specified in the query as:

PREFIX ms: <prefix-name>
SELECT DISTINCT ?studentName
WHERE{
?student rdf:type ?Class .
?Class rdfs:subClassOf ms:Student .
?student ms:Name_Student ?studentName .
}

you should know what the ms prefix should be called based on the data in the dataset.


#3

@consof

You will probably find the needed PREFIX line at the start of the .ttl file you loaded. It will start PREFIX ms: and end with something like <http://example.com/blah/#>.

The whole line should be added to the start of your SPARQL query.

Please let us know if this gets you past the error…