anon
anon

Reputation:

Whats wrong with this SPARQL query?

String sparql = "";
            sparql+= "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n";
            sparql+= "PREFIX i: <http://evolizer.org/ontologies/seon/2010/09/softwaremetrics.owl#>\n";
            sparql+= "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n";
            sparql+="SELECT ?metric ?value\n";
            sparql+="WHERE {\n";
            sparql+="?metric rdf:type i:SoftwareDesignMetric .\n";
            sparql+="?metric i:hasName McCabe .\n";
            sparql+= "?metric i:hasValue ?value \n";
            sparql+="}\n";

By executing i get this exception:

A first chance exception of type 'System.Net.WebException' occurred in System.dll
exception when sending query: 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX i: <http://evolizer.org/ontologies/seon/2010/09/softwaremetrics.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?metric ?value
WHERE {
?metric rdf:type i:SoftwareDesignMetric .
?metric i:hasName McCabe .
?metric i:hasValue ?value 
}

The problem has to be the query itself, because other queries to the same server are working.

Upvotes: 1

Views: 260

Answers (2)

anon
anon

Reputation:

I also found a validator that gives hint on what is wrong with a query:

http://sparql.org/query-validator.html

Upvotes: 0

JnBrymn
JnBrymn

Reputation: 25383

All of the examples here place the string arguments (such as McCabe in your example) in quotes. Could this be it?

Upvotes: 3

Related Questions